Hi everyone,

I'm working with ColdFusion 9.0 trying to communicate with web services that 
our state has set up. I use cfhttp tag to submit SOAP request which looks like 
this:

<cfhttp method="POST" 
url="http://167.21.60.200/Delaware.ICIS.XmlFiling..Services/Service.svc"; 
useragent="gSOAP/2.8" result="httpResponse">
       <cfhttpparam type="header" name="content-type" value="text/xml">
       <cfhttpparam type="header" name="charset" value="utf-8">
       <cfhttpparam type="header" name="content-length" 
value="#len(signOnSoap)#">
       <cfhttpparam type="header" name="connection" value="close">
       <cfhttpparam type="header" name="accept-encoding" value="no-compression" 
/>
      <cfhttpparam type="header" name="SOAPAction" 
value="Delaware.ICIS.XmlFiling.Services/FilingService/FileCheckAgentAccountBalanceImmediate">
         <cfhttpparam type="xml"  value="#trim(ckBalRequest)#">
</cfhttp>

Where ckBalRequest is an xml variable created according to the web service 
provider specifications. I have no problem getting the request to them and 
receiving the response. However, while the response should be an XML variable 
as well, when I tried to use XMLParse(httpReponse.FileContent), CF gave me an 
error:  An error occured while Parsing an XML document. Content is not allowed 
in prolog.
So, tried cfdump to see the response I was getting. Then I got the following 
error: java.io.ByteArrayOutputStream.
While researching about this error, I came upon suggestion to use 
DeserializeJSON function for the response. Now I received this error which is 
something within the response:

JSON parsing failure at character 2:'-' in 
--uuid:e2f0c19a-df5f-4570-88f2-b641a09178ee+id=34 Content-ID: 
<http://tempuri.org/0> Content-Transfer-Encoding: 8bit Content-Type: 
application/xop+xml;charset=utf-8;type="text/xml" <s:Envelope 
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/";><s:Header><h:agentNumber 
xmlns:h="Delaware.ICIS.XmlFiling.Services">9020288</h:agentNumber><h:agentPONumber
 
xmlns:h="Delaware.ICIS.XmlFiling.Services">NoPOforThisTrans</h:agentPONumber><h:attentionLine
 xmlns:h="Delaware.ICIS.XmlFiling.Services">Attn: Dan's 
Listner</h:attentionLine><h:fileDateTime 
xmlns:h="Delaware.ICIS.XmlFiling.Services">20130509T11:25:50:9196</h:fileDateTime><h:packetNumber
 
xmlns:h="Delaware.ICIS.XmlFiling.Services">9020288_20130509T1125420351</h:packetNumber><h:receivedDateTime
 
xmlns:h="Delaware.ICIS.XmlFiling.Services">20130509T11:25:50:9196</h:receivedDateTime><h:successful
 
xmlns:h="Delaware.ICIS.XmlFiling.Services">true</h:successful></s:Header><s:Body><checkAgentAccountBalanceResponse
 xmlns="Delaware.ICIS..XmlFiling.Services"><accountBalanc...


Here the actual response that the state's  web service is sending me, but 
ColdFusion keeps having trouble seeing it as a structure:

--uuid:e2f0c19a-df5f-4570-88f2-b641a09178ee+id=34
Content-ID: <http://tempuri.org/0>
Content-Transfer-Encoding: 8bit
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/";>
<s:Header>
<h:agentNumber 
xmlns:h="Delaware.ICIS.XmlFiling.Services">9020288</h:agentNumber>
<h:agentPONumber 
xmlns:h="Delaware.ICIS.XmlFiling.Services">NoPOforThisTrans</h:agentPONumber>
<h:attentionLine xmlns:h="Delaware.ICIS.XmlFiling.Services">Attn: Dan's 
Listner</h:attentionLine>
<h:fileDateTime 
xmlns:h="Delaware.ICIS.XmlFiling.Services">20130509T11:25:50:9196</h:fileDateTime>
<h:packetNumber 
xmlns:h="Delaware.ICIS.XmlFiling.Services">9020288_20130107T1623410102</h:packetNumber>
<h:receivedDateTime 
xmlns:h="Delaware.ICIS.XmlFiling.Services">20130107T16:23:41:3116</h:receivedDateTime>
<h:successful xmlns:h="Delaware.ICIS.XmlFiling.Services">true</h:successful>
</s:Header>
<s:Body>
<checkAgentAccountBalanceResponse xmlns="Delaware.ICIS.XmlFiling.Services">
<accountBalance>797250.4162</accountBalance>
<fundsReserved>254873.2338</fundsReserved>
<availableBalance>542377.1824</availableBalance>
</checkAgentAccountBalanceResponse>
</s:Body>
</s:Envelope>
--uuid:e2f0c19a-df5f-4570-88f2-b641a09178ee+id=34


When I simply display the response by placing on the page 
<cfoutput>#httpResponse.FileContent#</cfoutput>, I get this:

--uuid:e2f0c19a-df5f-4570-88f2-b641a09178ee+id=34 Content-ID: 
Content-Transfer-Encoding: 8bit Content-Type: 
application/xop+xml;charset=utf-8;type="text/xml" 9020288NoPOforThisTransAttn: 
Dan's 
Listner20130509T11:25:50:91969020288_20130509T112542035120130509T11:25:50:9196true789222.1662261386.2338527835.9324
 --uuid:e2f0c19a-df5f-4570-88f2-b641a09178ee+id=34--


As you can see all of the headers are compressed then, and it's nearly 
impossible to extract the values. So I need to have the response in a structure 
that would give me access to the values (and so that I know what they are for 
me to use them correctly).

So far  DeserializeJSON was the only function that actually displayed headers  
in somewhat XML structure, but it has trouble with unique identifier (which is 
a unique identifier for the session) in the beginning of response. Simply 
trying to remove it from the response by using ColdFusion's Replace() isn't 
working at all. It's still there.

I'm at wit's end at this point and desperately need experts help as to how to 
see the structured response from the web service. The web service developers 
with the state aren't helping much saying that it's ColdFusion's downside, not 
theirs and saying that others (such as those working with PHP apps) are able to 
see the structural response as it's supposed to be.

Please, help! Any input is greatly appreciated!

Sasha.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355683
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to