Upload
kaj-bromose
View
1.080
Download
1
Tags:
Embed Size (px)
DESCRIPTION
Using Mule to access a WebService can be a little complicated. This slide show shows how to embed a SOAP component in a HTTP component and get the WebService response back as Mule payload properties
Citation preview
Mule SOAP Client
Demo
THE SERVICEA WCF service
Service interface
Vigtig !!!!
Service implementation
Response datatype
Endpoints
• WSDL– http://
demo.bromose.eu/DemoService.svc?singleWsdl• Service– http://demo.bromose.eu/DemoService.svc
MULE CLIENT
The Mule Demo
• Pickup the ”Name” in a text file• Call the webservice with the ”Name”• Write the response in a text file i JSON format
The Flow
• Set up the flow
Input File
File to String
• The ”File-toString” is needed due to the fact that the File endpoint passes a stream – not the content of the file.
• The ”File to String” read the content from the stream into a string payload.
SOAP I
• The tricky part !• First you need to build the needed Java classes– Select ”JAX-WS service” as operation
SOAP II
• Select ”Generate from WSDL” and fill in WSDL URL and Package Name
SOAP III
• The trick part one– Select ”JAX-WS client” as operation and fill in info
SOAP IV
• Add http endpoint
SOAP V
• Fill in HTTP settings
Problems I
• HTTP returns a stream • Lets try out the File to String trick to get a
result.
Problems II
• Seems to work
• Lets have a look of the payload
Problems III
• Hmm. That is the SOAP responce – not the properties from the GreetingResponse class
•
The ”magic trick”
• You need to embed the SOAP in the HTML endpoint – has to done in XML
• Bonus – You do not need File to String anymore
The ”Magic” flow
Test I
• Voila – the GreeatingResponse object properties are now payload properties
Test II
• The Object to JSON result:
Test III
• Written to the file