elixir-soap / soap

SOAP client for Elixir programming language
MIT License
135 stars 75 forks source link

Map into Map as params? #82

Open HaNdlezz opened 4 years ago

HaNdlezz commented 4 years ago

Hi, the params in the call, are defined in the documentation as: %{key: value}, if i need define map into map,is accepted as valid params? i try, but i get a error

example:%{key: value, key2: %{key3: value}}

Nitrino commented 4 years ago

@HaNdlezz Hi. Nested maps should work. what error do you get?

I checked with a test WSDL file:

params = params = %{example: %{key: "key_data", key2: %{key3: "key3_data"}}}
Soap.call(wsdl, "getRates", params)

result:

<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<env:Envelope xmlns:=\"http://schemas.xmlsoap.org/wsdl/\" 
    xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" 
    xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" 
    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
    <env:Header/>
    <env:Body>
        <getRates xmlns=\"http://fedex.com/ws/rate/v26\">
            <example>
                <key>key_data</key>
                <key2>
                    <key3>key3_data</key3>
                </key2>
            </example>
        </getRates>
    </env:Body>
</env:Envelope>
HaNdlezz commented 4 years ago

Hi, thanks for you answer.

I have this file: http://serviciosdls.starken.cl/TrackingCarga/TrackingCargaServiceWS?WSDL, when i run Soap.init_model(file_path, :file), y get a response without operations (operations: [ ]), in this case, i modified the file, in specific: before: image

after: image

Whit this modification in the file, Soap.init_model(file_path, :file), recognize the operation "detalleTrackingCarga", so, i run: Soap.call(wsld, "detalleTrackingCarga", params).. and i get: image

Here the operations availables: image

Here, the full process: image

Ty for your answers my friend, cheers

Liferenko commented 3 years ago

I've got the same issue. Looks like it tries to Enum.find(fn x -> x[:name] == operation end) in our WSDL file, but there is an empty wsdl[:complex_types] list.

It crashes on /deps/soap/lib/soap/request/params.ex:220

UPD: I was outstep that issue (and finally got a SoapFault) when I changed mix.exs in line [{:soap, git: "https://github.com/elixir-soap/soap"}], after it mix deps.unlock soap && mix deps.get. It is not a solution, but it's one step closer to it