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.

CharlesO

CharlesO

It’s still a very real integration requirement for a lot of Legacy (and not so legacy) services.

Really don’t see that changing anytime soon

OvermindDL1

OvermindDL1

Don’t neglect erlang libraries for soap handling as well. Soap was more of a big thing back in erlang’s creation days.

But for note, soap is just (mostly) xml in various defined ways, it’s not hard to do it manually with no libraries at all.

Where Next?

Popular in Questions Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database. Dep...
New
logicmason
Hi there, I'm working through my first release with elixir/phoenix. I've built a release with distillery and found that it crashes when I...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
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
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
Fl4m3Ph03n1x
Background Let’s assume I have a typical GenServer that receives messages as requests, does some operation in a DB and returns responses....
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New

Other popular topics Top

William
I would like to know that is there any online source for learning Phoenix Framework for building E-Commerce Store? Any advantage on build...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New

We're in Beta

About us Mission Statement