[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Example 18  and an Unparsed Character Response
   Hello Rick,
   You understood my question perfectly---Yes, the content between
   <DeliverContentResult> is just escaped XML. I was hoping to find a way
   to not have to write my own parsing tags, and to read it in as XML
   using one of the Expat parsing tools. Saving the data to the IFS then
   parsing it with http_parse_xml_stmf as Scott suggested should work
   great. I'm giving it a go now.
   Thanks for the response, Rick!
   Kim Gibson
   Date: Fri, 10 Dec 2010 17:38:18 -0500
   From: "Rick Connor" <rconnor@xxxxxxxxxxxxx>
   Subject: RE: Example 18  and an Unparsed Character Response
   To: "HTTPAPI and FTPAPI Projects" <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
   Message-ID:
   <8A568144317DDF45908DFF66BEF5BD6706406870@xxxxxxxxxxxxxxxxxxxxxxxx>
   Content-Type: text/plain;     charset="us-ascii"
   Kim
   Isn't the content of the <DeliverContentResult> tag just XML but with
   XML eacape characters?
   If you un-escape the contents you do get a string of valid XML which
   itself can then be parsed. See below. Or am I not understanding your
   question?
   - <DeliverContentResult>
   - <ReturnValues>
     <TransactionID>7106c824-6cbd-4dec-aacd-94745f3a5802</TransactionID>
     <ResponseCode>1</ResponseCode>
     <ResponseCodeText>Route completedsuccessfully</ResponseCodeText>
   - <ResponseMessage>
   - <TXLife xmlns="[1]http://ACORD.org/Standards/Life/2"
   xmlns:xsi="[2]http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="[3]http://ACORD.org/Standards/Life/2TXLife2.19.00.
   xsd">
   - <TXLifeRequest PrimaryObjectID="ID_1">
     <TransRefGUID>TES099912301-2010-12-0616:24:41</TransRefGUID>
     <TransType tc="1122">General Requirement Status/Results
   Transmittal</TransType>
     <TransExeDate>2010-12-10</TransExeDate>
     <TransExeTime>15:21:12</TransExeTime>
     <TransMode tc="2">Original</TransMode>
     <NoResponseOK tc="1" />
   - <OLifE>
   - <SourceInfo>
     <SourceInfoName>DataCentral</SourceInfoName>
     </SourceInfo>
   - <Party id="ID_1">
     <PartyTypeCode tc="1">Person</PartyTypeCode>
     <PartyKey>ID_1</PartyKey>
     <GovtID>123456789</GovtID>
   - <Person>
     <FirstName>KIMBERLEE</FirstName>
     <LastName>TESTINGTHIS</LastName>
     <BirthDate>1944-10-12</BirthDate>
     </Person>
   - <Address>
     <AddressTypeCode tc="1">Home</AddressTypeCode>
     <Zip>83605</Zip>
     </Address>
     <Carrier />
   - <Risk>
     <PrescriptionDataStatus tc="1">An order has already been sent, but
   our provider has not responded yet. Please consult with your system
   admin for service hours.</PrescriptionDataStatus>
     </Risk>
     </Party>
     </OLifE>
     </TXLifeRequest>
     </TXLife>
     </ResponseMessage>
     </ReturnValues>
     </DeliverContentResult>
   -----Original Message-----
   From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Kim Gibson
   Sent: Friday, December 10, 2010 4:50 PM
   To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
   Subject: Example 18 and an Unparsed Character Response
   Hello, everyone!
   I'm using Example 18 of HTTPAPI to consume a web service that returns
   prescription data on a client (we are an insurance company).
   The web service requires that the data is sent in a soap wrapper, and
   that the main request (variable strVar), is unparsed. Here is what my
   SOAP request looks like:
   SOAP =
    '<?xml version="1.0" encoding="UTF-8"?>'
   +'<soapenv:Envelope '
   +%trim('
   xmlns:soapenv="[4]http://schemas.xmlsoap.org/soap/envelope/"')
   +' xmlns:eos="[5]http://QuestWebServices/EOService">'
   +'<soapenv:Header />'
   +'<soapenv:Body>'
   +'  <eos:DeliverExamOneContent>'
   +'    <eos:username>username</eos:username>'
   +'    <eos:password>password</eos:password>'
   +'    <eos:destinationID>RX</eos:destinationID>'
   +'    <eos:payload><![CDATA['
   + %trim(strVar)
   +']]></eos:payload>'
   +'</eos:DeliverExamOneContent>'
   +'</soapenv:Body>'
   +'</soapenv:Envelope>';
   This is working very well, but it's the response (INCOMING) I need to
   ask your advice on.
   In the response, the data I want is in an unparsed piece between the
   tags <DeliverContentResult> and </DeliverContentResult>. I was hoping
   it would be returned as nicely formatted XML, but that's not the case.
   The response looks like this--
   <?xml version="1.0" encoding="utf-8"?><soap:Envelope
   xmlns:soap="[6]http://schemas.xmlsoap.org/soap/envelope/"
   xmlns:xsi="[7]http://www.w3.org/2001/XMLSchema-instance"
   xmlns:xsd="[8]http://www.w3.org/2001/XMLSchema"><soap:Body><DeliverCon
   tentR
   esponse xmlns="[9]http://somewebservice/service">
   <DeliverContentResult>
   <ReturnValues><TransactionID>7106c824-6cbd-4dec-aacd-94745
   f3
   a5802</TransactionID><ResponseCode>1</ResponseCode>&
   lt
   ;ResponseCodeText>Route completed
   successfully</ResponseCodeText><ResponseMessage><TXLife
   xmlns="[10]http://ACORD.org/Standards/Life/2"
   xmlns:xsi="[11]http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://ACORD.org/Standards/Life/2
   TXLife2.19.00.xsd"><TXLifeRequest
   PrimaryObjectID="ID_1"><TransRefGUID>TES099912301-2010-12-061
   6:
   24:41</TransRefGUID><TransType tc="1122">General
   Requirement Status/Results
   Transmittal</TransType><TransExeDate>2010-12-10</TransE
   xe
   Date><TransExeTime>15:21:12</TransExeTime><TransMode
   tc="2">Original</TransMode><NoResponseOK tc="1"
   /><OLifE><SourceInfo><SourceInfoName>DataCentral&
   lt
   ;/SourceInfoName></SourceInfo><Party
   id="ID_1"><PartyTypeCode
   tc="1">Person</PartyTypeCode><PartyKey>ID_1</PartyKe
   y&
   gt;<GovtID>123456789</GovtID><Person><FirstName&g
   t;
   KIMBERLEE</FirstName><LastName>TESTINGTHIS</LastName>
   ;&
   lt;BirthDate>1944-10-12</BirthDate></Person><Address
   &g
   t;<AddressTypeCode
   tc="1">Home</AddressTypeCode><Zip>83605</Zip><
   /A
   ddress><Carrier /><Risk><PrescriptionDataStatus
   tc="1">An order has already been sent, but our provider has not
   responded yet.  Please consult with your system admin for service
   hours.</PrescriptionDataStatus></Risk></Party></O
   Li
   fE></TXLifeRequest></TXLife></ResponseMessage><
   ;/
   ReturnValues>
   </DeliverContentResult></DeliverContentResponse></soap:Body></soap:Env
   el
   ope>
   Do you have any suggestions for parsing this unparsed data? There's
   probably some really cool API or something that I'm not aware of?
   Thanks so much for your feedback---I've gotten SO much use out of
   HTTPAPI, and since attending Scott's classes at COMMON last Spring in
   Orlando, my boss is now on board with HTTPAPI, too!
   Kim Gibson
   Kim Gibson  - Web Designer/Programmer Analyst
   United Heritage - PO Box 7777 - Meridian, ID 83680-7777 - Tel
   208.475.0942 - 800.657.6351 - Fax 208.475.1042 -
   [12]kgibson@xxxxxxxxxxxxxxxxxx
References
   1. http://ACORD.org/Standards/Life/2
   2. http://www.w3.org/2001/XMLSchema-instance
   3. http://ACORD.org/Standards/Life/2TXLife2.19.00.xsd
   4. http://schemas.xmlsoap.org/soap/envelope/
   5. http://QuestWebServices/EOService
   6. http://schemas.xmlsoap.org/soap/envelope/
   7. http://www.w3.org/2001/XMLSchema-instance
   8. http://www.w3.org/2001/XMLSchema
   9. http://somewebservice/service
  10. http://ACORD.org/Standards/Life/2
  11. http://www.w3.org/2001/XMLSchema-instance
  12. mailto:kgibson@xxxxxxxxxxxxxxxxxx
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------