using webMethods for webServices as a Producer and consumer

IDN Card
asadul

Tagged in: Untagged 
Print PRINT
PDF

using webMethods for webServices as a Producer and consumer

Webservice:

Web service is a collection of functions that are packaged as a single unit and published to a remote network for use by other software programs. Once your functions or services are exposed as WebServices they can convert your application into a Web-application which can publish its function or message to the rest of the world.

Example: You can create a service to check stock price of companies and expose it as a WebService. So whenever a client or customer calls your service with company name it can return the stock price of the company.

Web services use XML to code and to decode data, and SOAP to transport it (using open protocols).


Webservice Elements:

Web services have three basic platform elements: SOAP, WSDL and UDDI

SOAP(Simple Object Access Protocol):

SOAP is an XML-based protocol to let applications exchange information over HTTP, it’s a protocol for accessing a Web service. SOAP is a communication protocol used for communication between applications which communicates via internet. SOAP is based on XML and is platform and language independent. It’s simple, extendable and W3C recommendation.

WSD/WSDL(Web services description language):

WSDL is an XML-based language for locating and describing Web services.

UDDI(Universal Description, Discovery and Integration):

It’s a directory which stores information about Web services. It’s a directory of Web service interfaces described by WSDL, it communicates via SOAP.

 

Using webMethods to create Web services:

webMethods components Integration Server and Developer can be used to invoke Web services located on remote servers.

Procedure:

1. Get a WSDL file from external client or download it from web, then generate a consumer Web service descriptor from the remote Web service.

2. OR copy the end point URL from the Web service and give it as a reference while creating your consumer service or give your WSDL reference.

2. Then run the Web service connector(s) that Integration Server generates for the consumer Web service descriptor.

webServices in webMethods Consists of the following components:

Web service descriptor (WSD) is an IS element that defines a Web service in IS terms. The Web service descriptor contains all the information required by the consumer (requester) of a Web service.

 

A provider (Producer) Web service descriptor defines a Web service that is hosted on the Integration Server, i.e a service published remotely to external clients/users. A provider Web service descriptor will expose one or more IS flow services as operations, which can be published to a UDDI registry as a single Web service. External users can access the Web service through the registry and invoke the IS services remotely

 

Here Provider/Producer is the one who will process the data/request sent to it by the consumer/client.

A consumer Web service descriptor defines an external Web service, allowing Integration Server to create a Web service connector (WSC) for each operation in the Web service. The Web service connector(s) can be used in Developer just like any other IS flow service; when a connector is invoked it calls a specific operation of a Web service.

Follow the below steps to create a Producer WSDL to expose a simple addition task and a Consumer/connector to invoke the addition functionality using WSDL reference.

I. WSDL creation using a flow service and Web service descriptor option:

1. First create a flow service that is used to expose as a Web service for adding two integers. Create the flow at the Package and folder structure below:


The service webService_Producer.flowServices:addition has just two inputs variable a and b and s single sum output variable “c”.

2. Now we need to create the producer webService for right click on the webService_Producer.producer_webService folder and New-> All choices -> webService Descriptor.

3. Now select the following parameter to create a producer webService and click next

 

4. Select the folder where you want to create the webService and give the webService its name.


 

5. Select the source service for which you need the webService created


 

6. Select the parameter as shown and click on finish


7. Now you ll get a new producer connector created in the relevant folder as shown below


 

8. Now double click on the addition_producer and look at its properties box and extract the parameter called WSDL URL in this case which read

 

http://localhost:5555/ws/webService_Producer.producer_webService:addition_producer?WSDL


9. Now your producer webService is COMPLETED.

 

 

II. CREATION OF THE SERVICE AND THE CONSUMER WEB SERVICE DESCRIPTIOR:

1. Now create a new package called webService_Consumer as shown with the show structure.

 


 

2. Now click on webService_Consumer.consumer_webService folder and select New->All Choices-> web Services descriptor.

 


 

3. Now in the display select consumer and the following selections

 


 

4. Give the consumer web service connector a name as shown and click next.


 

5. In the display below copy the WSDL URL as point 8 from the previous section and select Finish.

 

6. Once done you will now have the webService connector generated in the folder selected and the display would look like the below

 


 

7. Now just drag the item under the connector’s folder

webService_Consumer.consumer_webService.consumer_webService_.connectors:addition_producer_PortType_addition and move the same into your flow service. Once done the pipeline would have all the available inputs, just map the inputs with the Service In parameters and also keep the auth/transport/user and auth/transport/pass parameters set to the Administrator credentials.

 


 

8. Once you run the service you will get the output as the below screen and VIOLA your done.

 

 

III. MULTIPLE PRODUCER WEB SERVICES IN ONE DESCRIPTOR:

1. Let’s say in step I.5 you want to expose multiple IS services in a single

webService, you can definitely do that, in the example cited I will be adding a service webService_Producer.flowServices:subtraction in the webService_Producer package. The package would look like below:

 


 

2. Now while creating a consumer webService Connector use the WSDL URL

 

for the webService_Producer.producer_webService:multi_producer webService descriptor. Once done it would look like the below

 


 

3. Once done the multi service webService connectors in the consumer service

would be exposed as two separate connectors as shown above and need to be used individually with its own set of separate inputs and outputs.

 


 

 

If you have an Idea about creating Remote Server alias its easy to figure out webService EndPoint Aliases.

 

WebService End Point Alias:

Integration Server uses the endpoint URL to determine which Web service descriptor and which binder in that Web service descriptor contain the operation to invoke. The endpoint URL for an operation in a WSDL document generated by Integration Server has the following format:

transport://host:port/ws/wsdName/portName

 

Web Service endpoint aliases may be used for both Consumer and Provider Web Service Descriptors (WSDs) to control the Endpoint URL as well as to supply other runtime settings, such as security credentials. When used with Provider WSDs, the information from the endpoint alias is used to construct the endpoint URL contained in the WSDL generated for the web service,to see this try to create a Provider WSD and while specifying the setting you have option to choose between a Host or Alias.

 

When used with a Consumer WSD, the endpoint alias information will override the endpoint URL information originally contained in the WSDL used to create the Consumer WSD, to use this while creating a Consumer using Consumers endpoint URL create a Consumer Alias.

 

Its also known as Dynamic endpoint addressing, it represents the network address/Hostname and optionally security credentials.

 

The Producer alias is used at runtime to generate a request and invoke an operation of the webservice while the Consumer alias is used at runtime when constructing a response to the webservice request.

 

The main purpose for creating aliases is for Security and Efficiency, this saves us from having to specify or change the server information each time when we use a webService when the actual value of end point changes.

Comments (2)Add Comment
sampath
...
written by sampath, September 15, 2014
superb tutorial
olivia jennifer
...
written by olivia jennifer, May 20, 2014
It will definitely ease your work of handling a big project. As a project manager I use scrum in my projects. One of my friends referred me to use the Guide to Scrum Body of Knowledge by http://www.scrumstudy.com. I like the concepts of sprints, daily standup meetings, etc. the SBOK Helped me alot in Understanding how Agile Project Management works.

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

busy