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
March 6, 2009
FYI...I tried the code from you last post...same results

So did I, same results. I would ask that James for a sample of the kind of request his service expects.

March 5, 2009
FYI...I tried the code from you last post...same results
March 5, 2009
From their wiki:

What is MTOM?
From Etilizewiki
Jump to: navigation, search
MTOM is the W3C Message Transmission Optimization Mechanism, a method of efficiently sending binary data to and from web services. It uses XOP (XML-binary Optimized Packaging) to transmit binary data and is intended to replace both MIME and DIME attachments. Binary content often has to be reencoded to be sent as text data with SOAP messages. MTOM allows more efficient sending of binary data in a SOAP request or response.


Sample Raw Request:
<soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:com=" http://com.etilize.spexlive">
<soapenv:Header/>
<soapenv:Body>
<com:ManageProductLists catalog="?" siteId="0">
<!--You have a CHOICE of the next 5 items at this level-->
<!--0 to 25 repetitions:-->
<com:task id="?">
<!--You have a CHOICE of the next 6 items at this level-->
<!--Optional:-->
<com:insertToProductListByProductID listName="?" productId="?" ordinal="?"/>
<!--Optional:-->
<com:insertToProductListBySKU listName="?" type="?" number="?" ordinal="?"/>
<!--Optional:-->
<com:deleteFromProductListByProductID listName="?" productId="?"/>
<!--Optional:-->
<com:deleteFromProductListBySKU listName="?" type="?" number="?"/>
<!--Optional:-->
<com:deleteProductList listName="?"/>
<!--Optional:-->
<com:defineProductList listName="?">
<!--Optional:-->
<com:keywordFilter>?</com:keywordFilter>
<!--Zero or more repetitions:-->
<com:categoryFilter id="?" type="default"/>
<!--Zero or more repetitions:-->
<com:manufacturerFilter id="?"/>
<!--Zero or more repetitions:-->
<com:attributeFilter attributeId="?" valueId="?" operator="EQ"/>
<!--Optional:-->
<com:context>
<!--Zero or more repetitions:-->
<com:mapping key="?" value="?"/>
</com:context>
</com:defineProductList>
</com:task>
<!--Optional:-->
<com:getProductList scope="application" listname="?"/>
<!--Optional:-->
<com:getProductListDirectory scope="application"/>
<!--Optional:-->
<com:uploadProductListFile listName="?">
<com:file>cid:1138977549033</com:file>
</com:uploadProductListFile>
<!--Optional:-->
<com:downloadProductListFile listName="?"/>
</com:ManageProductLists>
</soapenv:Body>
</soapenv:Envelope>

And then this is a sample of a request I sent thru soapui which automatically enables the mtom:

POST /service/soap/catalog?appId=223170 HTTP/1.1
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
User-Agent: Jakarta Commons-HttpClient/3.1
Host: ws.spexlive.net
Content-Length: 338

<soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:com=" http://WebServiceName">
<soapenv:Header/>
<soapenv:Body>
<com:ManageProductLists catalog="spr">
<com:getProductList scope="application" listname="hisd"/>
</com:ManageProductLists>
</soapenv:Body>
</soapenv:Envelope>
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: multipart/related; type="application/xop+xml"; start="<soap.xml@xfire.codehaus.org>"; start-info="text/xml"; boundary="----=_Part_39944_20960317.1235233442949"
Transfer-Encoding: chunked
Date: Sat, 21 Feb 2009 16:24:02 GMT

28d
BKBK
Community Expert
Community Expert
March 1, 2009
I read from this that your request should be a modified SOAP envelope, containing XOP and MTOM elements and attributes. You might also have to post the message as content-type Application/xop, as James suggests:

<cfhttpparam type="header" name="content-type" value="application/xop+xml">
<cfhttpparam type="header" name="SOAPAction" value="">
<cfhttpparam type="header" name="content-length" value="#len(soapRequest)#">
<cfhttpparam type="header" name="charset" value="utf-8">
<cfhttpparam type="header" name="Accept-Encoding" value="*" />
<cfhttpparam type="header" name="TE" value="deflate;q=0" />
<cfhttpparam type="xml" name="message" value="#trim(soapRequest)#">

Ask him for a sample of the MTOM/XOP SOAP request he talked about.



February 25, 2009
Here's my IM conversation with them:

[11:41] Scotty Boy: the process for sending the prod list thru soapui u showed me yesterday got me thinking...
[11:41] Scotty Boy: you had me change the request properties to endable mtom...
[11:42] Scotty Boy: but, when i do a getProductList with soapui, mtom is set to false and it works fine
[11:42] Scotty Boy: and that is the request that i'm using in cf...so doesn't that mean mtom doesn't need to be enabled?
[12:29] James: SoapUI might automatically enable mtom for responses
[13:06] Scotty Boy: but i see what your response is just fine with CF...it's just your response is not what i request
[13:06] Scotty Boy: it's that u don't understand my request
[13:06] Scotty Boy: because u send me the whole data def wsdl
[13:08] James: I think SOAPui will automatically turn it on
[13:08] Scotty Boy: so then if i try and upload a new list and don't enable it...it should work?
[13:08] Scotty Boy: thru soapui
[13:11] James: two different things
[13:12] James: 1) the xml structure in the new service is now application/xop
[13:12] James: 2) attachments must be transmited via mtom
February 25, 2009
I have already sent him a copy of the request I used and the response. That's when he said that I needed to enable mtom (which caused me to start this thread).

He showed me how I could upload a list thru SOAPUI to accomplish what I'm trying to do with CF as a stop gap while I/we are trying to ge the CF side of things working. Part of that process with SOAPUI is to enable motom in the request properties. If I don't do that, the the uploading of the product list fails.

That being said, when I do just a getProductList (supposed to display everything that I have uploaded/added to the product list) with soapui, I don't have mtom enabled and it works fine. That tells me that it's not an mtom issue. I have that question in to the provider. I'll post his answer when I receive it.
BKBK
Community Expert
Community Expert
February 25, 2009
Sure...not sure what you want.

To have a go myself. I have.

Are you looking for something besides that?

Yes, things like response types and the allocation of namespace. Also, to get SOAPUI to generate a sample request for ManageProductLists.

But I was none the wiser. I, too, failed to get a reasonable response from the service. It was either nothing or the wsdl, as you yourself got earlier.

Ask the provider about this, sending him a copy of the SOAP request you used.


February 24, 2009
Sure...not sure what you want. Here is a link to the page that does the call to the web service: http://smarketingtx.com/administration/hisdsubcat.cfm

Are you looking for something besides that? The webservices is restricted by IP Address.

BKBK
Community Expert
Community Expert
February 24, 2009
Could I have a go at the wsdl?

February 23, 2009
Tried that before and again just now (with your other suggestions in place) with the same results. I made sure there was no space between the cfsavecontent and xml message.

The thing is, is it doesn't come back with a rejection or error message, it comes back with the entire wsdl for all of the web service.