0

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

Jaco Fourie
  • 112
  • 3
  • 11

1 Answers1

0

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.

Anton Kupias
  • 3,945
  • 3
  • 16
  • 20
  • Hi Anton. I know you don't get those tools, I have been looking for one haha. I just need to pass those % placeholders into my current variables that I have in the mule flow. Do I have to write Java code or can I access the inbound soap variables via MEL ? – Jaco Fourie Mar 11 '14 at 15:14
  • See ddossot's example for proxy service: https://github.com/ddossot/mule-in-action-2e/blob/master/chapter07/src/main/app/cxf-service-proxy.xml . You can use xpath expressions after the dom-to-xml-transformer to access the data. You can of course just get the soap call data directly from the http inbound, and skip using the Mule SOAP stuff. It is just HTTP POST. For example, if you don't need any kind of error handling... :) – Anton Kupias Mar 11 '14 at 15:35
  • Yes I just want to get those vars. the system on the other side makes a soap call in that format. Can I get those variables as inbound parameter or do they come in as the payload and I have to pull them out of there ? – Jaco Fourie Mar 11 '14 at 16:12
  • Thanks so much Anton. I managed to find the correct xpath but now if I try to use it on the payload after the HTTP end-point I get an error that it is the wrong type. So I guess I need to transform it. what is the correct Transformer to use? Thanks again for all your help with Mule. – Jaco Fourie Mar 12 '14 at 11:21
  • I get this error : Message payload is of type: ContentLengthInputStream – Jaco Fourie Mar 12 '14 at 11:23
  • OK I got the payload. I followed this answer http://stackoverflow.com/questions/9334912/mule-esb-cannot-copy-message-with-a-stream-payload . But I know need to find what datatype XPath want. – Jaco Fourie Mar 12 '14 at 11:35
  • object-to-string-transformer after the http inbound should be ok – Anton Kupias Mar 12 '14 at 11:59
  • I get this error when I try the XPath : Execution of the expression "xpath('//soapenv:Envelope/soapenv:Body/ws:sendTextMessage/text/text()').text" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: String – Jaco Fourie Mar 12 '14 at 12:47
  • I know the XPath is correct as I veryfied it on http://chris.photobooks.com/xml/default.htm – Jaco Fourie Mar 12 '14 at 12:49
  • OK so the payload must be an XML document or a DOM instance. I used object to XML and I still get the string error. Aaaa this is soo frustrating. – Jaco Fourie Mar 12 '14 at 13:07
  • It can be a String also, the above error message just states that the payload is a String, not that it is the cause of the error. Please create a new question for using xpath if you can not solve this yourself. There can be a plenty of issues. If you use on the string with your xml, it should set the payload correctly. – Anton Kupias Mar 12 '14 at 13:13