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

RE: [soaplite] Soap::Lite to .net web service , complex type

Expand Messages
  • gary_grubb@agilent.com
    Marcello, take a look at this note I received from a fellow SOAP::LIte user: It not only deals with passing arrays of strings, but also how to deal with
    Message 1 of 2 , Oct 21, 2004
    • 0 Attachment



      take a look at this note I received from a fellow SOAP::LIte user: It not only deals with passing arrays of strings, but also how to deal with SOAP::Lite implicit conversion of a string that is in the form of "123" into an array of ints.


      I've attached perl example to pass an array and force the type to a

      string. The soap send string is pasted below:

      ( I also answered your message on the SOAP::Lite user's group.)

      <?xml version="1.0" encoding="UTF-8"?>








      <namesp1:soapTest xmlns:namesp1="SoapTest">

      <arrayTest xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[3]">

      <item xsi:type="xsd:string">1</item>

      <item xsi:type="xsd:string">2</item>

      <item xsi:type="xsd:string">3</item>





      The magic is the line:

      ->value( [ map { SOAP::Data->value( $_ )->type( 'string' ) } @buffer ] );

      This line takes each element of @buffer, and transforms it into a

      SOAP::Data object with a type of string. then passes the reference to

      the new array to the SOAP::Data constuctor to creat the parent object.


      -----Original Message-----
      From: marcello_tiso [mailto:marcello_tiso@...]
      Sent: Thursday, October 21, 2004 1:22 PM
      To: soaplite@yahoogroups.com
      Subject: [soaplite] Soap::Lite to .net web service , complex type

      I looked through the archive and tried some of the suggestions but
      none seem to work (or perhaps I havent implemented it correctly).

      I am trying to send a method a string and then an array of strings.

      The SOAP request looks like this:
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          <q1:getGenericValues xsi:type="q1:getGenericValues"
            <message xsi:type="xsd:string">string</message>
            <parameters href="#id1" />
          <soapenc:Array id="id1" soapenc:arrayType="xsd:string[2]">

      my Client code looks like the following (relevant piece) :

      sub getGenericValues {
        my ($message,@values) = @_;
        my $soap = SOAP::Lite
                       -> uri($ns)
                  -> on_action( sub {return  "$ns".$_[1] ;})
                  -> proxy
        my $method = SOAP::Data->name('getGenericValues')->attr({xmlns
      => "http://www.tempuri.org"});
      my $method = SOAP::Data->name('getGenericValues')->attr({xmlns
      => "http://www.tempuri.org"});

      @foo = ('1parm','2parm');

      SOAP::Data->name('parameters' =>\SOAP::Data->value(SOAP::Data->name
      ("Item" => @foo)->type('xsd:string'))->attr({'SOAP-ENC:arrayType'

      The error I get from the server is : Object reference not set to an
      instance of an object, which I believe is in ref to href=#id1.

      Any Suggestions on how to send a .NET webservice arrays is

      Thanks in advance.


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