Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Dear Monks,
I am tasked to write a web services client using SOAP::Lite to access a server serving toll road passage information. It seems I cannot quite understand how to construct the complex types in perl. With SOAPUI I can successfully access on particular function of the service using a request as follows (username and password intentionally removed):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envel +ope/" xmlns:no="no.csautopass.ws"> <soapenv:Header/> <soapenv:Body> <no:GetAllPassagesRequest> <no:userName>XX</no:userName> <no:password>YY</no:password> <no:systemActorID>23</no:systemActorID> <no:fromDate>2016-06-05T09:00:00</no:fromDate> </no:GetAllPassagesRequest> </soapenv:Body> </soapenv:Envelope>
I have not succeeded in creating a perl equivalent, this is my latest unsuccesful attempt. What should a GetAllPassagesRequest look like?
use strict; use warnings; use SOAP::Lite; use Data::Dumper; use v5.10; my $user = 'XX'; my $pass = 'YY'; my $systemActorID = 23; my $fromDate = "2016-06-06T09:00:00"; my $uri = 'https://ws.csautopass.no/services/CSNWService'; my $wsdl = $uri . '?wsdl'; my $som; my $soap = SOAP::Lite ->uri($uri) ->proxy($wsdl); my $elem1 = SOAP::Data->name('userName' => $user)->prefix('no'); my $elem2 = SOAP::Data->name('password' => $pass)->prefix('no'); my $elem3 = SOAP::Data->name('systemActorID' => $systemActorID)->prefi +x('no'); my $elem4 = SOAP::Data->name('fromDate' => $fromDate)->prefix('no'); my $elems = SOAP::Data->name("GetAllPassagesRequest" => ($elem1, $elem +2, $elem3, $elem4))->prefix('no'); eval { $som = $soap->testConnection(); ($som->result) ? say "test ok ": say "failure"; $som = $soap->getAllPassages( $elems ); ($som->result) ? say "getAllPassages call ok ": say "getAllPassage +s call failure"; say("getAllPassages paramsout:" . Dumper($som->paramsout)); if($som->fault) { say $som->faultcode . ", ". $som->faultstring; +} }; if ($@) { die $@; } __END__ C:\test\perl\soap-lite>perl test-2.pl test ok getAllPassages call failure getAllPassages paramsout: soapenv:Server, com.ctc.wstx.exc.WstxParsingException: Undeclared name +space prefix "no" at [row,col {unknown-source}]: [1,441] C:\test\perl\soap-lite>
--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]

In reply to SOAP::Lite complex types by andreas1234567

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-03-19 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found