Search code examples
web-serviceswebwsdlmule

Inbound SOAP end-point for Mule


I want to expose a SMS services as a SOAP end-point. I have the SMS service working in mule but I have an simple HTTP end-point currently

Who can help me with the steps and the WSDL file of this SOAP service to have it as a inbound end-point

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.sms.example.com/">
<soapenv:Header/>
<soapenv:Body>
  <ws:sendTextMessage>
<sender>%SENDERID%</sender>
<to>%TO%</to>
<text>%MESSAGE%</text>
  </ws:sendTextMessage>
</soapenv:Body>
</soapenv:Envelope>

Kind Regards.

Jaco


Solution

  • I don't think there are any tools to create a WSDL file from a SOAP example, but your schema looks so simple, that you should be able to create it manually by going through some helloworld wsdl tutorial. Another approach is to try to create a Java implementation for the service, and it will print out the wsdl when attached to the endpoint. See the Mule docs for more info on these two approaches.

    To test and validate your wsdl/soap endpoint, install SoapUI and create a test project where you import the wsdl, generate a request (works automatically), see that it matches your example, and then configure an endpoint for the request to send it to the Mule inbound.

    In Mule, you have pretty much two options: you can implement the service as a Java class like in the above examples, or you can implement it as a cxf:proxy-service where you access the payload directly. In the latter approach you don't need any Java classes, you are just wrapping your flows inside a SOAP API.

    UPDATE:

    SOAP requests are pretty much just HTTP calls with XML like in your example as raw POST data, so you can access their content in Mule inbounds like any POST data, and parse them with XPath. If you define a cxf:proxy-service, you get a bit more "real" SOAP service functionality, but you can take in SOAP calls with almost any HTTP listener, grab their content, and reply with a string that the client would expect, and the client will not know the difference.

    If your Mule flow contacts another SOAP service, you can create a proxy with both the server and the client, like in this example. You might also be able to get the WSDL for the other SOAP service by appending ?wsdl to the service URL. This is a common practice with SOAP.