Forum Discussion

milosjaran's avatar
milosjaran
New Contributor
13 years ago

SOAPUI and WCF - MTOM, WS-RM and Soap 1.2

Hello there,

I am having problems getting SOAPUI to work properly with WCF using SOAP 1.2 message with mtom and ws-rm. Remove MTOM and everything works fine (Part form WS_RM terminate sequence, but that is anotherr entry I will make soon).
Add MTOM and it fails.

I am not sure whether this is me configuring things wrong or there is a bug somewhere along the line, I posting her.

WCF Details: SOAP 1.2 with WS_RM enabled and MTOM encoding running on IIS 6.0 windows server 2003 r 2 .Net framework 4.0.
WCF web config:

<system.serviceModel>
<services>
<service name="INM.IDA.WSRM.WebServices.ResidenceApplicationCreate">
<endpoint name="WSRM_ResidenceApplicationCreate" address="" binding="customBinding" bindingConfiguration="WSRM_ResidenceApplicationCreate"
contract="IResidenceApplicationCreate" />
</service>
</services>
<bindings>
<customBinding>
<binding name="WSRM_ResidenceApplicationCreate">
<reliableSession acknowledgementInterval="00:00:02" flowControlEnabled="true"
inactivityTimeout="00:10:00" maxPendingChannels="4" maxRetryCount="8"
maxTransferWindowSize="8" ordered="true" reliableMessagingVersion="Default" />
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
messageVersion="Default" writeEncoding="utf-8">
<readerQuotas maxDepth="32" maxStringContentLength="20971520" maxArrayLength="20971520"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</textMessageEncoding>
<httpTransport manualAddressing="false" maxBufferPoolSize="20971520"
maxReceivedMessageSize="20971520" allowCookies="false" authenticationScheme="Anonymous"
bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard"
keepAliveEnabled="true" maxBufferSize="20971520" proxyAuthenticationScheme="Anonymous"
realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
useDefaultWebProxy="true" />
</binding>
</customBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior >
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>


SoapUI details: version 3.6.1. JDK 1.6 running on same mchine as WCF service.

Now over to request that fails:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ns="http://rep.oio.dk/inm.dk/2011/03/24/" xmlns:ns1="http://rep.oio.dk/inm.dk/IDA/xml.wsdl/2011.10.06" xmlns:ns2="http://rep.oio.dk/inm.dk/2011/10/06/" xmlns:xm="http://www.w3.org/2005/05/xmlmime">
<soap:Header>
<ns:Identity>
<ns:Roles>
<ns:Role>...</ns:Role>
</ns:Roles>
</ns:Identity>
</soap:Header>
<soap:Body>
<ns1:DocumentAdd>
<!--Optional:-->
<ns2:ApplicationID>34435435453</ns2:ApplicationID>
<!--Optional:-->
<ApplicationAndAttachments>
<!--Optional:-->
<ns2:Filename>WSRM.pdf</ns2:Filename>
<!--Optional:-->
<ns2:BinaryFile xm:contentType="application/pdf">cid:22408118652</ns2:BinaryFile>
</ApplicationAndAttachments>
</ns1:DocumentAdd>
</soap:Body>
</soap:Envelope>


Other settings in SOPUI:
1. BinaryFile is added as a pdf attachment in SOAPUI. You can use ordinary pdf file.
2. For WS-A details see WSA_Tab.png attachment.
3. For WS-RM details see WSRM_Tab.png attachment.
4. MTOM enabled.

Now some failure details

SOAPUI gets simple Bad request http error. Analysing WCF logs I am able to isolate the following message that makes sense:

System.ServiceModel.CommunicationException: Error creating a reader for the MTOM message ---&gt; System.Xml.XmlException: Unexpected type 'application/soap+xml; action="DocumentAdd"' found in root MIME part. Message header specifies 'application/soap+xml'.


So I capture HTTP message between these two and I can see following that SOAPUI sends (stripped of for details):

POST /INM.IDA.WSRM.WebServices/ResidenceApplicationCreate.svc HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: multipart/related; type="application/xop+xml"; start="<rootpart@soapui.org>"; start-info="application/soap+xml"; action="http://rep.oio.dk/inm.dk/IDA/xml.wsdl/2011.10.06#DocumentAdd"; boundary="----=_Part_3_29061249.1305270281051"
MIME-Version: 1.0
User-Agent: Jakarta Commons-HttpClient/3.1
Host: vmuisdev01:82
Content-Length: 235841


------=_Part_3_29061249.1305270281051
Content-Type: application/xop+xml; charset=UTF-8; [b]type="application/soap+xml; action=\"DocumentAdd\""[/b]
Content-Transfer-Encoding: 8bit
Content-ID: <rootpart@soapui.org>

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ns="http://rep.oio.dk/inm.dk/2011/03/24/" xmlns:ns1="http://rep.oio.dk/inm.dk/IDA/xml.wsdl/2011.10.06" xmlns:ns2="http://rep.oio.dk/inm.dk/2011/10/06/" xmlns:xm="http://www.w3.org/2005/05/xmlmime">
....
</soap:Envelope>
------=_Part_3_29061249.1305270281051
Content-Type: application/pdf;
name="WSRM Adaptor - Design specification.pdf"
Content-Transfer-Encoding: binary
Content-ID: <WSRM>
Content-Disposition: attachment; name="WSRM Adaptor - Design specification.pdf"; filename="WSRM Adaptor - Design specification.pdf"
....
------=_Part_3_29061249.1305270281051--


So the part with bold font (type="application/soap+xml; action=\"DocumentAdd\"") appears to give WCF some problems. I am not sure, so I execute same request using WCF client. Not supprised it works :-). Below is Http message for that as well:

POST /INM.IDA.WSRM.WebServices/ResidenceApplicationCreate.svc HTTP/1.1
MIME-Version: 1.0
Content-Type: multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:23c96628-4ec8-42d6-88ce-163613c240c5+id=40";start-info="application/soap+xml"
Host: localhost:82
Content-Length: 235753
Expect: 100-continue
Accept-Encoding: gzip, deflate


--uuid:23c96628-4ec8-42d6-88ce-163613c240c5+id=40
Content-ID: <http://tempuri.org/0>
Content-Transfer-Encoding: 8bit
Content-Type: application/xop+xml;charset=utf-8;[b]type="application/soap+xml"[/b]

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:r="http://schemas.xmlsoap.org/ws/2005/02/rm" xmlns:a="http://www.w3.org/2005/08/addressing">
....
</s:Envelope>
--uuid:23c96628-4ec8-42d6-88ce-163613c240c5+id=40
Content-ID: <http://tempuri.org/1/634407888647303708>
Content-Transfer-Encoding: binary
Content-Type: application/pdf
.....
--uuid:23c96628-4ec8-42d6-88ce-163613c240c5+id=40--


I check the same part and I can see they are not exactly same: type="application/soap+xml".

Continuing analysis it appears that SOAPUI appends the action to a type:
type="application/soap+xml; action=\"DocumentAdd\
While WCF does not: type="application/soap+xml"

So what, why is WCF saying that it expects the type="application/soap+xml"? The only place I see it could get that idea from is in HTTP Message where:

The Content type generated by WCF client is:

Content-Type: multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:23c96628-4ec8-42d6-88ce-163613c240c5+id=40";start-info="application/soap+xml"


While SOAPUI generates following:

Content-Type: multipart/related; type="application/xop+xml"; start="<rootpart@soapui.org>"; start-info="application/soap+xml"; action="http://rep.oio.dk/inm.dk/IDA/xml.wsdl/2011.10.06#DocumentAdd"; boundary="----=_Part_3_29061249.1305270281051"


Where in both cases Start info contains: start-info="application/soap+xml"
But SOAPUI changes that to following Content-Type: application/xop+xml; charset=UTF-8; type="application/soap+xml; action=\"DocumentAdd\"", where the type now includes action=\"DocumentAdd\".
WCF appears not to be to happy with it.

If I post the SOAPUI http request using fiddler, where I fix this difference between Start-info and Content-Type type argument, it goes through.

Best regards