我正在尝试构建一个带有适当信封然后正文的 SOAP 消息,但我无法获得它。下面是我为构建它而编写的代码行。
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<prov>
<abc>123456</abc>
<xyz>789</xyz>
</prov>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args/>
</payloadFactory>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property name="messageType" value="text/xml" scope="axis2"/>
<call>
<endpoint key="ActiveMQ_EP"/>
</call>
<respond/>
我得到的结果如下:
<prov xmlns="http://ws.apache.org/ns/synapse">
<abc>123456</abc>
<xyz>789</xyz>
</prov>
没有正确的 SOAP 有效载荷,先是 Envelope,然后是 body,然后是 prov,而不是它以 prov 开头。在这件事上的任何帮助都会非常有帮助。 谢谢
在发送消息之前设置以下属性。
<property name="messageType" value="text/xml" scope="axis2"/>
更新
尝试在端点配置中使用
format="soap11"
标志强制 soap1.1 消息。这将适用于 HTTP 和地址端点。
<call>
<endpoint>
<http method="post" uri-template="http://localhost:81/post" format="soap11">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
如果您对 SOAP 1.2 消息没问题,您还可以尝试添加以下消息类型。
<property name="messageType" value="application/soap+xml" scope="axis2"/>
但是对于 SOAP 1.2,您可能必须相应地更改有效负载。