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

Expand Messages
  • wwwslashdotcom
    Hi all, I m very new to SOAPLite (and very rusty with Perl), but have an assignment that needs to test Perl as a client to a web services project that I have.
    Message 1 of 1 , Jul 14, 2003
      Hi all,
      I'm very new to SOAPLite (and very rusty with Perl), but have an
      assignment that needs to test Perl as a client to a web services
      project that I have. I have gotten SOAPLite to send the following
      message to the server:

      POST /axis/services/ HTTP/1.1 TE: deflate,gzip;q=0.3 Connection: TE,
      close Accept: text/xml
      Accept: multipart/*
      Host: localhost
      User-Agent: SOAP::Lite/Perl/0.55
      Content-Length: 1103
      Content-Type: text/xml; charset=utf-8
      SOAPAction: "myService#getPersonData"

      <?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>
      <namesp1:getPersonData xmlns:namesp1="myService">
      <SOAP-ENC:Array xsi:type="SOAP-ENC:Array" SOAP-
      ENC:arrayType="xsd:string[3]">
      <item xsi:type="xsd:string">First Name</item>
      <item xsi:type="xsd:string">Middle Name</item>
      <item xsi:type="xsd:string">Last Name</item>
      </SOAP-ENC:Array>
      <SOAP-ENC:Array xsi:type="SOAP-ENC:Array" SOAP-
      ENC:arrayType="xsd:string[1]">
      <item xsi:type="xsd:string"/>
      </SOAP-ENC:Array>
      <SOAP-ENC:Array xsi:type="SOAP-ENC:Array" SOAP-
      ENC:arrayType="xsd:string[1]">
      <item xsi:type="xsd:string">myApplication</item>
      </SOAP-ENC:Array>
      </namesp1:getPersonData>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      Note the element <SOAP-ENC:Array xsi:type=...>

      It seems that the name SOAP-ENC:Array is causing
      java.lang.ArrayStoreException on the server side (an Axis
      implementation there)...so I changed the message MANUALLY (inside TCP
      Monitor, which lets you change the raw message and test-send again)
      to:

      POST /axis/services/ HTTP/1.1 TE: deflate,gzip;q=0.3 Connection: TE,
      close Accept: text/xml Accept: multipart/* Host: localhost User-
      Agent: SOAP::Lite/Perl/0.55 Content-Length: 1291
      Content-Type: text/xml; charset=utf-8
      SOAPAction: "myService#getPersonData" <?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>
      <namesp1:getPersonData xmlns:namesp1="myService">
      <arg0 xsi:type="SOAP-ENC:Array" SOAP-
      ENC:arrayType="xsd:string[3]">
      <item xsi:type="xsd:string">First Name</item>
      <item xsi:type="xsd:string">Middle Name</item>
      <item xsi:type="xsd:string">Last Name</item>
      </arg0>
      <arg1 xsi:type="SOAP-ENC:Array" SOAP-
      ENC:arrayType="xsd:string[1]">
      <item xsi:type="xsd:string"/>
      </arg1>
      <arg2 xsi:type="SOAP-ENC:Array" SOAP-
      ENC:arrayType="xsd:string[1]">
      <item xsi:type="xsd:string">myApplication</item>
      </arg2>
      </namesp1:getPersonData>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      So instead of <SOAP-ENC:Array... we have <arg0...> and so on. And
      this worked...however, how do I make SOAPLite to generate arg0, etc.
      for that _specific_ sub-element instead of SOAP-ENC:Array? (I mean,
      within the Perl script...?)

      I have tried the following code:

      #!perl -w
      use SOAP::Lite;

      @attributes= ("First Name", "Middle Name", "Last Name");
      @restrictions= ("");
      @app_name= ("myApplication");

      print SOAP::Lite
      -> uri('myService')
      -> proxy('http://localhost:8082/axis/services/')
      -> getPersonData(\@attributes, \@restrictions, \@app_name)
      -> result;

      But it doesn't work, as this applies to the innermost "item" element
      instead of the "SOAP-ENC:Array" element that needs to be changed
      (to "arg0", "arg1", etc.).

      I also tried:

      #!perl -w
      use SOAP::Lite;

      @attributes= ("First Name", "Middle Name", "Last Name", "SSO Login
      ID", "Component Number", "Effective Start Date");
      SOAP::Data->name('arg0' => \@attributes);
      @restrictions= ("");
      @app_name= ("myApplication");

      print SOAP::Lite
      -> uri('myService')
      -> proxy('http://localhost:8082/axis/services/')
      -> getPersonData(\@attributes, \@restrictions, \@app_name)
      -> result;

      Which doesn't work either...the statement SOAP::Data->name('arg0' =>
      \@attributes); seems to be ignored. I am running out of ideas...it
      seems I need to override the SOAP::Serializer module, which I have no
      clue how to do (don't understand OO in Perl at all yet).

      Thanks!
    Your message has been successfully submitted and would be delivered to recipients shortly.