WSO2 ESB保留有效负载消息

问题描述:

我有以下代理服务正在通过代理服务进行调用。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

你至少可以改变有效载荷厂调解的内容

<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