2017-06-15 129 views
0

我有以下代理服務正在通過代理服務進行調用。WSO2 ESB保留有效負載消息

<?xml version="1.0" encoding="UTF-8"?> 
<sequence name="seq_invchk_slpa_in" trace="disable" xmlns="http://ws.apache.org/ns/synapse"> 
    <log level="custom"> 
    <property name="STATUS::" value="***************************"/> 
    </log> 
    <payloadFactory media-type="xml"> 
    <format> 
     <soapenv:Envelope xmlns:hnb="http://10.104.74.93/hnb" 
     xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
     xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
     <soapenv:Header/> 
     <soapenv:Body> 
      <hnb:CheckInvoiceDetails soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
      <invoice_no xsi:type="xsd:string">$1</invoice_no> 
      </hnb:CheckInvoiceDetails> 
     </soapenv:Body> 
     </soapenv:Envelope> 
    </format> 
    <args> 
     <arg evaluator="xml" expression="$ctx:invoice_no"/> 
    </args> 
    </payloadFactory> 
    <property name="ContentType" scope="axis2" type="STRING" value="text/xml"/> 
    <header name="Action" scope="default" value="CheckInvoiceDetails"/> 
    <property name="SOAPAction" scope="transport" type="STRING" value="CheckInvoiceDetails"/> 
    <send> 
    <endpoint key="gov:INVCHK/SLPA/endpoints/invchk_slpa_validation_ep.xml"/> 
    </send> 
</sequence> 

從一個工具(SOAP UI)調用時,該服務沒有任何問題。

但是當從系統調用時出現問題。我所描繪出到目前爲止 是正確的通話過程中有效載荷工廠消息作爲

<?xml version="1.0" encoding="UTF-8"?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hnb="http://10.104.74.93/hnb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <soapenv:Body> 
     <hnb:CheckInvoiceDetails soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
     <invoice_no xmlns="http://ws.apache.org/ns/synapse" xsi:type="xsd:string">17231374967185</invoice_no> 
     </hnb:CheckInvoiceDetails> 
    </soapenv:Body> 
</soapenv:Envelope> 

當錯誤調用時的有用消息走出ESB作爲

<?xml version="1.0" encoding="UTF-8"?> 
<hnb:CheckInvoiceDetails xmlns:hnb="http://10.104.74.93/hnb" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
    <invoice_no xmlns="http://ws.apache.org/ns/synapse" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">17231374967185</invoice_no> 
</hnb:CheckInvoiceDetails> 

這我認爲導致了這個問題。我錯誤的通話過程中從客戶得到的迴應是

<?xml version="1.0" encoding="UTF-8"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap .org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
    <SOAP-ENV:Body> 
     <SOAP-ENV:Fault> 
     <faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode> 
     <faultstring xsi:type="xsd:string">Operation '' is not defined in the WSDL for this service</faultstring> 
     <detail xsi:type="xsd:string" /> 
     </SOAP-ENV:Fault> 
    </SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 

我怎樣才能保持SOAP消息,因爲它是和它發送出去由系統調用時。

爲什麼肥皂命名空間中 方法級別 <hnb:CheckInvoiceDetails xmlns:hnb="http://10.104.74.93/hnb" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

任何幫助將是非常讚賞混錯。

+0

將它保存在屬性。然後在需要使用補充時恢復。 – simar

+0

感謝您的評論,但發送消息更改時,這是問題,爲什麼要添加肥皂名稱空間的任何線索? – Yasothar

+0

PayloadFactory介體被設計爲更改消息體的內容。爲什麼你有信封,標題和正文標籤。 WSOESB將在通過傳輸傳輸消息之前將信封添加到消息本身。 – simar

回答

1

你至少可以改變有效載荷廠調解的內容

<payloadFactory media-type="xml"> 
    <format> 
      <hnb:CheckInvoiceDetails xmlns:hnb="http://10.104.74.93/hnb"> 
      <hnb:invoice_no xsi:type="xsd:string">$1</hnb:invoice_no> 
      </hnb:CheckInvoiceDetails> 
    </format> 
    <args> 
     <arg evaluator="xml" expression="$ctx:invoice_no"/> 
    </args> 
    </payloadFactory> 

講究invoice_no標籤。最初它不清楚它假設的名稱空間是什麼,默認情況下它實際上嵌套了突觸引擎的名稱空間。所以更好地明確分配名稱空間。

Synapse引擎會默認添加信封。

如果消息類型未知,則返回soap12。在Synapse的文檔中找到。 不帶messageType的屬性內容類型是無用的。

+0

默認情況下,突觸引擎將添加SOAP 1.2頭,如果我需要1.1頭,我該如何明確地添加它們? – Yasothar

+0

我現在沒有機會檢查它。但是我記得當你在ESB服務的SOAPUI中創建SOAP項目時,你將獲得2個服務副本。一個在soap1.1上運行另一個在soap1.2 – simar

+0

假設服務名稱SampleProxy,那麼您將獲得每個傳輸類型的每個端點的2個副本,分配給服務。對於肥皂你會得到 http:// ip-address:port/services/SampleProxy.SoapEnpoint1.1 http:// ip-address:port/services/SampleProxy.SoapEnpoint1.2 嘗試使用正確的地址 – simar