Mule released WebService
Using the Mule ESB message bus to publish and call WebService is very streamlined, mule wraps all the operations, you only need to drag the control configuration can be, the following explanation mule released:
1. The following is the Flow,http listener interface, CXF publishes Webservice,java methods used to refer to WebService.
The 2.xml code is as follows:
<flow name= "WebService" >
The 3.java code is as follows:
①impl Implementation Class
Package Com.test;import Javax.jws.WebService; @WebService (endpointinterface = "Com.test.HelloWorld", ServiceName = " HelloWorld ") public class Helloworldimpl implements helloworld{@Overridepublic string Sayhi (string text) {//TODO Auto-generated method Stubreturn "Hello" + text; }}
②impl Implementation Class
Package Com.test;import Javax.jws.WebService; @WebService (endpointinterface = "Com.test.HelloWorld", ServiceName = " HelloWorld ") public class Helloworldimpl implements helloworld{@Overridepublic string Sayhi (string text) {//TODO Auto-generated method Stubreturn "Hello" + text; }}
The 4.Java control references class Name:com.test.HelloWorldImpl.
To enable the Mule service, access the HTTP://LOCALHOST:8080/API/HELLO?WSDL results as follows:
At this point, the publication succeeds.
Mule Request WebService
Using the Mule ESB to request WebService is very simple, just use the web Service consumer control, and the following explains the request WebService:
1. The following is the FLOW,HTTP request listener interface, WEB Service consumer call interface, Set payload pass parameters.
2. Request WebService need to use a tool to assemble the requested Body:soapui-5.2.1.exe, download the link in the attachment, using the following method:
We only need to <soap:Body> inside parameters, we need to paste xmlns:web= "http://Mozi.com/Webservices/" into the <web:PostPatientRequest> request, As follows:
<web:postpatientrequest xmlns:web= "" >http://mozi.com/webservices/">
<!--Optional:? Inside is your parameter--
<web:requestContent>?</web:requestContent>
</web:PostPatientRequest>
The 3.xml code is as follows:
At this point, request WebService published successfully!
Mule Release Call WebService