From Elixir, I am trying to call a SOAP Web Service with detergentex, which is a wrapper around the Erlang library detergent.
I can call the SOAP Web Service in the exam
According to the implementation a prefix is added on the init_model
.
def init_model(wsdl_url, prefix \\ 'p') do
Detergentex.Client.init_model(wsdl_url, prefix)
end
I would suggest to add an empty prefix.
This code
def is_wsdl(wsdl), do: :detergent.is_wsdl(wsdl)
def wsdl_operations(wsdl), do: :detergent.wsdl_operations(wsdl)
in detergentex/lib/detergentex/client.ex should be replaced with
def is_wsdl(wsdl) do
:detergent.is_wsdl(wsdl)
end
def wsdl_operations(wsdl) do
:detergent.wsdl_operations(wsdl)
end
so you will avoid a bug with incorrect prefix. I don't know what is wrong because both versions seem legit.
Your code will not work anyway - a new error appears :/
I have a different errors with my code for the url:
wsdl_url = 'http://webapi.allegro.pl/service.php?wsdl'
The first one:
** (throw) {:error, 'Struct doesn\'t match model: recordtype not expected: p:doQuerySysStatus'}
src/erlsom_write.erl:366: :erlsom_write.findAlternative/4
src/erlsom_write.erl:256: :erlsom_write.processSubType/5
src/erlsom_write.erl:239: :erlsom_write.processElementValues/7
src/erlsom_write.erl:130: :erlsom_write.struct2xml/6
src/erlsom_write.erl:326: :erlsom_write.processAlternativeValue/8
src/erlsom_write.erl:239: :erlsom_write.processElementValues/7
src/erlsom_write.erl:114: :erlsom_write.struct2xml/6
src/erlsom_write.erl:326: :erlsom_write.processAlternativeValue/8
and after correcting:
** (Protocol.UndefinedError) protocol String.Chars not implemented for {:ok, :undefined, :undefined}
(elixir) lib/string/chars.ex:3: String.Chars.impl_for!/1
(elixir) lib/string/chars.ex:17: String.Chars.to_string/1
(elixir) lib/io.ex:429: IO.puts/2
So this time it looks like it is something wrong with encoding I suppose.