Skip to main content
February 18, 2009
Question

SOAP and MTOM

  • February 18, 2009
  • 18 replies
  • 3637 views
I'm in the final stages of consuming a web service thru SOAP using Cold Fusion 8. It's my first time using SOAP. I have everything set up to where it sends the request. I have verified the request against soapui and it matches. The request works fine with soapui. But when I call the cf page, all it brings back is the data definition wsdl (no matter what method I use).

I have used a sniffer to make sure that the request it is sending looks good (and it does). I have contacted the company that is supplying the web service and they say that I need to send it using MTOM. They said there side isn't understanding what I'm sending since it's not using MTOM. Is Cold Fusion compatable with MTOM? If so, how do I make my SOAP request use it?

Thanks
This topic has been closed for replies.

18 replies

BKBK
Community Expert
Community Expert
February 23, 2009
What I mean by invalid SOAP is that you should look for any reason why the message is rejected. For example, does it help to include XML processing instructions, like this?

<cfsavecontent variable="localscope.soapRequest"><?xml version="1.0" encoding="UTF-8" ?><soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:com=" http://com.WebServiceURL">
<soapenv:Header/>
<soapenv:Body>
<com:ManageProductLists catalog="spr">
<com:getProductList scope="application" listname="hisd"/>
</com:ManageProductLists>
</soapenv:Body>
</soapenv:Envelope></cfsavecontent>



P.S.: Leave no space between the cfsavecontent tag and the XML message. It's crucial.


BKBK
Community Expert
Community Expert
February 21, 2009
We could put our heads together and figure out something if we knew the relevant portion of the wsdl.

February 21, 2009
I used soapui to run the request and copied and pasted the request directly into that cfsavecontent, so i THINK it the request is valid. I even used the sniffer to double check what was being generated and sent by CF matched what was being sent by soapui. The main difference was the soapui has User-Agent: Jakarta Commons-HttpClient/3.1. I tried putting that in the http call: useragent="Jakarta Commons-HttpClient/3.1" but that didn't help either.

I will say, that this is my first time ever attempting to use SOAP requests. I use REST request to the same servers without issue, but this particular web service on their server only alows SOAP requests.

Take a look at the attached code, it's what the soapui is sending/recieving to/from the web service.
BKBK
Community Expert
Community Expert
February 21, 2009
I haven't worked with MTOM but, as far as I know, it is just a SOAP enhancement that is handy when the message includes a binary attachment. Your message above -- the one within the cfsavecontent -- has no attachment. In fact, I suspect the reason you're having problems is that the message isn't a valid SOAP request for the service.

February 20, 2009
I DID say compress and decompress...added it to my code with the same results. From everything I've been reading (and there's not a lot of info out there on it), it's not looking like it can be done :(.

Thanks though!
BKBK
Community Expert
Community Expert
February 20, 2009
Did you say compress and decompress? Then add the following to your request:

<cfhttpparam type="header" name="Accept-Encoding" value="*" />
<cfhttpparam type="header" name="TE" value="deflate;q=0" />


February 20, 2009
A little bit more information I found out is that the webservice is on a server running TomCat. From what I understand (my understanding COULD be wrong) is that MTOM compresses the SOAP request and then TomCat uses MTOM to decompress it.

But if you don't send it using MTOM, then the webservice doesn't understand it so it sends back the data definition wsdl.

I'm the first CF programmer to try and consume their webservice, so it's been very slow going/frustraiting.
February 20, 2009
I receive an HTTP Status 500 error. If i do everything you suggested, except leave the wsdl extension in, I receive the same data definition wsdl for all of their web services.
BKBK
Community Expert
Community Expert
February 20, 2009
What happens when you

1) replace the cfoutput tag with <?xml version="1.0" encoding="UTF-8"?>
2) remove the wsdl extension from the URL
and
3) change the line to
<cfhttpparam type="xml" value="#trim(localscope.soapRequest)#">