I have been working with some webservices lately (Endicia) where I am
fortunate to have the ability to pass my requests either as formfield values
or via their SOAP architecture. I am having issues using both interfaces via
CFHTTP on the latest Open Bluedragon build. The simplest solution for me is
to form my XML request and post it to their servers as a formfield value,
however I keep getting random error messages from their servers saying my
XML data is malformed. I sent my XML data to their support staff and they
said it worked without issue so that made a me think a bit. I tested my XML
code from a ACF8 server and it worked without issue. Here is my simple
request:

<cfxml casesensitive="false" variable="xmlPostageLabelRequest">
<LabelRequest Test="YES" LabelType="Default" LabelSubType="None"
LabelSize="4x6" ImageFormat="PDF" ImageResolution="300"
ImageRotation="None"><RequesterID>abcd</RequesterID><AccountID>123456</AccountID><PassPhrase>myPassphraseHere</PassPhrase></LabelRequest>
</cfxml>

<cfhttp url="
https://labelserver.endicia.com/LabelService/EwsLabelService.asmx/GetPostageLabelXML";
method="POST" result="xmlEndiciaLabel">
    <cfhttpparam type="header" name="Content-Type"
value="application/x-www-form-urlencoded">
    <cfhttpparam type="header" name="Content-Length"
value="#len(trim(xmlPostageLabelRequest))#">
    <cfhttpparam type="formfield" name="labelRequestXML"
value="#trim(xmlPostageLabelRequest)#" />
</cfhttp>

To did some further testing I created my XML both using the CFXML tag as
well as a generic string via a CFSET, both created the same error. To take
my testing further I created a page on my own public OBD server (using
HTTPS) where I could see what it was I was posting from my test machine
(again running the latest OBD build) and from ACF8. On that machine I simply
used "<cfoutput>#getHttpRequestData().content#</cfoutput>" so that when I
dumped my CFHTTP return data I could see what was being sent. Here are the
two different results:

OBD (latest nightly):
labelRequestXML=%3C%3Fxml%20version%3D%221%2E0%22%20encoding%3D%22UTF%2D8%22%3F%3E%0A%3CLabelRequest%20ImageFormat%3D%22PDF%22%20ImageResolution%3D%22300%22%20ImageRotation%3D%22None%22%20LabelSize%3D%224x6%22%20LabelSubType%3D%22None%22%20LabelType%3D%22Default%22%20Test%3D%22YES%22%3E%3CRequest

ACF8:
labelRequestXML=%3C%3Fxml%20version%3D%221%2E0%22%20encoding%3D%22UTF%2D8%22%3F%3E%0A%3CLabelRequest%20ImageFormat%3D%22PDF%22%20ImageResolution%3D%22300%22%20ImageRotation%3D%22None%22%20LabelSize%3D%224x6%22%20LabelSubType%3D%22None%22%20LabelType%3D%22Default%22%20Test%3D%22YES%22%3E%3CRequesterID%3Eabcd%3C%2FRequesterID%3E%3CAccountID%3E123456%3C%2FAccountID%3E%3CPassPhrase%3EmyPassphraseHere%3C%2FPassPhrase%3E%3C%2FLabelRequest%3E


It appears the formfield value is being truncated by OBD when it is being
sent. The strange thing is if I send the the complete XML packet then it
appears to be truncated at a later point in the document and not at the same
point as shown in the above example. Has anyone else run into anything like
this before?

Any comments and/or suggestions would be greatly appreciated.

Thanks!
-Jeff Lucido

-- 
official tag/function reference: http://openbd.org/manual/
 mailing list - http://groups.google.com/group/openbd?hl=en

Reply via email to