Elixir call Axis2 Java SOAP Web Service with detergentex and detergent

前端 未结 2 1961
时光取名叫无心
时光取名叫无心 2021-02-07 07:13

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

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-07 08:05

    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.

提交回复
热议问题