rameshsharma

rameshsharma

Develop a Soap service in elixir and phoenix

How to create a soap service in elixir and phoenix. I went through some of the links but nowhere I could get complete guidance on development of a soap service in elixir and phoenix. I have a wsdl url and a request xml. On hitting the wsdl url with the request xml in soap ui, I am getting a proper response. I want to develop this calling of the wsdl and getting a response in elixir and phoenix. What should I refer to. Could not find very useful reference till now. Can someone please guide me.

Marked As Solved

dch

dch

I’ve been down the same path as others have mentioned here. The incompatibilities will continue to bite you for months and months, as you find small details that are not handled the same way in whichever client you’ve chosen. I have seen this in python, perl, php, erlang, elixir, and even SOAPUI - every tool has a slightly different interpretation of what features it supports, and how to access them. The SOAP Way is pure darkness.

My advice is:Keep it simple, don’t use SOAP.

  • Generate your requests in plain XML using Eex templates
  • Use a sensible elixir HTTP library
  • use sweet_xml or floki (yes really) to extract responses

You will have working code, locally testable, in no time at all.

Also Liked

halostatue

halostatue

I understand. You might have success with one of the various projects I list below, but it entirely depends on whether the WSDL represents something that was written and the service code was written from it…or whether the WSDL is something generated from the service code. The former presents interfaces that conform to spec far more frequently and simply. The latter will do things that are possible in the spec, but don’t happen in WSDL-first services, which means that most WSDL parsers handle them poorly.

Here are all the toolkits I’ve tried before basically punting:

  • elixir-soap/soap
  • trbngr/Lyex
  • polyfox/castile
  • bet365/soap
  • zdeneksejcek/soapex

Of these, bet365/soap is the most mature but hasn’t been maintained in years; polyfox/castile is promising but hasn’t been maintained in a long time; zdeneksejcek/soapex is really interesting but incomplete. None of them worked with any one of the four WSDLs I had to work with.

If yours is a simple enough service, you’d probably be better off building EEx templates for sending the requests and XML parsers for receiving the requests and calling the services with an HTTP client (most SOAP is over HTTPS, after all).

If it’s not a simple service…all I can say is good luck doing it in Elixir. SOAP is a technology that only works really well if you have relatively large engineering teams building the code tooling around the excessively complicated standards. The absolute best platforms/languages to develop SOAP services and clients are Java and C#—because the SOAP standards were mostly written by people who work at Oracle (and Sun before that), IBM, SAP, and Microsoft.

The truth is, I don’t want to write a SOAP client in Elixir—because I don’t want to use SOAP if I can avoid it, and that disdain also means that I’m not likely to maintain it (even the Ruby toolkit that I ended up using, soap4r-ng, hasn’t been maintained in a few years, but it’s a lot more mature than anything in Elixir/Erlang that does SOAP).

halostatue

halostatue

If you can, build a REST-to-SOAP service in a language that has good SOAP support. I have tried all of the various SOAP libraries in Erlang and Elixir and have yet to find one that can properly parse the WSDLs that I had to deal with (they all failed at some point or another)

I ended up using Ruby with soap4r (well, soap4r-ng), because neither savon nor lolsoap could handle the complexity of the SOAP service I used.

SOAP is a nasty piece of work because it’s fully object oriented and if your service was built system-first, rather than WSDL-first, you will have heavy object orientation and polymorphism to deal with and pretty much all of the Erlang/Elixir SOAP services that I played with failed.

If I have to deal with another SOAP service (I’m usually doing enterprise integrations, so it’s not unlikely), I will either do the same thing or build my own WSDL/WSSE/SOAP layer with the goal of open sourcing it, but that’s probably a year in the future at least. It’s a hard thing, because once we got started with the soap4r approach, we had our gateway and Elixir code implemented in about two weeks. It would have taken two weeks just to get a working WSDL parser for Elixir to handle the multiple WSDLs I had to deal with.

I love Elixir, but there’s no good answer to doing SOAP in Elixir at this point.

dimitarvp

dimitarvp

It’s what everyone should do. WSDL and SOAP were dead on arrival. They were born in some pretty dark times; people thought that imposing a huge and slow formal processes by organisations full of academics who have zero exposure to the real world was actually a good idea.

I’ve known a ton of Java devs back then (and I was one; talking about 2003-2009). At least 80% of them just made their own SOAP parsing and generating code and were done months before the others who insisted on using heavyweight libraries for it.

Where Next?

Popular in Questions Top

New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
vac
Hi, I’m quite new in Elixir and I’m trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and I...
New
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> somethi...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New

Other popular topics Top

johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31142 143
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement