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

6185Re: [soaplite] WSDL and accessing complexType

Expand Messages
  • pat.mariani@att.net
    Aug 6 12:48 PM
    • 0 Attachment
      I'm using XML::XPath to access the element and attribute values -
      works out well -
      pat
       
      example
       
       $result = $soap ->readable(1)->outputxml(1) ->proxy('http://', timeout => 2)
              ->SOMEMETHOD($SOMEKEY, $profileId, 1, 1, $partnerId, $userId, $transactionId, "");
              return (1, $errors{3} . $result, '') unless ($result =~ /^<\?xml /);
       
              my $xml_obj = SOAP::Deserializer->deserialize($result);

              return  (1, $errors{3} . $xml_obj->faultstring, '') if ($xml_obj->fault);
       
              use XML::XPath;
              my $xp = XML::XPath->new(xml => $result);
              return (0, 'B', $name) if (
                      $name = $xp->find('//RETURNMETHOD/Listings/Listing[1]/Properties/Property[@Name="name"]/
      Value')
              );
       
      -------------- Original message from "qglex" <qglex@...>: --------------

      I have a method (get_fees) for the Web service returning the 'fees'
      XML and I'm able to do that by simply populating my_variable with the
      XML and returning SOAP::Data-> type( xml => $my_variable ).

      The response is:

      <?xml version="1.0" encoding="UTF- 8"?><soap: Envelope
      xmlns:xsi="http://www.w3. org/2001/ XMLSchema- instance"
      xmlns:soapenc= "http://schemas. xmlsoap.org/ soap/encoding/"
      xmlns:xsd="http://www.w3. org/2001/ XMLSchema"
      soap:encodingStyle= "http://schemas. xmlsoap.org/ soap/encoding/"
      xmlns:soap="http://schemas. xmlsoap.org/ soap/envelope/"><soap:Body> <get_feesRespons e
      xmlns="http://someserver. net/some/ path"><ErrorCode> 0</ErrorCode> <ErrorDetails> </ErrorDetails> <fees><fee
      abc="1" def="$1" ghi="$1" />
      <fee abc="2" def="$2" ghi="$2" />
      <fee abc="3" def="$3" ghi="$2" />
      <fee abc="4" def="$4" ghi="$4" />
      <fee abc="5" def="$5" ghi="$5"/>
      </fees></get_ feesResponse> </soap:Body> </soap:Envelope>

      That looks like an accurate response, or at least it
      has the correct data.

      1. How do I access the XML that is returned?

      my $service = SOAP::Lite
      -> service('someserver .net/some/ path');
      my $res = $service->get_ fees();
      use Data::Dumper;
      print Dumper( $res );
      $VAR1 = '0';

      #2 Maybe it's due to the WSDL being wrong. What would be the message
      and complexType elements in the WSDL to reflect the 'fees' element? I
      have other pieces working, I'm just not finding anything useful on
      multiple elements being returned.

      Thanks

    • Show all 2 messages in this topic