2015-05-01 36 views
0

我遇到了類型爲soap_envelope_1__1.Fault的錯誤。soap_envelope_1__1.Fault細節節點

我收到下面的代碼後面,當我運行調試模式,並獲取回來

<soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
    <faultcode>soapenv:Server</faultcode> 
    <faultstring>Missing or Invalid Information</faultstring> 
    <detail> 
     <ns3:sendFault xmlns:ns3="http://thisservice.com/was/v1" xmlns:ns2="http://thisservice.com/pos/v1" xmlns:ns4="http://thisservice.com/lr/v1" xmlns:ns5="http://thisservice.com/dl/v1" xmlns:ns6="http://thisservice.com/ted/v1" xmlns:ns7="http://thisservice.com/header/v1"> 
      <code>Actual_Code_18</code> 
      <info>Bad Information</info> 
     </ns3:sendFault> 
    </detail> 
</soapenv:Fault> 

對於使用WCF-BasicHTTPPort設置爲身體入站消息體我的發送端口IM故障,並傳送錯誤信息檢查。

在我的編排中我有爲soap_envelope_1__1.Fault設置的錯誤。 我在範圍形狀中捕捉到了故障。 在構造消息形狀中,我構造了由故障生成的對象給我的故障消息:Message_myFault = myFault;

然後我使用一個xslt映射來映射我的錯誤消息中的代碼和信息標記。我的問題是,我似乎無法找到正確的信息和代碼標籤的xpath,他們在我的消息中出現空白,但如果我使用故障代碼或故障字符串填充。 繼承人片:<xsl:value-of select="InputMessagePart_0/s0:Fault/s0:detail/ns6:sendFault/code/text()" />

這是我的樣式表標籤:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var s2 s0 s1 userCSharp" version="1.0" xmlns:array="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:s0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://schemas.microsoft.com/Sql/2008/05/TableOp/dbo/ABCD" xmlns:ns3="http://schemas.microsoft.com/Sql/2008/05/Types/Tables/dbo" xmlns:s2="http://schemas.microsoft.com/BizTalk/2003/aggschema" xmlns:s1="http://schemas.microsoft.com/Sql/2008/05/TypedPolling/ABC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:userCSharp="http://schemas.microsoft.com/BizTalk/2003/userCSharp" xmlns:ns6="http://thisservice.com/was/v2" xmlns:ns2="http://thisservice.com/pos/v2" > 

回答

1

展望(只)在你的XML輸入以下指令:

<xsl:value-of select="/soapenv:Fault/detail/ns3:sendFault/code" /> 

將返回:

Actual_Code_18 

前提是以下名稱空間聲明在範圍內:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:ns3="http://thisservice.com/was/v1" 

請注意,detail元素沒有名稱空間。

0

我建議只使用Orchestration xpath()函數,而不是創建一個完整的地圖,兩個獲得這條消息的兩個小部分;像這樣

strCode= xpath(myFault, "string(/*[local-name()='Fault' and namespace-uri()='http://schemas.xmlsoap.org/soap/envelope/']/*[local-name()='detail' and namespace-uri()='']/*[local-name()='sendFault' and namespace-uri()='http://thisservice.com/was/v1']/*[local-name()='code'])"); 

strInfo= xpath(myFault, "string(/*[local-name()='Fault' and namespace-uri()='http://schemas.xmlsoap.org/soap/envelope/']/*[local-name()='detail' and namespace-uri()='']/*[local-name()='sendFault' and namespace-uri()='http://thisservice.com/was/v1']/*[local-name()='info'])"); 

這個博客對你的任務一些有用的信息,並可能會有所幫助:http://blogs.msdn.com/b/biztalknotes/archive/2013/02/12/how-to-handle-fault-message-in-biztalk-server.aspx

0

正確的命名空間竟然是: InputMessagePart_0/S 1:故障/細節/ NS6:sendFault /代碼/文本()

問題是我添加了一個命名空間到1_1故障的詳細節點。