webMethods step by step creation of webservice using http post
Task: creating a webservice using http post method
Platform: webMethods 6.1
web service scenario
Web services are created to use a functionality of a service remotely without even knowing the implementation of the service. These are described using XML based Web service descriptor language(WSDL) it consists of two parts:
1) XML schema used to identify the signature of the service(input and output parameters, data type and return type).
2) Binding information used to identify the protocols and server addresses used to call the service.
The protocol for invoking the webservices and getting the result is SOAP(simple object access protocol). SOAP messages are XML messages that are sent over HTTP/HTTPS. All the communication to and from webservices is binded in a SOAP message.
Here we discuss about creating a flow service and making it a webservice by creating a WSDL file from the service using HTTP post method.
-> Create two documents
i) InDoc(Input document) which contains two variables val1 and val2
ii) OutDoc(Output document) which contains a variable output.
1) Create a sample service for adding two integers and name it addInts
Input -> a object feild
Your SOAP message will come as input where you need to transform it and perform operation on the SOAP message.
2) Use a service from wM public math folder to add two input integers
doc- Indoc(input document)
value- OutDoc(output document)
3) Transform the resultant output to xml format using
httpPost(OutDoc) - document
4) Use setResponse service to set your service response-> pub.flow.setResponse
xmldata - response
content Type - Text/html
5) Go to properties of your addInts service and set the ACL for the group of users you want to allow access by setting the Execute ACL property, if you are not specific then choose Anonymous.
5) Now create your WSDL file for making your service a webservice
-> Select the service -> Go to Tools -> Generate WSDL
Select method as HTTP Post
Select the signature i.e input as your InputDoc and output as OutDoc
Save the WSDL file.
DOJ: 20 Jun 2014