none
The content type multipart/related; type="application/soap+xml"; boundary="uuid:efc32b30-6169-43b7-a52d-60199a3254dd" of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). RRS feed

  • Question

  • When trying to invoke a protected  JEE WS I am getting the protocol exception:

    The content type multipart/related; type="application/soap+xml"; boundary="uuid:29574945-6102-49a0-8b6b-a0a1437f8a22" of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '--uuid:29574945-6102-49a0-8b6b-a0a1437f8a22

    Content-Type: application/soap+xml; charset=utf-8

    I did look up the links but did not see any type with boundary.

    Thanks for your help!


    Monday, February 17, 2014 9:26 PM

All replies

  • Hi,

    >>The content type multipart/related; type="application/soap+xml"; boundary="uuid:29574945-6102-49a0-8b6b-a0a1437f8a22" of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '--uuid:29574945-6102-49a0-8b6b-a0a1437f8a22

    It seems that in your wcf configuration you have ignored the messageEncoding="Mtom" attribute. Please try to check it.

    Also instead of using attribute, it seems better to use the  element directly:

    <binding name="energylinkSOAP">
        <mtomMessageEncoding messageVersion="Soap12" />
        <httpsTransport requireClientCertificate="true" />
    </binding>

    By that you can also define more configurations, such as messageVersion.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, February 18, 2014 9:53 AM
    Moderator
  • Thanks but the service does not return MTOM encoded messages.

    Server side logs shows the returned response as:

    <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Header><To xmlns="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/anonymous</To><Action xmlns="http://www    .w3.org/2005/08/addressing">http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/SCT</Action><RelatesTo xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:6a2c2d8a-39bb-4e2f-b151-576889aff6f4</Relate    sTo></env:Header><env:Body><wst:RequestSecurityTokenResponseCollection xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wsc="http://docs.oasis-open.o    rg/ws-sx/ws-secureconversation/200512" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wst="h    ttp://docs.oasis-open.org/ws-sx/ws-trust/200512" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"><wst:Request    SecurityTokenResponse><wst:TokenType>http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512/sct</wst:TokenType><wst:Entropy><wst:BinarySecret Type="http://docs.oasis-open.org/ws-sx/ws-trust/200512    /Nonce">tD42chnI24n7gGh2U/hJlg==</wst:BinarySecret></wst:Entropy><wst:KeySize>128</wst:KeySize><wst:Lifetime><wsu:Created>2014-02-22T12:47:25.005Z</wsu:Created><wsu:Expires>2014-02-22T13:17:25.005Z</wsu:    Expires></wst:Lifetime><wst:RequestedSecurityToken><wsc13:SecurityContextToken xmlns:wsc13="http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512" wsu:Id="uuid-61f03c37-b8bf-4ab0-a4a5-df53b570fb5    8"><wsc13:Identifier>uuid:WLS2:server:soa_server1:4eef756f45c7260f:644cf52d:144414ea5fe:-7f53</wsc13:Identifier></wsc13:SecurityContextToken></wst:RequestedSecurityToken><wst:RequestedAttachedReference><    wsse:SecurityTokenReference xmlns:wsse11="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd"><wsse:Reference URI="#uuid-61f03c37-b8bf-4ab0-a4a5-df53b570fb58" ValueType="http://docs.oasis    -open.org/ws-sx/ws-secureconversation/200512/sct"></wsse:Reference></wsse:SecurityTokenReference></wst:RequestedAttachedReference><wst:RequestedProofToken><wst:ComputedKey>http://docs.oasis-open.org/ws-s    x/ws-trust/200512/CK/PSHA1</wst:ComputedKey></wst:RequestedProofToken><wst:RequestedUnattachedReference><wsse:SecurityTokenReference xmlns:wsse11="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-sece    xt-1.1.xsd"><wsse:Reference URI="uuid:WLS2:server:soa_server1:4eef756f45c7260f:644cf52d:144414ea5fe:-7f53" ValueType="http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512/sct"></wsse:Reference><    /wsse:SecurityTokenReference></wst:RequestedUnattachedReference></wst:RequestSecurityTokenResponse></wst:RequestSecurityTokenResponseCollection></env:Body></env:Envelope>

    The response type is type="application/soap+xml"; boundary="uuid:8ecdcc87-1cd0-49f5-954d-8a268da26a00"  

    ..here is the actual error I found in the trace:

    <Exception>
    <ExceptionType>System.ServiceModel.ProtocolException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
    <Message>The content type multipart/related; type="application/soap+xml"; boundary="uuid:8ecdcc87-1cd0-49f5-954d-8a268da26a00" of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '--uuid:8ecdcc87-1cd0-49f5-954d-8a268da26a00
    Content-Type: application/soap+xml; charset=utf-8

    &lt;?xml version='1.0' encoding='UTF-8'?&gt;&lt;env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"&gt;&lt;env:Header&gt;&lt;To xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns="http://www.w3.org/2005/08/addressing" wsu:Id="wsO10SjpumCqOajfQ0YrNA22"&gt;http://www.w3.org/2005/08/addressing/anonymous&lt;/To&gt;&lt;Action xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns="http://www.w3.org/2005/08/addressing" wsu:Id="pdEo81JtLgkd0Km9m5jvaw22"&gt;http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/SCT&lt;/Action&gt;&lt;RelatesTo xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns="http://www.w3.org/2005/08/addressing" wsu:Id="VPr0UtG1qK9h1zqP01Nvxw22"&gt;urn:uuid:3ba4a908-0ffd-416d-9c29-da06ecf86889&lt;/RelatesTo&gt;&lt;wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri'.</Message>
    <StackTrace>
    at System.ServiceModel.Channels.HttpChannelUtilities.TraceResponseException(Exception exception)
    at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory`1 factory, WebException responseException, ChannelBinding channelBinding)
    at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
    at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
    at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
    at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout)
    at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout)
    at System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout)
    at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout)
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
    at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
    at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
    at ConsoleAppWss11UsernameWithMessageProtection.ServiceReference1.ws11_username_token_with_message_protection_wssc.sayHello(sayHelloRequest request)
    at ConsoleAppWss11UsernameWithMessageProtection.ServiceReference1.ws11_username_token_with_message_protection_wsscClient.ConsoleAppWss11UsernameWithMessageProtection.ServiceReference1.ws11_username_token_with_message_protection_wssc.sayHello(sayHelloRequest request)
    at ConsoleAppWss11UsernameWithMessageProtection.ServiceReference1.ws11_username_token_with_message_protection_wsscClient.sayHello(String arg0)
    at ConsoleAppWss11UsernameWithMessageProtection.Program.Main(String[] args)
    at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()
    </StackTrace>
    <ExceptionString>System.ServiceModel.ProtocolException: The content type multipart/related; type="application/soap+xml"; boundary="uuid:8ecdcc87-1cd0-49f5-954d-8a268da26a00" of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '--uuid:8ecdcc87-1cd0-49f5-954d-8a268da26a00
    Content-Type: application/soap+xml; charset=utf-8

    &lt;?xml version='1.0' encoding='UTF-8'?&gt;&lt;env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"&gt;&lt;env:Header&gt;&lt;To xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns="http://www.w3.org/2005/08/addressing" wsu:Id="wsO10SjpumCqOajfQ0YrNA22"&gt;http://www.w3.org/2005/08/addressing/anonymous&lt;/To&gt;&lt;Action xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns="http://www.w3.org/2005/08/addressing" wsu:Id="pdEo81JtLgkd0Km9m5jvaw22"&gt;http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/SCT&lt;/Action&gt;&lt;RelatesTo xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns="http://www.w3.org/2005/08/addressing" wsu:Id="VPr0UtG1qK9h1zqP01Nvxw22"&gt;urn:uuid:3ba4a908-0ffd-416d-9c29-da06ecf86889&lt;/RelatesTo&gt;&lt;wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri'.</ExceptionString>

    Binding:

     <ws2007HttpBinding>

              <binding name="Wss11UsernameTokenWithMessageProtectionWSSCServicePortBinding" >

                <security mode="Message">
                  <!-- transport clientCredentialType="Certificate" / -->
                  <message clientCredentialType="UserName" negotiateServiceCredential="false"
                      algorithmSuite="Basic128" establishSecurityContext="true" />

                </security>
              </binding>
            </ws2007HttpBinding>



    • Edited by MJ2011 Saturday, February 22, 2014 12:56 PM
    Thursday, February 20, 2014 10:55 PM
  • Hey , 

    Did u get the resolution for this? I am stuck with same issue.

    Thanks

    Monday, April 7, 2014 11:35 AM