locked
BizTalk HTTP Receive location Fails RRS feed

  • Question

  • Hi,

    My Http receive location throws “The message version of the outgoing message does not match that of the encoder” when invoked C#.

    I have appended the detailed error message to the bottom this question.

    I created a HTTP receive location as shown below

    1. In the  Default Web site I created  a web app, then created a .SVC file with code shown below.

    <%@ ServiceHost Language="c#" Factory="Microsoft.BizTalk.Adapter.Wcf.Runtime.CustomWebServiceHostFactory, Microsoft.BizTalk.Adapter.Wcf.Runtime, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>

    3.Configured the AppPool with BizTalk user account

    4. Created BizTalk a rcv location with the following configuration and enabled it.
    Type        :WCF-CustomIsolated
    Address   :/test/service.svc
    Binding    :basicHttpBinding

    5. At this point I am able to browse to http://localhost//test/service.svc

    6. I created the following code snippet and invoked the HTTP receive location.

    [ServiceContract]
        public interface IUniversalOneWayContract
        {
            [OperationContract(IsOneWay = true, Action = "*")]
            void SubmitMessage(Message msg);
        }
    private void button1_Click(object sender, EventArgs e)
    {
     txtFileName = @"C:\Dev\BizTalk 2010\WCFSender\ Mesasges\IN\Test.xml";
    System.ServiceModel.Channels.Message msg = System.ServiceModel.Channels.Message.CreateMessage(MessageVersion.Default, "*", XmlReader.Create(txtFileName));
     IUniversalOneWayContract proxy = new ChannelFactory<IUniversalOneWayContract>(new BasicHttpBinding(), txturi.Text).CreateChannel();
     proxy.SubmitMessage(msg);
     MessageBox.Show("Message sent to the service.");
    }

    7. On running the code I get the following error

    System.ServiceModel.ProtocolException was unhandled

      Message=The message version of the outgoing message (Soap12 (http://www.w3.org/2003/05/soap-envelope) Addressing10 (http://www.w3.org/2005/08/addressing)) does not match that of the encoder (Soap11 (http://schemas.xmlsoap.org/soap/envelope/) AddressingNone (http://schemas.microsoft.com/ws/2005/05/addressing/none)). Make sure the binding is configured with the same version as the message.

      Source=mscorlib

      StackTrace:

        Server stack trace:

           at System.ServiceModel.Channels.MessageEncoder.ThrowIfMismatchedMessageVersion(Message message)

           at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessage(Message message, Int32 maxMessageSize, BufferManager bufferManager, Int32 messageOffset)

           at System.ServiceModel.Channels.HttpOutput.SerializeBufferedMessage(Message message)

           at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)

           at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)

           at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)

           at System.ServiceModel.Dispatcher.RequestChannelBinder.Send(Message message, 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)

        Exception rethrown at [0]:

           at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

           at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

           at GenericWCFSender.IUniversalOneWayContract.SubmitMessage(Message msg)

           at GenericWCFSender.GenericSender.button1_Click(Object sender, EventArgs e) in C:\Dev\BizTalk 2010\GenericWCFSender\GenericSender.cs:line 36

           at System.Windows.Forms.Control.OnClick(EventArgs e)

           at System.Windows.Forms.Button.OnClick(EventArgs e)

           at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

           at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

           at System.Windows.Forms.Control.WndProc(Message& m)

           at System.Windows.Forms.ButtonBase.WndProc(Message& m)

           at System.Windows.Forms.Button.WndProc(Message& m)

           at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)

           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)

           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)

           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)

           at System.Windows.Forms.Application.Run(Form mainForm)

           at GenericWCFSender.Program.Main() in C:\Dev\BizTalk 2010\GenericWCFSender\Program.cs:line 18

           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.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)

           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

           at System.Threading.ThreadHelper.ThreadStart()

      InnerException:

    Please could someone point me to a soultion?

    Regards.

    SS


    Shiva Sadayan


    Tuesday, November 13, 2012 3:40 PM

Answers

  • Are you sure the bindings are aligned?

    The error message indicates that you use basicHttpBinding (SOAP11) on one end and wsHttpBinding (SOAP12) on the other side.

    "The message version of the outgoing message (Soap12 (http://www.w3.org/2003/05/soap-envelope) Addressing10 (http://www.w3.org/2005/08/addressing)) does not match that of the encoder (Soap11 (http://schemas.xmlsoap.org/soap/envelope/) AddressingNone (http://schemas.microsoft.com/ws/2005/05/addressing/none)). Make sure the binding is configured with the same version as the message."


    Jean-Paul Smit | Didago IT Consultancy
    Blog | Twitter | LinkedIn
    MCTS BizTalk 2006/2010 + Certified SOA Architect

    Please indicate "Mark as Answer" if this post has answered the question.

    Tuesday, November 13, 2012 3:50 PM
  • You use the WCF receive location not the HTTP receive location. They are different adapters.

    We cannot use the custom made WCF service to communicate with BizTalk. It should be the WCF BizTalk adapter (or old SOAP adapter).

    In your case the request didn't get through the SOAP protocol proxy. Use the SoapUi to debug your service.


    Leonid Ganeline [BizTalk MVP] BizTalkien: Advanced Questions

    • Marked as answer by Shiva Sadayan Friday, November 16, 2012 11:50 AM
    Wednesday, November 14, 2012 5:06 PM
    Moderator

All replies

  • Are you sure the bindings are aligned?

    The error message indicates that you use basicHttpBinding (SOAP11) on one end and wsHttpBinding (SOAP12) on the other side.

    "The message version of the outgoing message (Soap12 (http://www.w3.org/2003/05/soap-envelope) Addressing10 (http://www.w3.org/2005/08/addressing)) does not match that of the encoder (Soap11 (http://schemas.xmlsoap.org/soap/envelope/) AddressingNone (http://schemas.microsoft.com/ws/2005/05/addressing/none)). Make sure the binding is configured with the same version as the message."


    Jean-Paul Smit | Didago IT Consultancy
    Blog | Twitter | LinkedIn
    MCTS BizTalk 2006/2010 + Certified SOA Architect

    Please indicate "Mark as Answer" if this post has answered the question.

    Tuesday, November 13, 2012 3:50 PM
  • Please see the binding configuration below.


    Shiva Sadayan

    Tuesday, November 13, 2012 4:01 PM
  • Jean,

    Do you think my web config is okay? At the moment it looks

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <directoryBrowse enabled="true" />
            <defaultDocument>
                <files>
                    <add value="service.svc" />
                </files>
            </defaultDocument>
        </system.webServer>
    </configuration>


    Shiva Sadayan

    Tuesday, November 13, 2012 4:04 PM
  • To create the receive location exposed as a web-service, we have to use the BizTalk WCF Service Publishing Wizard. It creates a binding file which should be used to create a receive port.

    Did you use this wizard?


    Leonid Ganeline [BizTalk MVP] BizTalkien: Advanced Questions

    Tuesday, November 13, 2012 8:59 PM
    Moderator
  • Leonid,

    I understand that we can use BizTalk WCF Service Publishing Wizard to create a HTTP receive location by publishing a schema.

    I was just experimenting if I can manually create a HTTP Receive location without having to go through the BizTalk WCF Service Publishing Wizard.

    Thanks

    Shiva S.


    Shiva Sadayan

    Wednesday, November 14, 2012 9:53 AM
  • You use the WCF receive location not the HTTP receive location. They are different adapters.

    We cannot use the custom made WCF service to communicate with BizTalk. It should be the WCF BizTalk adapter (or old SOAP adapter).

    In your case the request didn't get through the SOAP protocol proxy. Use the SoapUi to debug your service.


    Leonid Ganeline [BizTalk MVP] BizTalkien: Advanced Questions

    • Marked as answer by Shiva Sadayan Friday, November 16, 2012 11:50 AM
    Wednesday, November 14, 2012 5:06 PM
    Moderator