Closed lejoko closed 5 years ago
Hi Joel, I tried to fix your problem in #42 PR, but I do not have access to your server and I can not test.
Please set
{:soap, git: "https://github.com/potok-digital/soap.git", branch: "add-support-empty-soap-action"}
in your mix.exs
and try to call request as described in Readme
Thank you very much! I am currently on vacation but transmitted this to my colleagues so they can test.
Hi @Nitrino,
Thank you for your time.
Now the lib success to parse the wsdl :), but we still get an error (A new one this time).
<soap:Envelope
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>\n\tInvalid parameter: Operator with Name 2 not found.The following error occurred while executing the request: Operator with Name 2 not found\n</faultstring>
<detail>
<ValidationException xmlns=\"http://api.ws.hss.onevox.com\">
<dto
xmlns:ns1=\"http://www.w3.org/2001/XMLSchema-instance\" ns1:nil=\"true\"
xmlns=\"http://validation.ws.hss.onevox.com\" />
<message
xmlns=\"http://validation.ws.hss.onevox.com\">\n\tInvalid parameter: Operator with Name 2 not found.The following error occurred while executing the request: Operator with Name 2 not found\n
</message>
<validationErrors xmlns=\"http://validation.ws.hss.onevox.com\">
<validationErrors>
<entry xmlns=\"http://api.ws.hss.onevox.com\">
<key
xmlns:ns1=\"http://www.w3.org/2001/XMLSchema\"
xmlns:ns2=\"http://www.w3.org/2001/XMLSchema-instance\" ns2:type=\"ns1:string\">Operator with Name 2 not found
</key>
<value
xmlns:ns1=\"http://www.w3.org/2001/XMLSchema\"
xmlns:ns2=\"http://www.w3.org/2001/XMLSchema-instance\" ns2:type=\"ns1:string\">Operator with Name 2 not found
</value>
</entry>
</validationErrors>
</validationErrors>
</ValidationException>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
I think the problem is due to the request sent to the soap server is not right formatted, I compare the request the lib send with the request done by a python soap library (that works) and I think there is a problem of namespace:
Here's the xml request that the lib send:
<env:Envelope
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:Body>
<getSubscriberInfo
xmlns=\"http://api.dto.ws.hss.onevox.com\">
<operatorName>MyOperator</operatorName>
<subscriberId>2</subscriberId>
</getSubscriberInfo>
</env:Body>
</env:Envelope>
And here is a right formatted request: (I get it with the python zeep library that work with our soap server):
<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Body>
<ns0:getSubscriberInfo xmlns:ns0="http://api.ws.hss.onevox.com">
<ns0:subscriberId>2</ns0:subscriberId>
<ns0:operatorName>MyOperator</ns0:operatorName>
</ns0:getSubscriberInfo>
</soap-env:Body>
</soap-env:Envelope>
For displaying the request sent by the lib I added
IO.inspect body
And here is my code:
wsdl_path = "http://my-wsdl-url.com?WSDL"
action = "getSubscriberInfo"
params = %{subscriberId: "2", operatorName: "MyOperator"}
# Parse wsdl file for execution of action on its basis
{:ok, wsdl} = Soap.init_model(wsdl_path, :url)
%Soap.Response{body: body, headers: _headers, request_url: _url, status_code: code} = Soap.call(wsdl, action, params)
a = Soap.Response.parse(body, code)
IO.inspect a
Thank you very much for your time! Unfortunately, as you can see from my colleagues answer, we went from one problem to another and it is complicated for us to give access to our api since it is an important part of infrastructure that is available only on a private network. Could you give us pointers or ideas on how we might solve it ourselves? Or may you be interested by doing paid work on our problem? I might be able to find some funds to allocate on that.
Hi guys. Forgive me I did not have time on the weekend, I'll try to see today
@lejoko @ElielHaouzi I'm sorry, I did not have time yesterday. I'm currently looking for job and spend a lot of time on interviews. If you are looking for a full-time developer for a remote job, let me know 😄
I pushed fix in add-support-empty-soap-action
branch. I hope it should help.
Try to update your code with command mix deps.update --only soap
and make a request.
If this does not help, let me know about it, maybe for quick help, I will need access to your server.
Hi and thank you very much for you time. I had a look at your latest patch to add a default namespace and I think that it may have been useless. Actually the problem that my colleague had and that I still had after your patch was not from your code, but from our soap server. It seems that it doesn't care about the name of the parameters at all: they seem to be positional. Since Elixir maps are not ordered, the parameters sent to the server were not in the right position.
In my colleague @ElielHaouzi 's test, if I replace:
params = %{subscriberId: "2", operatorName: "MyOperator"}
by
params = [{"subscriberId", "2"}, {"operatorName", "MyOperator"}]
or even by
params = [{"a", "2"}, {"b", "MyOperator"}]
it does work. We'll have a further look at this and let you know if there are other problems.
Regarding a remote job, I'm sorry, but we don't do that in our company for fulltime jobs. We occasionally do it part time with employees that we know well, or when we work on a specific project with a contractor.
I'm glad that we helped solve your problem. In the next few days I will finish that PR and release a new version and you will be able to switch to it, so as not to depend on GitHub.
Hi,
My company is building mobile services with Elixir. We need a way to talk to a SOAP api. We tried erlang libs, but they all fail to parse the wsdl of the services we need. We tried your lib, but as is written in the README it is not production ready (and doesn't work).
We don't have very good knowledge of soap, but we may be ready to pay for a bit of development service in order to get a soap lib that works with our service.
Here is one of the problematic wsdl files if you want to have a look: api.wsdl.txt
Would it be possible to discuss something on that subject?