从soap故障中获取原因/文本数据

时间:2013-09-18 00:36:42

标签: wcf xpath biztalk biztalk-2010

是否有人知道使用适配器'Messages'属性选项卡和'Inbound BizTalk message body'路径属性从SOAP FAULT下面提取原因/文本的确切XPath。我必须输入XPath。

我尝试了所有组合,但没有得到理由/文本标签下的文字。

我需要获取CData下的数据并将其发送给用户

我正在向用户发送肥皂故障:

<s:Body>
      <s:Fault>
         <s:Code>
            <s:Value>s:Receiver</s:Value>
            <s:Subcode>
               <s:Value xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</s:Value>
            </s:Subcode>
         </s:Code>
         <s:Reason>
            <s:Text xml:lang="en-US"><![CDATA[<ns0:TimeoutFault xmlns:ns0="">
  <Type>TimeoutFault</Type>
  <Destination></Destination>
  <Source></Source>
  <MiddlewareMessageID>de03ba4a-f6af-4524-a92e-952ceae067bf</MiddlewareMessageID>
  <MiddlewareMessage>Timeout Fault</MiddlewareMessage>
  <DateTime>9/17/2013 11:51:15 AM</DateTime>
  <ErrorDetails>An error occurred while processing the message, refer to the details section for more information 
Message ID: {DEBB80C7-B2E8-479F-BCAA-649AEAF21986}
Instance ID: {81320AEC-79DE-48DB-84EE-5D2BC8F3E3BE}
Error Description: System.TimeoutException: The HTTP request to '' has exceeded the allotted timeout of 00:00:00. The time allotted to this operation may have been a portion of a longer timeout.

Server stack trace: 
   at System.ServiceModel.Channels.HttpChannelUtilities.SetRequestTimeout(HttpWebRequest request, TimeSpan timeout)
   at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.SendWebRequest()
   at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.BeginSendRequest(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, Object state)
   at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.StartSend(Boolean completedSynchronously)
   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.ServiceChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, Object state)
   at System.ServiceModel.Channels.ServiceChannel.BeginRequest(Message message, AsyncCallback callback, Object state)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
   at System.ServiceModel.Channels.IRequestChannel.BeginRequest(Message message, AsyncCallback callback, Object state)
   at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendRequestMessage(IBaseMessage bizTalkMessage, IRequestChannel channel)
   at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendMessage(IBaseMessage bizTalkMessage)
</ErrorDetails>
  <StackTrace />
  <Error>
    <ErrorParam />
  </Error>
</ns0:TimeoutFault>]]></s:Text>
         </s:Reason>
         <s: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><![CDATA[<ns0:TimeoutFault xmlns:ns0="">
  <Type></Type>
  <Destination></Destination>
  <Source>Worker Web</Source>
  <MiddlewareMessageID>de03ba4a-f6af-4524-a92e-952ceae067bf</MiddlewareMessageID>
  <MiddlewareMessage>Timeout Fault</MiddlewareMessage>
  <DateTime>9/17/2013 11:51:15 AM</DateTime>
  <ErrorDetails>An error occurred while processing the message, refer to the details section for more information 

Error Description: System.TimeoutException: The HTTP request to '' has exceeded the allotted timeout of 00:00:00. The time allotted to this operation may have been a portion of a longer timeout.

Server stack trace: 
   at System.ServiceModel.Channels.HttpChannelUtilities.SetRequestTimeout(HttpWebRequest request, TimeSpan timeout)
   at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.SendWebRequest()
   at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.BeginSendRequest(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, Object state)
   at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.StartSend(Boolean completedSynchronously)
   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.ServiceChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, Object state)
   at System.ServiceModel.Channels.ServiceChannel.BeginRequest(Message message, AsyncCallback callback, Object state)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
   at System.ServiceModel.Channels.IRequestChannel.BeginRequest(Message message, AsyncCallback callback, Object state)
   at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendRequestMessage(IBaseMessage bizTalkMessage, IRequestChannel channel)
   at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendMessage(IBaseMessage bizTalkMessage)
</ErrorDetails>
  <StackTrace />
  <Error>
    <ErrorParam />
  </Error>
</ns0:TimeoutFault>]]></Message>
               <StackTrace>at Microsoft.BizTalk.Adapter.Wcf.Runtime.BizTalkServiceInstance.EndOperation(IAsyncResult result)
   at AsyncInvokeEndEndTwoWayMethod(Object , Object[] , IAsyncResult )
   at System.ServiceModel.Dispatcher.AsyncMethodInvoker.InvokeEnd(Object instance, Object[]&amp; outputs, IAsyncResult result)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeEnd(MessageRpc&amp; rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage7(MessageRpc&amp; rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace>
               <Type>Microsoft.BizTalk.Adapter.Wcf.Runtime.BizTalkNackException</Type>
            </ExceptionDetail>
         </s:Detail>
      </s:Fault>
   </s:Body>
</s:Envelope>

我需要删除所有内容,只将原因部分作为错误发送。

如何自定义肥皂故障?

1 个答案:

答案 0 :(得分:2)

假设它首先被解包,XPath是

/*[local-name()='Fault' and namespace-uri()='http://www.w3.org/2003/05/soap-envelope']/*[local-name()='Reason' and namespace-uri()='http://www.w3.org/2003/05/soap-envelope']/*[local-name()='Text' and namespace-uri()='http://www.w3.org/2003/05/soap-envelope']