[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HTTPAPI with CDATA



   Hello,
   The format of the XML you are sending is probably NOT related to the
   format of the XML you're getting back.  So telling us that you've
   encoded the XML you're sending to the server properly, does not (at
   least in my experience) have any impact on what you're getting back.
   It's a matter of keeping the "payload" of the SOAP message separate
   from the XML that makes up the SOAP message itself.
   Remember, a web service call is really calling a program/procedure over
   the web.  The XML documents are used to represent parameters passed
   either into or out of the routine you're calling.  In this example, the
   server is sending you an output document.... so it has output
   parameters.   Here's a simple example:
   <Envelope>
     <Body>
       <document>
         <parm1>any data can go here</parm1>
         <parm2>any data can go here</parm2>
       </document>
     </Body>
   </Envelope>

   Now suppose you decided to pass an XML document in "parm2".  After all,
   an XML document is just a character string -- so what if parm2 contains
   a whole XML document inside it.   That document would HAVE TO have it's
   tags converted to &lt; and &gt;, otherwise it'd interfere with the
   integrity of the Envelope/Body/document/parm2 tags themselves.
   It's important to understand that almost everyone calling a SOAP web
   service is using SOAP tooling.  They aren't coding the SOAP document by
   hand like you are doing here -- they actually call a 3rd party program
   that GENERATES the code.  So from their perspective, they have
   something like:
       parm1 = "data";
       parm2 = "whole XML document here";
       call WebService(parm1, parm2);
   And, under the covers, the 3rd party tool converts this to the SOAP
   message.  The data you got back in parm2 would already be removed from
   the SOAP message and un-escaped.  The caller would never even know that
   it was escaped during transit, because the 3rd party tool does all of
   that for them.
   But, HTTPAPI doesn't know anything about SOAP... it's not a SOAP tool,
   it's purely an HTTP transfer tool (unlike IWS or Thomas's WSDL2RPG).
   So HTTPAPI takes a string, and sends it over the network.  It's up to
   you to format it all correctly, and to handle the data that comes back
   correctly.  It doesn't know it's SOAP.
   As Mike said (and pointed you to examples) when HTTPAPI parses the XML
   that's sent back, it'll automatically convert the &lt; and &gt; stuff
   back to the < and > characters, so I don't even see why this is causing
   you a problem.. it's very simple to deal with.

   On 4/1/2013 9:57 AM, Kim Tay wrote:

   Hi,

   We used the HTTPAPI with CDATA to consume of of the Vendor Web Service,
   but the response is  returning result tag with &lt; and &gt; instead of
   < >, I asked the Vendor why and  ithey asked me what tool that I used?
   I old them simple XML via HTTPAPI from IBM i.  Did I miss out some
   functions/method? Appreciate if you can advise me.

   Thanks!

   Hereby is my send doc

   SENDDOC): entered
   <?xml version="1.0" encoding="utf-8"?><soap:Envelope
   xmlns:soap="[1][1]http://schemas.xmlsoap.org/soap/envelope/";
   xmlns:xsi="[2][2]http://www.w3.org/2001/XMLSchema-instance";
   xmlns:xsd="[3][3]http://www.w3.org/2001/XMLSchema";><soap:Body><Audit
   xmlns="[4][4]http://tempuri.org/McKessonAudit/Claim";><ClaimIn><![CDATA[<?x
   ml version="1.0" standalone="yes"?><MIM-UI>  <SYSTEM-DATA>
   <MIM-OPTIONS>      <DEFINITION-NAME>MIM</DEFINITION-NAME>
   <UNIT-EXP-PRE-OPT>2</UNIT-EXP-PRE-OPT>
   <UNIT-EXP-POST-OPT>1</UNIT-EXP-POST-OPT>
   <MOD-EXP-PRE-OPT>2</MOD-EXP-PRE-OPT>
   <MOD-EXP-POST-OPT>1</MOD-EXP-POST-OPT>
   <EXP-PAY-PCT-IND>Y</EXP-PAY-PCT-IND>    </MIM-OPTIONS>
   <PRODUCT-OPTIONS>      <PRODUCT-NAME>ClaimCheck</PRODUCT-NAME>
   <CALL-SEQUENCE>0</CALL-SEQUENCE>
   <CLAIMCHECK-ACCOUNT>GMISDEFAULT</CLAIMCHECK-ACCOUNT>
   <AGE-REPLACE-IND>Y</AGE-REPLACE-IND

   ...

   ...

   ...

   </MIM-UI>]]></ClaimIn></Audit></soap:Body></soap:Envelope>
   recvresp(): entered
   HTTP/1.1 200 OK
   Cache-Control: private, max-age=0
   Content-Type: text/xml; charset=utf-8
   Server: Microsoft-IIS/7.5
   X-AspNet-Version: 2.0.50727
   X-Powered-By: [5]ASP.NET
   Date: Sun, 31 Mar 2013 23:15:46 GMT
   Content-Length: 14099

   and here is the result;

   RECVDOC
   SetError() #13: HTTP/1.1 200 OK
   recvresp(): end with 200
   recvdoc parms: identity 14099
   header_load_cookies() entered
   recvdoc(): entered
   SetError() #0:
   <?xml version="1.0" encoding="utf-8"?><soap:Envelope
   xmlns:soap="[6][5]http://schemas.xmlsoap.org/soap/envelope/";
   xmlns:xsi="[7][6]http://www.w3.org/2001/XMLSchema-instance";
   xmlns:xsd="[8][7]http://www.w3.org/2001/XMLSchema";><soap:Body>
   <AuditResponse
   xmlns="[9][8]http://tempuri.org/McKessonAudit/Claim";><AuditResult>
   &lt;![CDATA[&lt;?xml version="1.0"
   standalone="yes"?&gt;&lt;MIM-UI&gt;&lt;CLAIM-GROUP&gt;&lt;CLAIM-DATA&gt
   ;&lt;CLAIM-ID&gt;000140&lt;/CLAIM-ID&gt;&lt;MEMBER-DOB&gt;19540103&lt;/
   MEMBER-DOB&gt;&lt;MEMBER-GENDER&gt;F&lt;/MEMBER-GENDER&gt;&lt;CLAIM-LAS
   T-LINE&gt;

   ...

   ...

   ..

   MSG-TEXT&gt;13152 CAN ONLY BE DONE  1 TIME(S) ON SINGLE DATE;
   DUPLICATE(S)
   DENIED&lt;/MSG-TEXT&gt;&lt;/MESSAGE-ENTRY&gt;&lt;/MESSAGE-GROUP&gt;&lt;
   /MIM-UI&gt;
   ]]&gt;</AuditResult></AuditResponse></soap:Body></soap:Envelope>
   http_close(): entered

References

   1. [9]http://schemas.xmlsoap.org/soap/envelope/
   2. [10]http://www.w3.org/2001/XMLSchema-instance
   3. [11]http://www.w3.org/2001/XMLSchema
   4. [12]http://tempuri.org/McKessonAudit/Claim
   5. [13]http://asp.net/
   6. [14]http://schemas.xmlsoap.org/soap/envelope/
   7. [15]http://www.w3.org/2001/XMLSchema-instance
   8. [16]http://www.w3.org/2001/XMLSchema
   9. [17]http://tempuri.org/McKessonAudit/Claim


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
[18]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

References

   1. http://schemas.xmlsoap.org/soap/envelope/
   2. http://www.w3.org/2001/XMLSchema-instance
   3. http://www.w3.org/2001/XMLSchema
   4. http://tempuri.org/McKessonAudit/Claim
   5. http://schemas.xmlsoap.org/soap/envelope/
   6. http://www.w3.org/2001/XMLSchema-instance
   7. http://www.w3.org/2001/XMLSchema
   8. http://tempuri.org/McKessonAudit/Claim
   9. http://schemas.xmlsoap.org/soap/envelope/
  10. http://www.w3.org/2001/XMLSchema-instance
  11. http://www.w3.org/2001/XMLSchema
  12. http://tempuri.org/McKessonAudit/Claim
  13. http://asp.net/
  14. http://schemas.xmlsoap.org/soap/envelope/
  15. http://www.w3.org/2001/XMLSchema-instance
  16. http://www.w3.org/2001/XMLSchema
  17. http://tempuri.org/McKessonAudit/Claim
  18. http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------