soap - 使用肥皂负载调用端点
问题描述
我需要使用 WSO2 ESB 转换一条消息并完全按照它的格式发送。我正在接收 xml 格式的有效负载,我需要使用肥皂信封将其转换为 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>$1</firstname>
<surname>$2</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 创建无效的 SOAP 信封 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>
推荐阅读
- python - 如何在tensorflow中选择一个input_shape?
- oracle - Oracle - 如何并行执行此脚本
- c# - 如何重写实体框架表达式树的一部分以重用服务器端?(SQL)
- javascript - 检查查看者是否来自某个站点?
- javascript - 使用 bind() 将多个参数和事件传递给事件处理程序
- android - 在 Android 中使用 Google/Facebook 时的 Firebase Auth 重复帐户
- azure-devops - 在 Azure Devops 中使用多存储库 CI 设置确定触发分支
- php - PHP:重命名命名空间会导致“找不到类”
- mysql - 数据库设计——我需要多细化?
- libreoffice-calc - 寻找数学函数以找到最高可能和