none
AX2012R2 WCF request issue "An invalid message header was specified on the request" RRS feed

  • Question

  • Hi everybody

    I'm currently trying to diagnose an issue with a particular method on our new WCF web service which is published from AX2012 R2 to IIS on Windows Server 2012 R2.

    I will add a disclaimer up front that I am not a developer, I am an application consultant so the extent of my knowledge has been tested thus far which is why I'm reaching out here.

    I am passing the following payload using SoapUI (using basic authentication):

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dat="http://schemas.microsoft.com/dynamics/2010/01/datacontracts" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:tem="http://tempuri.org" xmlns:dyn="http://schemas.datacontract.org/2004/07/Dynamics.Ax.Application">
       <soapenv:Body>
          <tem:UnuWebsiteServiceSetAccountPreferencesRequest>
             <!--Optional:-->
             <tem:_setAccountPreferencesRequest>
                <!--Optional:-->
                <dyn:AccountNumber>9999999999</dyn:AccountNumber>
                <!--Optional:-->
                <dyn:EmailAddress>no@way.com</dyn:EmailAddress>
                <!--Optional:-->
                <dyn:PaperlessFlag>false</dyn:PaperlessFlag>
                <!--Optional:-->
                <dyn:TransactionId>T1234567890</dyn:TransactionId>
                <!--Optional:-->
                <dyn:WSSActivated>CUSTOMER</dyn:WSSActivated>
                <!--Optional:-->
                <dyn:WSSActivatedDate>2020-01-30</dyn:WSSActivatedDate>
                <!--Optional:-->
                <dyn:WSSNotNow>false</dyn:WSSNotNow>
                <!--Optional:-->
                <dyn:WSSNotNowDate>2020-01-30</dyn:WSSNotNowDate>
             </tem:_setAccountPreferencesRequest>
          </tem:UnuWebsiteServiceSetAccountPreferencesRequest>
       </soapenv:Body>
    </soapenv:Envelope>

    ...and am receiving the following response (which appears to be being generated by AX, or at least the request is both sent to AX and rejected by IIS, because I see a process entry for the request in AX2012 but it is seemingly not happy with the request which internally it is actually processing (so our application returns "Account number not found" for the above call in AX but returns an error to IIS/the client):

    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
       <s:Body>
          <s:Fault>
             <faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode>
             <faultstring xml:lang="en-US">An invalid message header was specified on the request.</faultstring>
             <detail>
                <ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                   <HelpLink i:nil="true"/>
                   <InnerException i:nil="true"/>
                   <Message>An invalid message header was specified on the request.</Message>
                   <StackTrace><![CDATA[Server stack trace: 
       at Microsoft.Dynamics.Ax.Services.Host.ClientMessageInspector.BeforeSendRequest(Message& request, IClientChannel channel)
       at System.ServiceModel.Dispatcher.ImmutableClientRuntime.BeforeSendRequest(ProxyRpc& rpc)
       at System.ServiceModel.Channels.ServiceChannel.PrepareCall(ProxyOperationRuntime operation, Boolean oneway, ProxyRpc& rpc)
       at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.Begin()
       at System.ServiceModel.Channels.ServiceChannel.BeginCall(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, TimeSpan timeout, AsyncCallback callback, Object asyncState)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeBeginService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    
    Exception rethrown at [0]: 
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Routing.ProcessRequestAsyncResult`1.End(IAsyncResult result)
       at System.ServiceModel.Routing.RoutingService.EndProcessRequest[TContract](IAsyncResult result)
       at AsyncInvokeEndEndProcessRequest(Object , Object[] , IAsyncResult )
       at System.ServiceModel.Dispatcher.AsyncMethodInvoker.InvokeEnd(Object instance, Object[]& outputs, IAsyncResult result)
       at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeEnd(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage7(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)]]></StackTrace>
                   <Type>System.ArgumentException</Type>
                </ExceptionDetail>
             </detail>
          </s:Fault>
       </s:Body>
    </s:Envelope>

    I have deactivated the port and cleared the \bin and \bin\work folder (having just had a painful caching issue) to rule out a re-occurrence of said issue but no joy.

    Do you guys see something in the above output which might point me in the right direction.





    • Edited by DJBenson1 Tuesday, February 4, 2020 10:11 AM
    Tuesday, February 4, 2020 10:08 AM

All replies