Copy link to clipboard
Copied
I've been struggling with an ASP.NET web service (they use a later standard than the AXIS installation in CFMX8), so I've been trying to post to the service using CFHTTP.
Here's a sample of the code I'm using:
<cfhttp url="http://URL/template.svc?wsdl" method="POST" resolveurl="NO" useragent="Axis/1.1">
<cfhttpparam type="header" name="Content-Type" value="text/xml; charset=utf-8" />
<cfhttpparam type="header" name="accept-encoding" value="no-compression" />
<cfhttpparam type="header" name="SOAPAction" value="method">
<cfhttpparam type="xml" name="body" value="#soapXML#">
</cfhttp>
The problem is that ASP.NET is returning this error:
Cannot process the message because the content type 'text/xml; charset=utf-8,text/xml; charset=UTF-8' was not the expected type 'text/xml; charset=utf-8'.
If I remove the Content-Type setting, I get:
Unable to determine MIME type of file.
And if I leave the Content-Type empty, I get:
Cannot process the message because the content type ',text/xml; charset=UTF-8' was not the expected type 'text/xml; charset=utf-8'.
So, the question is, how do I tell CFMX8 that I want to control the Content-Type header, and don't want it to send anything at all?
Or, how can I get it to decide that the Content-Type is what I'm sending if I make the header blank, but to send it without the comma?
This is highly frustrating.
On another note, the thread about the web service call is coming soon...
Copy link to clipboard
Copied
I struggled with an asp web service a while back too. I don't remember what all troubleshooting I did, but here is what I ended up with (i.e., using now):
<cfhttp url="https://whatever.com/webservice/blah.asmx?wsdl" method="post" result="local.WSResponse">
<cfhttpparam type="header" name="content-type" value="text/xml">
<cfhttpparam type="header" name="SOAPAction" value="https://whatever.com/webservice/methodName">
<cfhttpparam type="header" name="content-length" value="#len(trim(myXML))#">
<cfhttpparam type="header" name="charset" value="utf-8">
<cfhttpparam type="xml" name="message" value="#trim(myXML)#">
</cfhttp>
Hope that helps.
Copy link to clipboard
Copied
Thanks for the input, but I'm getting a variation on the message, it's now:
Cannot process the message because the content type 'text/xml,text/xml; charset=UTF-8' was not the expected type 'text/xml; charset=utf-8'.
Notice that it's adding "text/xml" before the comma in front of what I actually want to send.
Maybe it's ASP.NET 3.5 being pickier than ASP.NET 2.0 in the calls...