使用 soap 负载调用端点

Calling an endpoint with a soap payload

我需要使用 WSO2 ESB 转换一条消息,并按照它的格式发送它。我正在接收 xml 格式的有效负载,我需要使用 soap 信封将其转换为 xml。为此,我使用有效载荷工厂来转换有效载荷:

    <payloadFactory media-type="xml">
        <format>
            <soapenv:Envelope xmlns:param="urn:www.my_url.com/param:1.6" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
                <soapenv:Header/>
                <soapenv:Body>
                    <param:GetUser>
                        <GetNameQue>
                            <firstname></firstname>
                            <surname></surname>
                        </GetNameQue>
                    </param:GetUser>
                </soapenv:Body>
            </soapenv:Envelope>
        </format>
        <args>
            <arg evaluator="xml" expression="//MessageGetUser/FirstName"/>
            <arg evaluator="xml" expression="//MessageGetUser/Surname"/>
        </args>
    </payloadFactory>

然后我调用另一个平台使用:

<property name="messageType" scope="axis2" type="STRING" value="application/xml"/>
    <call>
        <endpoint>
            <http method="post" uri-template="{uri.var.httpendpointurl}">
                <suspendOnFailure>
                    <initialDuration>-1</initialDuration>
                    <progressionFactor>1</progressionFactor>
                </suspendOnFailure>
                <markForSuspension>
                    <retriesBeforeSuspension>0</retriesBeforeSuspension>
                </markForSuspension>
            </http>
        </endpoint>
    </call>

我一直收到格式错误的错误消息,经过一些调试后我发现我的 $body/ 已发送,看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <param:GetUser xmlns:param="urn:www.my_url.com/param:1.6">
      <GetNameQue xmlns="http://ws.apache.org/ns/synapse">
         <firstname>MyFirst</firstname>
         <surname>MySecond</surname>
      </GetNameQue>
   </param:GetUser>
</soapenv:Body>

虽然我的 $env 看起来正是需要发送的内容:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:param="urn:www.my_url.com/param:1.6">
   <soapenv:Body>
      <param:GetUser>
         <GetNameQue xmlns="http://ws.apache.org/ns/synapse">
         <firstname>MyFirst</firstname>
         <surname>MySecond</surname>
         </GetNameQue>
      </param:GetUser>
   </soapenv:Body>
</soapenv:Envelope>

我的问题是有没有一种方法可以发送信封而不是正文,或者使用调用发送的到底是什么?例如,我知道当前的 json ($) 是发送 json 有效负载时发送的那个。

如果我的问题听起来很糟糕,我很抱歉,到目前为止,我只是没有找到任何对我有帮助的信息。 编辑:我尝试了以下解决方案,但它们没有用: WSO2 ESB Payload Factory creates invalid SOAP envelope https://isuruuy.medium.com/how-to-construct-a-payload-with-the-soap-envelope-ce8df5032dda https://medium.com/wso2-learning/wso2-esb-ei-apim-create-payloads-with-soap-envelope-481bc0dbf330

如果您需要任何其他信息,请告诉我,我很乐意提供。

提前谢谢大家!

将格式添加到我的呼叫可以正确发送信封:

<call>
    <endpoint>
        <http method="post" uri-template="{uri.var.httpendpointurl}" format="soap11">
            <suspendOnFailure>
                <initialDuration>-1</initialDuration>
                <progressionFactor>1</progressionFactor>
            </suspendOnFailure>
            <markForSuspension>
                <retriesBeforeSuspension>0</retriesBeforeSuspension>
            </markForSuspension>
        </http>
    </endpoint>
</call>