Print PRINT
PDF

webMethods step by step creating a webservice

 

Task: webservice creation as HTTP get

OS: WindowsOS

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 get method.

 

1) Create any flow service (Ex: addInts), the functionality should accept two integers and perform addition return the result.

-> pub.math:addInts

Create a document and add a string for output of addints sequence step

        valu -> OUT(DOC)

-> pub.xml.documentToXMLString

       OUT(DOC) -> document

-> pub.flow.setResponse

      xmldata -> response

contentType -> (text/html)     

 

 

 

 

-> click on addInts services -> go to properties tab and set ACL(Execute ACL) to particular  group which you want to allow access to the webService, select Anonymous if you want to allow anyone.

 

-> Then go to Tools -> Generate WSDL by selecting the flow service then a WSDL file is generated, save it and give the file to anyone who wants to access your service remotely. Upon invocation the service will accept two integer parameters as input and will invoke the addInts service, finally return a integer as output.

 

To Access the service from other system:

If you want invoke a service or logic implemented on remotely using webMethods then get the WSDL file for the service which you want to invoke.

-> Copy the WSDL file and paste it in the local system then at your webMethods developer console select a folder in a package and create a webService connector in it by giving the reference of the Saved WSDL file.

-> webMethods then generates a webService descriptor, describing the signature, schemas and protocols used in the remote service.

-> Then a image is created in your folder o=> Double click it and run the service, which now will invoke the service on remote system.

Note: The system which is hosting the service logic if it is not running then the service on your side will not run.

-> We can also run the webService connector from a browser by selecting webService connector Test -> Run in browser.

 

Comments (1)Add Comment
sampath
...
written by sampath, September 15, 2014
nice its working

Write comment
You must be logged in to post a comment. Please register if you do not have an account yet.

busy