mule - Mule 4 - 使用 Anypoint studio 7 创建 WSDL Web 服务
问题描述
我已经阅读了有关使用最新 mule (https://docs.mulesoft.com/apikit/4.x/apikit-4-soap-prerequisites-task)创建肥皂网络服务的新方法的文档,但它没有真的有帮助。
因为我尝试执行以下操作,以该教程为例,当用户输入名称、大小、电子邮件并在OrderTshirt
函数中发送请求时,我的流程将调用 java 类中的方法,可能int OrderTShirt.order(String input)
在其中输入 concat 所有名称、大小, 和 email 信息,并返回 orderId,并提交回响应给用户。我该如何处理?
这是我现在拥有的代码,但我不知道如何很好地使用该数据波组件,有人可以给我一个例子吗?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<mule xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:apikit-soap="http://www.mulesoft.org/schema/mule/apikit-soap" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/apikit-soap http://www.mulesoft.org/schema/mule/apikit-soap/current/mule-apikit-soap.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
<http:listener-config name="api-httpListenerConfig">
<http:listener-connection host="0.0.0.0" port="9999"/>
</http:listener-config>
<apikit-soap:config name="soapkit-config" port="TshirtServicePort" service="TshirtService" wsdlLocation="Tshirt2.wsdl"/>
<flow name="api-main">
<http:listener config-ref="api-httpListenerConfig" path="/TshirtService/TshirtServicePort">
<http:response>
<http:body>#[payload]</http:body>
<http:headers>#[attributes.protocolHeaders default {}]</http:headers>
</http:response>
<http:error-response>
<http:body>#[payload]</http:body>
<http:headers>#[attributes.protocolHeaders default {}]</http:headers>
</http:error-response>
</http:listener>
<apikit-soap:router config-ref="soapkit-config">
<apikit-soap:message>#[payload]</apikit-soap:message>
<apikit-soap:attributes>#[
%dw 2.0
output application/java
---
{
headers: attributes.headers,
method: attributes.method,
queryString: attributes.queryString
}]</apikit-soap:attributes>
</apikit-soap:router>
</flow>
<flow name="OrderTshirt:\soapkit-config" doc:id="969489c2-709c-43b7-915c-cc92d9f3c8c9">
<ee:transform doc:name="Transform Message" doc:id="5771f4b9-0060-4658-aa8a-fee10efc02c5" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/java
ns ns0 http://schemas.xmlsoap.org/soap/envelope
---
{
body:{
ns0#orderTshirtResponse:{
orderId:"10"
}
} write "application/xml"
}]]></ee:set-payload>
</ee:message>
</ee:transform>
</flow>
<flow name="ListInventory:\soapkit-config">
<ee:transform doc:id="431ad9c7-f0bf-4b32-88bc-bbe8c6815317">
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
output application/java
ns soap http://schemas.xmlsoap.org/soap/envelope
---
{
body: {
soap#Fault: {
faultcode: "soap:Server",
faultstring: "Operation [ListInventory:\soapkit-config] not implemented"
}
} write "application/xml"
}]]></ee:set-payload>
</ee:message>
</ee:transform>
</flow>
<flow name="TrackOrder:\soapkit-config">
<ee:transform doc:id="a09a0cc3-f28a-49aa-bb32-77368340a522">
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
output application/java
ns soap http://schemas.xmlsoap.org/soap/envelope
---
{
body: {
soap#Fault: {
faultcode: "soap:Server",
faultstring: "Operation [TrackOrder:\soapkit-config] not implemented"
}
} write "application/xml"
}]]></ee:set-payload>
</ee:message>
</ee:transform>
</flow>
</mule>
解决方案
推荐阅读
- rx-java2 - Micronaut/RxJava 控制器不向客户端返回输出
- javascript - replaceAll 不带替换 html 标签 JavaScript
- vba - 在 Powerpoint 中查找和删除文本
- ansible - 如何根据条件设置不同的参数
- stata - Stata:如何从病例对照研究的结果中生成数据集?
- ruby-on-rails - 除了名称属性之外,是否可以使用机械化复选框?
- python - 无法安装 pytorch:没有为 torch==1.7.0+cpu 找到匹配的发行版
- unity3d - 内置摄像头上的鼠标位置
- azure-cosmosdb - 带有 cosmos db 的 Asp.net 核心 api 中的 Json 补丁
- javascript - 制作状态机的承诺链?