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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.