Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

SOAP::Lite and custom envelopes

by jan (Initiate)
on Mar 16, 2012 at 09:29 UTC ( #959946=perlquestion: print w/replies, xml ) Need Help??

jan has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I have to create a SOAP client for a third-party webservice. I tried to use SOAP::Lite but my request is not accepted. The support told me how the request has to look like:
<soapenv:Envelope xmlns:soapenv=" +ope/" xmlns:ecom=""> <soapenv:Header/> <soapenv:Body> <ecom:Encrypt> <ecom:shopLogin>username</ecom:shopLogin> <ecom:uicCode>242</ecom:uicCode> <ecom:amount>0.01</ecom:amount> <ecom:shopTransactionId>562</ecom:shopTransactionId> </ecom:Encrypt> </soapenv:Body> </soapenv:Envelope>
However the code produced by SOAP::Lite normally looks like this:
<soap:Envelope xmlns:xsi="" x +mlns:soapenc="" xmlns:xsd="h +ttp://" soap:encodingStyle="http://schemas.x" xmlns:soap=" +p/envelope/"> <soap:Body> <Encrypt> <shopLogin xsi:type="xsd:string">username</shopLogin> <uicCode xsi:type="xsd:int">242</uicCode> <amount xsi:type="xsd:float">0.01</amount> <shopTransactionId xsi:type="xsd:int">562</shopTransacti +onId> </Encrypt> </soap:Body> </soap:Envelope>
So even the envelope tag is different. How can I make SOAP::Lite create a request with the required envelope?

Replies are listed 'Best First'.
Re: SOAP::Lite and custom envelopes
by Anonymous Monk on Mar 16, 2012 at 09:41 UTC
Re: SOAP::Lite and custom envelopes
by sundialsvc4 (Abbot) on Mar 16, 2012 at 19:38 UTC

    Agreed.   It is most likely that a recent version of SOAP::Lite will produce or can be quickly made to produce the desired output.   (It is a very mature package.)   But of course, your only alternative otherwise will be to, “When in Rome, do...”   It never hurts to ask the vendor what Perl package they use, because the chances are excellent that they are using Perl on their side.   I asked that question of Ingram and in a matter of fifteen minutes got an actual code example, sanitized straight from their receiving system that my code would be talking to.   Schweet!

      I agree with the observation, but that just not defeats the usage of a webservice? I mean, if I need to talk with the third party person the implementation details of their webservice, why use SOAP at all? Should the differences in the envelopes have any importance?

      I'm saying that because sometime ago I tried to make a SOAP::Lite SOAP service work with a .Net client and it was a real pain to do it.

      Alceu Rodrigues de Freitas Junior
      "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill

        Yes, it is a .Net webservice.

        They offer as well a SOAP client written in Java which can be used somehow with but we don't want to use Java in our production system.

        After unsuccessfully trying to install SOAP::Simple I used the lowlevel way: LWP::UserAgent for the request and pattern matching for the response parsing.

        Maybe not the classical way but in this case it was the fastest.

        Anyway, thanks for your help, everybody.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://959946]
Approved by ashokpj
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2023-09-22 08:05 GMT
Find Nodes?
    Voting Booth?

    No recent polls found