Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

SOAP call tweaks required

by Mike_v (Novice)
on Dec 07, 2010 at 12:27 UTC ( #875779=perlquestion: print w/replies, xml ) Need Help??

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

The following script segment
--------------------------------------------------------------------------
use SOAP::Lite +trace => [qw(method fault headers result debug)]; $uri = "http://webservice.proc.req.lbg.com/"; $proxy = "http://10.161.3.159/LBGRequestProcessorWEB/LBGOIMRequestPr +ocessorService"; @params = (SOAP::Data->name("arg0" => \SOAP::Data->value (SOAP::Data->name(actionType => ""), SOAP::Data->name(additionalOperationType =>""), SOAP::Data->name(originatingSystem => ""), SOAP::Data->name(recipientId => ""), SOAP::Data->name(requestId => ""), SOAP::Data->name(requestType => ""), SOAP::Data->name(resourceType => "") ), ), ); $method = SOAP::Data->name('processRequest') ->attr({xmlns => $uri}) ; $soap = SOAP::Lite -> uri($uri) -> on_action( sub { '' } ) -> proxy($proxy) ; $result = $soap->call($method => @params);
--------------------------------------------------------------------------

gives me this output

------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<processRequest xmlns="http://webservice.proc.req.lbg.com/">
<arg0>
<actionType xsi:type="xsd:string"/>
<additionalOperationType xsi:type="xsd:string"/>
<originatingSystem xsi:type="xsd:string"/>
<recipientId xsi:type="xsd:string"/>
<requestId xsi:type="xsd:string"/>
<requestType xsi:type="xsd:string"/>
<resourceType xsi:type="xsd:string"/>
</arg0>
</processRequest>
</SOAP-ENV:Body></SOAP-ENV:Envelope>



After playing about in SoapUI with this I've worked out that I need the output to be as below, specifically, the extra xmlns:web line and the subsequent web: prefix of the <processRequest> tags all in bold

Any help much appreciated

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:web="http://webservice.proc.req.lbg.com/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<web:processRequest>
<arg0>
<actionType xsi:type="xsd:string"/>
<additionalOperationType xsi:type="xsd:string"/>
<originatingSystem xsi:type="xsd:string"/>
<recipientId xsi:type="xsd:string"/>
<requestId xsi:type="xsd:string"/>
<requestType xsi:type="xsd:string"/>
<resourceType xsi:type="xsd:string"/>
</arg0>
</web:processRequest>
</SOAP-ENV:Body></SOAP-ENV:Envelope>

Replies are listed 'Best First'.
Re: SOAP call tweaks required
by Corion (Patriarch) on Dec 07, 2010 at 12:35 UTC

    I don't know much about SOAP, but the ->default_ns, ->ns and ->use_prefix methods of SOAP::Lite seem promising, at least if you do not need the explicit web: prefix but can do with any prefix.

      I'm not to up on it either, any idea how I would incorporate that into my code?

        I would call the methods with the appropriate parameter, as documented.

Re: SOAP call tweaks required
by ruoso (Curate) on Dec 08, 2010 at 13:37 UTC

    I've been saying this over and over, so here it goes again.

    SOAP::Lite should only be seen as an archeological module. It doesn't implement any of SOAP current uses. SOAP-Encoding should be considered deprecated (it's even removed from newer SOAP spec). XML::Compile::SOAP implements correct SOAP semantics. You can use SOAP::Simple to reduce the code overhead.

    daniel
      I've been saying this over and over, so here it goes again.

      Maybe you should post links and code examples? The OPs code is only 25 lines :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://875779]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2023-06-04 10:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (20 votes). Check out past polls.

    Notices?