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

SOAP::Lite problem

by doqb (Initiate)
on Oct 19, 2015 at 04:55 UTC ( [id://1145282]=perlquestion: print w/replies, xml ) Need Help??

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

Hello Monks... I need your help with this issue, I use SOAP::Lite trying to query a Webservice, here is the code:

$soap = SOAP::Lite-> service('http://10.230.0.22:7782/services/CBSInte +rfaceAccountMgrService?wsdl'); @data = SOAP::Data->name("RequestHeader" => \SOAP::Data->value( SOAP::Data->name("CommandId" => 'Payment'), SOAP::Data->name("Version" => '1'), SOAP::Data->name("TransactionId" => ''), SOAP::Data->name("SequenceId" => '1'), SOAP::Data->name("RequestType" => 'Event'), SOAP::Data->name("SerialNo" => 'USSD_00000001'), ) ); push (@data, SOAP::Data->name("PaymentRequest" => \SOAP::Data->value( SOAP::Data->name("SubscriberNo" => '123'), SOAP::Data->name("PaymentAmt" => 100), SOAP::Data->name("PaymentMode" => 1001), ) )); my $result = $soap->Payment(@data);
From the code above I am expecting that the XML layer of the http request would have the structure of @data as per my wsdl definition, but the output only show the following:
<soap:Body> <account:Payment> <RequestHeader xsi:nil="true" xsi:type="common:RequestHeader" /> <PaymentRequest xsi:nil="true" xsi:type="account:PaymentRequest" /> </account:Payment> </soap:Body> </soap:Envelope>
Please help.

Replies are listed 'Best First'.
Re: SOAP::Lite problem
by nikosv (Deacon) on Oct 19, 2015 at 06:33 UTC
    use  +trace => [ transport => sub { print $_[0]->as_string } ]; to check that you request is correct
      Its better to use  use SOAP::Lite  +trace => 'debug'; the xml is formatted pretty
        Ha its actually  use SOAP::Lite  +trace => 'debug', readable => 1;
Re: SOAP::Lite problem
by Anonymous Monk on Oct 19, 2015 at 07:43 UTC

    From the code above I am expecting that the XML layer of the http request would have the structure of @data as per my wsdl definition, but the output only show the following:

    What would that look like? We can't guess what you want

    wsdl

    SOAP::Lite isn't great at WSDL, XML::Compile::SOAP is better at it

      Thanks for your comments, if you see the code above, there is a @data array, that is the structure that it needs to be sent on the XML request, but as I showed the request does not contain those values for some reason. I tried to use XML::compile per your advise but I am getting stuck at the wsdl definition:
      use XML::Compile::WSDL11 (); my $wsdl = XML::Compile::WSDL11->new("http://10.230.0.22:7782/servi +ces/CBSInterfaceAccountMgrService?wsdl");
      When I execute the above I get the following error:
      error: file http://10.230.0.22:7782/services/CBSInterfaceAccountMgrSer +vice?wsdl does not exist
      Seems like the above declaration is expecting a local file? is there a way to define it as URL? -Thanks

        Thanks for your comments, if you see the code above, there is a @data array, that is the structure that it needs to be sent on the XML request, but as I showed the request does not contain those values for some reason.

        if the code you posted doesn't produce the xml you want, how will I guess what xml you want?

        I can't look at the code, it doesn't do what you want

        What can I look at to know what you want?

        You have to post the xml you want

        I tried to use XML::compile per your advise but I am getting stuck at the wsdl definition: Seems like the above declaration is expecting a local file? is there a way to define it as URL? -Thanks

        Give it a file :) it wants a file, give it a file -- the WSDL isn't supposed to change frequently, so getting a file from local disk is better

        But here is a hint from the docs

        So, on purpose you must explicitly load the files you need from local disk! (of course, it is simple to find one-liners as work-arounds, but I will not tell you how! See XML::Compile::SOAP::FAQ)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-24 21:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found