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

Dmitry Kolesnikov dmkolesnikov@REDACTED
Sat Nov 17 18:32:26 CET 2012


Hello,

Yes, simples solution is httpc + xmerl for xml parsing. All components are otp built-in. 
but ready made soap client might give you some advantage on envelope parsing.

- Dmitry

On Nov 17, 2012, at 7:27 PM, Thomas Elsgaard 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/d1c57a9a/attachment.htm>


More information about the erlang-questions mailing list