Wednesday, July 16, 2008

Export\Import (Web Services)

Export/Import Web Services Binding How to

Websphere Integration Developer v612

Contact us...

Contents

Introduction

When to Use Web Services bindings
Consider a Web Service binding when these factors are applicable:
  • You need to access an external service over the Internet or provide a service over the Internet
  • The services are loosely coupled
  • Synchronous communication is preferred; that is, a request from one service can wait for a response from another.
  • The protocol of an external service you are accessing or a service you wish to provide is SOAP/HTTP or SOAP/JMS.
Related links Connectivity

Accessing services
Bindings
Service import and export binding types
Selecting appropriate bindings
Imports and exports

How to generate Web Service bindings for exports

Related links

Generating Web service bindings for exports

Web service bindings

Web service development

Generate Web Service Export

In the assembly diagram, do the following:

  1. Right-click on a component (i.e DateTime_C)
  2. Select Generate Export > Web Service Binding
  3. A Transport Selection window appears (see below).

Select the transport

In the Transport Selection window, select the required transport (soap/http or soap/jms) and click OK.

Web Service export generated

A web service export is generated.

Note the following:

  1. A web service export binding was generated and named based on the interface name (i.e CCambil_DateTime_I)
  2. The web service port (i.e CCambil_...) was created and stored by default in CCambil_Library) since the interface it is based on (i.e CCambil_DateTime_I) is defined in this library.

    You can share the web service port definition by sharing the library where it is stored.

How to generate Web Service bindings for imports

Related links

Generating Web service bindings for imports

Web service bindings

Web service development

Generate Web Service import from a Web Service export

We will create a web service import binding from an existing web service export.
  1. Open the assembly diagram of a service requester module (i.e CCambil_Consumer_M)
  2. Drag a Web Service export (i.e CCambil_DateTime...) from a library (i.e CCambil_Library) and drop it into the assembly diagram of the service requester module (i.e CCambil_Consumer_M)
  3. A Component Creation window will display (see below)

Select the type

In the Component Creation window, select Import with Web Service Binding and click OK.
A Web Service import binding is created.
Wire the Import
Wire the service requester component (i.e CCambil_Consumer_C) to the import as required.
Note:
Notice that the import and export web service binding properties are identical.

How to create an export component by dragging an interface

Related links

Drag an Interface

Drag an interface (i.e StockQuoteService) from a library/module and drop it on the Assembly diagram canvas.

Export with no Binding

In the Component Creation window, select Export with no Binding and click OK.

Note:

You can also select the other types:

  1. Component with no Implementation Type
  2. Export with Web Service Binding
  3. Import with no Binding
  4. Import with Web Service Binding

Export Component created

An export component is created using a default name of StockQuoteServiceExport1 (original interface name + Export1).

Rename Export Component

Rename the export component as required (i.e StockQuoteService, without the Export1 suffix).

Click StockQuoteServiceExport1 in the Assembly Editor to highlight its name. Type StockQuoteService to rename the export.

Notice that the name change is reflected in the Description tab in the export icon's Properties view.

How to generate a Web Services binding

Related links

Accessing services

Imports and exports

Exports

Bindings

Web service development

Web service bindings

Select a component to be bound

In the assembly diagram, right-click on a component (i.e StockQuoteService) you want to bind and select Generate Binding > Web Service Binding.

Select soap/jms

In the Transport Selectioin window, select soap/jms and click OK.

Web Services Binding Generated

If you look at ResourcesWeb Service Ports, you will notice that the wsdl port, StockQuoteService_StockQuoteServiceJmsPort, has been generated.

How to create an import component by dragging an interface

Related links Imports and exports

Drag an Interface

Drag an interface (i.e DelayedServicePortType) from a library/module and drop it on the Assembly diagram canvas.

Import with Web Service Binding

In the Component Creation window, select Import with Web Service Binding and click OK.

Note:

You can also select the other types:

  1. Component with no Implementation Type
  2. Export with no Binding
  3. Export with Web Service Binding
  4. Import with no Binding
  5. Import with Web Service Binding

Select Web Service Import Details

  1. Select Use an existing web service port
  2. click Browse

Select Service Port

Select the service port (i.e DelayedServiceSOAP) and click OK.

Use an existing web service port

Click OK to finalize your selection.

Rename import component

By default, WID 6.1.2 concatenate the interface name (i.e, DelayedServicePortType) with a fixed value of 'ImportN', where N is a sequential number starting with 1 to come up with the import component name.

Rename the default import component as required (i.e to DelayedService). To do this, high-light the current import component name and type over with the new name.

Renamed import component

How to export a component using Web Services Binding

Export Bindings

This is the completed export nodes using various export bindings.

You use exports to make your services available to other components in external modules.

The following steps describes in details how to setup a web service export binding.

Right click the component you want to export and select Generate Export... > Web Services Binding.

Click Yes.

Select soap/http as the transport and click OK.

Rename WS export node

An export node (DateTime_CExport) and a Web Service Port are created.

Rename DateTime_CExport to DateTime_CExport_WS.

Do this by the export node name and appending _WS to it.

Important:

If you re-name the ws export node, you must also rename the related Web Service Port. Otherwise, you will get a 404 error (not found).

After Rename

Rename WEB Service Port

Ensure that the web service export node name(i.e, DateTime_CExport_WS in this example) is the same as the last block in the Web Service Port name.

To rename the Web Service Port name, do the following:

  1. Double-click the Web Service Port name (i.e DateTime_CExport....).
  2. Expand Services
  3. Click soap:address
  4. Rename the last block of location:Value to the Web service export node name.
  5. Save project

From

http://localhost:9080/CCambil_Provider_MWeb/sca/DateTime_CExport

To

http://localhost:9080/CCambil_Provider_MWeb/sca/DateTime_CExport_WS

Test the Web Service Export binding.

Right-click the Web Service export node you want to test and select Test Component.

Follow the same procedure specified in testing an exported component.

Share the Web Service Port

Sharing the Web Service port enables external modules to invoke your web service.

Steps:

  1. Right-click the Web Service port you want to share and select Copy.
  2. Right-click the library you want to copy the port to and select Paste.
  3. The port is copied into the library.

Web Service Export Generated artifacts

The following artifacts are generated when you define a web service export binding:

  1. Web Service Port
  2. Dynamic Web Project

Dynamic Web Project

Web Service Port

How to import a component using Web Services Binding

A Completed Web Service Import Binding

This is the completed import nodes using various import bindings.

You use imports to invoke external services.

The following steps describes in details how to setup a web service import binding.

Select the Web Service Port

Drag the web service port from the library to the Assembly Diagram.

Select Import with Web Services Binding and click OK.

An import is created.

  1. Change the name from Import1 to DateTime_CImport_
    WS
  2. Wire the component (i.e Consumer) to the Web service import
  3. Save the module

Fix Synchronization errors

When you change a component, i.e, adding or deleting interfaces/references, you have to synchronize the changes to the component's implementation.

To fix this error, right-click the component and select Synchronize Interfaces and References > to implementation.

Web Services Import Generated Artifacts

Web Service import binding generates the following artifacts:

  1. Dynamic Web Project (Consumer...).
  2. Web ServicesClients (Consumer...)

No comments: