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

How do I parse a Soap response - HASH?

Expand Messages
  • Daniel Dausch
    I read with interest Duncan Cameron s response to a previous posting but alas my SOAP response is a little different. Tried a number of different things to
    Message 1 of 1 , Oct 17, 2005
    • 0 Attachment
      I read with interest Duncan Cameron's response to a previous posting
      but alas my SOAP response is a little different. Tried a number of
      different things to extract the HASH structure but have had no
      success. In my case the Web Service returns a HASH structure that is
      not embedded in an array. (Please note that I wrote the java web
      service so if it makes sense to modify the java code then i am open
      to that.) Perl seems to recognize it as a hash so for example with
      this code:

      my $response = $soap1->deliverMsg($temp_elements);

      print "response = $response\n";

      my $resulthash = $response->result;
      print "result = $resulthash\n";

      I receive this output:

      Try MSGDeliveryService

      response = 1
      result = HASH(0x212e280)

      however I can not use hash functions on the result. I can not set the
      $response->result to a hash either. Here is the WS result: Any help
      would be appreciated. Thanks.

      TTP/1.1 200 OK
      Server: WebSphere Application Server/5.1
      Content-Type: text/xml; charset=utf-8
      Content-Language: en-US
      Transfer-Encoding: chunked

      2b5
      <?xml version="1.0" encoding="UTF-8"?>
      <soapenv:Envelope
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-
      instance"><soapenv:Body><deliverMsgResponse
      xmlns="urn:MsgDeliveryService"><deliverMsgReturn
      xmlns="http://msgdelivery.service.fmtc.com"><item xmlns=""><key
      xsi:type="xsd:string">RETURN_CD_DESC</key><value
      xsi:type="xsd:string">EXECUTION ERROR</value></item><item
      xmlns=""><key xsi:type="xsd:string">RETURN_CD</key><value
      xsi:type="xsd:int">1</value></item></deliverMsgReturn></deliverMsgResp
      onse></soapenv:Body></soapenv:Envelope>
      0
    Your message has been successfully submitted and would be delivered to recipients shortly.