linusdm
I’m researching the possibility of reviving a project that makes use of ancient SOAP technology. Since hardware is involved, a switch to a newer technology stack is not option, unfortunately.
Has anybody been successful at serving SOAP requests somehow, in a Phoenix project? I see there are some SOAP client libraries on hex.pm, but no SOAP servers.
There was a prior discussion over here, but it concluded that it’s a no-go for Elixir. I hope to find some new evidence that it is possible.
I’m curious if this could be solved by accepting the HTTP requests as usual with Plug or in a Phoenix controller. But then call out to a lower level implementation (possibly C or C++) that does the legwork of parsing the request. Then act upon that request and formulate a response in plain Elixir. And then finally encode the Elixir response by passing it once more through the low-level library that generates the required XML that can be send back by the Plug connection.
I’ve seen libraries like Apache Axis and gSOAP that theoretically could do such magic. But I’m not sure what it would take to actually create this integration.
Other nudges toward better ideas are very much appreciated.
PS: the wsdl specification I’m interested in, if it is of any help, is located here and documented here. It’s a specification for distributing Daisy talking books (audiobooks).
Trending in Discussions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
dimitarvp
I’d say if the clients (hardware devices that can’t have their software changed, I take it?) do not utilize a central repository of WSDL and SOAP registries and hundreds of schemas then you’re better off just constructing the XML yourself manually. Both Erlang and Elixir have numerous libraries for this but if you struggle with it, we can help.
Ultimately it all boils down to this: WSDL / SOAP are just producing and parsing XML according to certain XML Schema files. That’s it really. Don’t be threatened. No need to shell out to other programming languages unless time is super tight.
linusdm
Yes, these are audiobook players for sight disabled people. A niche hardware thing (although these things are disappearing, as the smartphones have become very accessible too). To be inclusive, even this old technology needs to be supported.
I have the impression that parsing SOAP requests can become very complex, very fast, with its complex structure and nested namespaces… but maybe it is doable
LostKobrakai
XML can become abstractions nested within abstractions, but the question will be how many of those you actually need to interact with. The spec you linked looks like a managable thing to work with.
Awlexus
If you have a wsdl file for the service, you might be able to use the plug from this library. soapex/lib/soapex/plugs/soap.ex at master · kim-company/soapex · GitHub. We are using this library with a wrapper around this plug to serve a production soap/wsdl api. I’d be happy to help if you have additional questions
linusdm
Interesting! I have trouble understanding what the soapex library actually does. I see that it depends on detergent. I rejected it when I first came across detergent for some reason I don’t recall.
It’s the first time I see the use of Records.
Where would I need to “inject” the wsdl, at compile-time? I guess you don’t have an example usage lying around?
Am I correct to assume this library allows you to intercept SOAP messages at the “operation” level, passing in the parsed arguments? And then helps encoding response, according to the wsdl definition? If so: great!
Awlexus
Sorry for the late reply. We create a custom plug that handles the parsing of the incoming soap requests and some utilities for sending a reply.
Using this plug builds a model from the wsdl at compile time, parses and validates incoming requests, and; similar to a controller; executes a function with the same name.
linusdm
Thanks for the detailed reply!
I’m a bit confused. The sample code you’re sharing does not rely on soapex. It’s directly using detergent and erlsom. Is this the way you’re setting things up in your application too?
I’m getting this error:
I’m not very familiar with integrating an Erlang library into an Elixir project, so maybe I’m missing something here. Adding
:erlsomas an application maybe, somewhere in the mix file?Awlexus
The module
Erlsom.Recordsis actually part of thesoapexlibrary: soapex/lib/erlsom/records.ex at master · kim-company/soapex · GitHublinusdm
That helped
I’m understanding the pieces better now.
I’m bumping into the issue that using my specific wsdl (and referenced xsd’s) results in this error:
I turned on some logging to get the
defining P_...lines. I guess there is a problem with overlap in the names that some xsd’s use. Is there a way to keep these separate? I don’t know where that prefixPis coming from.I see these namespaces in the erlsom model:
abcis the prefix I passed in, thePprefix seems to be some kind of default?linusdm
Hmm. I see where it happens in detergent:
https://github.com/devinus/detergent/blob/5354f1c82520666f5746aae1fbbec41331b52f4c/src/detergent.erl#L372
The todo gives it away: “using the same prefix for all XSDS makes no sense”