Mule 4 - Создание веб-службы WSDL с использованием Anypoint studio 7 - PullRequest
0 голосов
/ 04 декабря 2018

Я уже читал документацию о новом способе создания мыльного веб-сервиса, используя новейший мул (https://docs.mulesoft.com/apikit/4.x/apikit-4-soap-prerequisites-task),, но это не очень помогает.

Поскольку я пытаюсь сделать следующее, используя этоучебник, например, когда пользователь вводит имя, размер, адрес электронной почты и отправляет запрос в функции OrderTshirt, мой поток вызовет метод в классе java, вероятно, int OrderTShirt.order(String input), где input будет содержать все имя, размер и адрес электронной почты.информацию и вернуть обратно orderId и отправить обратно в ответ пользователю. Как я могу подойти к этому?

Вот код, который у меня есть сейчас, но я не знаю, как его использоватьКомпонент datawave действительно хорошо, кто-нибудь может дать мне пример для этого?

<?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>
...