1

I already read the documentation about the new way to create soap web service using newest mule (https://docs.mulesoft.com/apikit/4.x/apikit-4-soap-prerequisites-task), but it doesn't really help.

Because I try to do following, using that tutorial as example, when user enter the name, the size, the email and send the request in OrderTshirt function, my flow will call method in a java class, probably int OrderTShirt.order(String input) where input concat all the name, size, and email information, and return back the orderId, and submit back to the response to user. How I can approach this?

Here is the code that what I have right now, but I don't know how to use that datawave component really well, can someone give me an example for that?

<?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>
Vincent Zheng
  • 385
  • 1
  • 4
  • 19

0 Answers0