soap icon indicating copy to clipboard operation
soap copied to clipboard

(ArgumentError) could not fetch application environment :globals for application :soap because configuration :globals was not set

Open ismailunal opened this issue 4 years ago • 5 comments

Hi there,

With Elixir 1.9.1 I couldn't go further instead I receive this error: "(ArgumentError) could not fetch application environment :globals for application :soap because configuration :globals was not set"

I tried creating a config/config.exs

import Config

config :soap, :globals, version: "1.1"

import_config "#{config_env()}.exs"

And mix.exs file is as follows;

defmodule Countryinfoserv.MixProject do
  use Mix.Project

  def project do
    [
      app: :countryinfoserv,
      version: "0.1.0",
      elixir: "~> 1.9",
      start_permanent: Mix.env() == :prod,
      deps: deps()
    ]
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      extra_applications: [:logger, :soap]
    ]
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      # {:dep_from_hexpm, "~> 0.3.0"},
      # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
      {:soap, "~> 1.0"}
    ]
  end
end

ismailunal avatar Dec 20 '20 09:12 ismailunal

You don't need to add soap to extra_applications

Nitrino avatar Dec 20 '20 11:12 Nitrino

Hi, thanks for your response. It didn't make any difference unfortunately.

ismailunal avatar Dec 20 '20 12:12 ismailunal

So, if anybody can help this is the full text of the error;

** (ArgumentError) could not fetch application environment :globals for application :soap because configuration :globals was not set (elixir) lib/application.ex:493: Application.fetch_env!/2 (soap) lib/soap/wsdl.ex:217: Soap.Wsdl.soap_version/0 (soap) lib/soap/wsdl.ex:218: Soap.Wsdl.soap_version/1 (soap) lib/soap/wsdl.ex:198: Soap.Wsdl.get_soap_namespace/2 (soap) lib/soap/wsdl.ex:29: Soap.Wsdl.parse/3

ismailunal avatar Dec 21 '20 08:12 ismailunal

Hi,

You need to define :config_path in your project.

Something like this:

def project do
    [
      app: :ssl_demo_01,
      version: "0.1.0",
      elixir: "~> 1.13",
      config_path: "config/config.exs",
      start_permanent: Mix.env() == :prod,
      deps: deps()
    ]
  end

fmbraga avatar Dec 14 '21 17:12 fmbraga

This is an unnecessary complication. For one, libraries apparently should not utilize application configuration.

Secondly, in the absence of such an entry, soap_version/0 of line 108 in parser.ex could first check if something is defined before using Application.fetch_env! and fallback to version 1.1 if not.

waseigo avatar Mar 07 '23 21:03 waseigo