Loading ...
Sorry, an error occurred while loading the content.

SOAP::Lite Client and NuSOAP server with ArrayType data

Expand Messages
  • graham23sk
    HI Trying to interop with a NuSOAP server passing in an arraytype which is supposed to return an arraytype and despite constructing the soap request
    Message 1 of 1 , Apr 7 12:15 PM
    • 0 Attachment
      HI

      Trying to interop with a NuSOAP server passing in an arraytype which
      is supposed to return an arraytype and despite constructing the soap
      request identically to the native test client I cant get it to work.

      HERE IS what the test client Soap request looks like (and it works) :

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <SOAP-ENV:Envelope
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:si="http://soapinterop.org/xsd">
      <SOAP-ENV:Body>
      <ns1:wsGetVehicleArrayPresences xmlns:ns1="http://testuri.org">
      <wsGetVehicleArrayPresences>
      <SessionID
      xsi:type="xsd:string">u3r1la4v7rolc9sp916qqie8c7</SessionID>
      <IDArray xsi:type="SOAP-ENC:Array"
      SOAP-ENC:arrayType="xsd:string[3]">
      <item xsi:type="xsd:string">350389830897834</item>
      <item xsi:type="xsd:string">350389830899293</item>
      <item xsi:type="xsd:string">350389831181014</item>
      </IDArray>
      </wsGetVehicleArrayPresences>
      </ns1:wsGetVehicleArrayPresences>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      This returns the Data Array Response i expect

      And here is my SOAP::Lite Request

      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      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:namesp1="http://namespaces.soaplite.com/perl">
      <SOAP-ENV:Body>
      <ns1:wsGetVehicleArrayPresences xmlns:ns1="http://testuri.org">
      <wsGetVehicleArrayPresences>
      <SessionID
      xsi:type="xsd:string">our77o211724nsd7lb5381kkg5</SessionID>
      <IDArray SOAP-ENC:arrayType="xsd:string[3]"
      xsi:type="SOAP-ENC:Array"/>
      <item xsi:type="xsd:string">350389830897834</item>
      <item xsi:type="xsd:string">350389830899293</item>
      <item xsi:type="xsd:string">350389831181014</item>
      </wsGetVehicleArrayPresences>
      </ns1:wsGetVehicleArrayPresences>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      This returns a Session Not set error .

      I am able to make requests and get responses from the other methods in
      this server (including the request to open the SessionID i pass in
      above. Can anyone see anything obvious here .. or do we think its a
      NuSOAP problem ?

      For information Here is the code snippet that constructs above
      soaplite request.

      ==CODE
      #!/usr/bin/perl -w
      #use strict;
      use SOAP::Lite +trace => all;

      my $soap =
      SOAP::Lite->proxy("http://localhost/er_gamma/webservices/index.php");

      $soap->on_action(sub {sprintf '"%s/%s"', @_});

      my $loginRequest = SOAP::Data
      ->name("loginRequest" => \SOAP::Data->value(
      SOAP::Data->name("Username" => 'username'),
      SOAP::Data->name("Password" => 'password')
      ))->type("paramLogin");

      my $loginresult = $soap->login($loginRequest);

      my $session = $loginresult->valueof('//loginResponse/session_id');

      #my $session ="v7v4glbrhp9vblf7jcb801ige4";

      my @array = (350389830897834,350389830899293,350389831181014);

      my $records = @array;

      my $method = SOAP::Data->name('wsGetVehicleArrayPresences')
      ->attr({'xmlns:ns1' => 'http://testuri.org'})
      ->prefix('ns1');


      my $request = SOAP::Data
      ->name("wsGetVehicleArrayPresences" => \SOAP::Data->value(
      SOAP::Data->name("SessionID" => $session),

      SOAP::Data->name("IDArray")->attr({"xsi:type"=> "SOAP-ENC:Array",

      "SOAP-ENC:arrayType" => "xsd:string[$records]"})
      =>
      SOAP::Data->name("item" =>(SOAP::Data->value(@array)->type("string")))
      ));


      my $result = $soap->call($method => $request);
      my $return = $result->valueof('//wsGetVehiclePresenceResponse/return');
    Your message has been successfully submitted and would be delivered to recipients shortly.