0

我们有一个非 .net 客户端,它在开发环境中使用基本 HTTP 绑定访问 AX 2012 R2 AIF 服务。当使用错误的 XML 调用服务时,可以理解的是,我们会收到 500 HTTP 错误代码。但是,即使在更正客户端之后,对服务的后续请求也会在一段时间内失败。我们还没想好要等多久。

Error details:

HttpStatusCode: 500
Content-Length: 2980
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Mon, 26 Jan 2015 21:24:19 GMT
<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">
        Error in deserializing body of request message for operation 'myOperationName'.
        OperationFormatter encountered an invalid Message body. Expected to find node type 'Element' with name 'MyServiceNameMyOperationNameRequest' and
        namespace 'http://tempuri.org'. Found node type 'Element' with name 'MyServiceNamemyOperationNameRequest' and namespace ''
      </faultstring>
      <detail     xmlns:s="http://www.w3.org/2003/05/soap-envelope">
        <ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel"      xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
          <HelpLink i:nil="true"></HelpLink>
          <InnerException>
            <HelpLink i:nil="true"></HelpLink>
            <InnerException i:nil="true"></InnerException>
            <Message>
              OperationFormatter encountered an invalid Message body. Expected to find node type 'Element' with name 'MyServiceNameMyOperationNameRequest'
              and namespace 'http://tempuri.org'. Found node type 'Element' with name 'MyServiceNamemyOperationNameRequest' and namespace ''
            </Message>
            <StackTrace>
              at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action,
              MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
              at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
              at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters)
            </StackTrace>
            <Type>System.Runtime.Serialization.SerializationException</Type>
          </InnerException>
          <Message>Error in deserializing body of request message for operation 'myOperationName'. OperationFormatter encountered an invalid Message body. Expected to find node type 'Element' with name 'MyServiceNamemyOperationNameRequest' and namespace 'http://tempuri.org'. Found node type 'Element' with name 'MyServiceNamemyOperationNameRequest' and namespace ''</Message>
          <StackTrace>
            at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters)
            at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)
            at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
            at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
            at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
            at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
          </StackTrace>
          <Type>System.ServiceModel.CommunicationException</Type>
        </ExceptionDetail>
      </detail>
    </s:Fault>
  </s:Body>
</s:Envelope>

有没有办法从这种情况中恢复而不必等待?

谢谢你。

4

1 回答 1

0

您的消息格式对此呼叫无效。

该错误清楚地表明:Expected to find node type 'Element' with name 'MyServiceNameMyOperationNameRequest' and namespace 'http://tempuri.org'. Found node type 'Element' with name 'MyServiceNamemyOperationNameRequest' and namespace ''

您必须向namespace请求 ( 'http://tempuri.org) 添加属性。

于 2015-01-29T16:57:05.740 回答