[erlang-questions] Best Erlang approach for sending and parsing XML via HTTP

Robert Raschke rtrlists@REDACTED
Sat Nov 17 19:19:54 CET 2012


Hi Thomas,

if all you really need, is that one specific call, then rolling your own
simple solution with httpc and xmerl is the quickest route. And xmerl_xs is
very handy for retrieving the result value.

Only when you get to the stage of dealing with multiple SOAP operations and
more complicated XML structures does something more "integrated" become
viable.

Robby
 On Nov 17, 2012 5:27 PM, "Thomas Elsgaard" <thomas.elsgaard@REDACTED>
wrote:

> Hi list
>
> I need to interface with an SOAP service, and i would like to keep it as
> simple as possible, so basically i would like just to send the XML via HTTP
> and parse the response, what is the best approach for this with Erlang?
>
> Could i use httpc, or should i go for the SOAP client via Yaws?
>
> The request i need to send is:
>
> -------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> ">
>     <soapenv:Header />
>     <Body>
>         <ns:Login xmlns:ns="http://schemas.ericsson.com/cai3g1.1/">
>             <ns:userId>"xxxx"</ns:userId>
>             <ns:pwd>"xxxx"</ns:pwd>
>         </ns:Login>
>     </Body>
> </soapenv:Envelope>
> -------------------------
>
> And i need to get the sessionId in the response:
>
> -------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <SOAP-ENV:Envelope xmlns:SOAP-ENV="
> http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="
> http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
> http://www.w3.org/2001/XMLSchema" xmlns:ns="
> http://schemas.ericsson.com/cai3g1.0/2003/05/30/" xmlns:ns2="
> http://schemas.ericsson.com/cai3g1.0/2004/01/22/" xmlns:ns3="
> http://schemas.ericsson.com/cai3g1.1/" xmlns:ns4="
> http://schemas.ericsson.com/cai3g1.2/">
>     <SOAP-ENV:Header></SOAP-ENV:Header>
>     <SOAP-ENV:Body>
>         <ns3:LoginResponse>
>
> <ns3:sessionId>84c3646484c36464000000001353168328092</ns3:sessionId>
>             <ns3:baseSequenceId>5584289115023516944</ns3:baseSequenceId>
>         </ns3:LoginResponse>
>     </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> -------------------------
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121117/65547d2b/attachment.htm>


More information about the erlang-questions mailing list