我有以下代理服务,由代理服务调用。
<?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消息,并在系统调用时将其发送出去。
为什么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 :(得分:1)
您至少必须将Payload Factory介体的内容更改为
<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引擎的命名空间。因此最好明确指定名称空间。
Synapse引擎默认会添加信封。
如果消息类型未知,则返回在Synapse文档中找到的soap12。。 没有messageType的属性Content-Type是无用的。