Web Service Mappings


Web Service Mappings

You can create a mapping to receive a message from a web service client, transform the data, and send the response back to the web service client or write it to any target PowerCenter supports. Based on the source and target definitions, the Integration Service can receive and send an attachment as part of the SOAP request.

You can also create a mapping with flat file or XML sources and targets and use it in a web service workflow. This allows you to receive message data through a SOAP call by attachment instead of by reading it from a file.

The mapping you create depends on the type of web service that you want to run:

** Request-response web service. A request-response web service receives an incoming request from the web service client, transforms the data, and sends the response back to the web service client. A request-response web service uses both a web service source and a web service target.

You can create one mapping or multiple mappings to process a request-response web service:

* One mapping. Create one mapping that contains both the web service source and web service target definitions. The Integration Service receives an incoming request, transform the data, and send the response back in a single session.

* Multiple mappings. Create multiple mappings to stage data before sending a response back to the web service client. You can create a workflow that contains a session for each mapping.

** One-way web service. If you receive updates and notifications from a web service client, but do not need to send back a response, you can create a one-way mapping. A one-way mapping uses a web service client for the source. The Integration Service loads data to a target, often triggered by a real-time event through a web service request.

The web service source and target definitions you include in the mapping depend on the type of mapping you create. The table describes the web service source and target definitions you use based on the mapping type:

Mapping Type Web Service Source Web Service Target
Request-Response Must have one instance of a web service source definition. Must have one instance of a web service target definition.

Can have multiple fault views in the target definition.

One-way Must have one instance of a web service source definition. Contains no web service target definition.

You can configure PowerCenter web service workflows to use:-

Using a flat file or XML source or target as attachments to a SOAP message
Using a WSDL with MIME attachments

Request-Response Mappings

A request-response mapping uses a web service source and a web service target.

If you create a request-response mapping, use source and target definitions created in the same method. If you import the source definition from a WSDL, import the target definition from the same operation in the WSDL. If you create the source definition by defining the columns or by using relational or flat file sources and targets, create the target definition using the same method.

To ensure that the web service source and target definitions are created using the same method, create the source and target definitions in one process.

Note: If you do not import source and target definitions from the same operation in the WSDL or if you do not create them using the same method, you can get unexpected results.

You can use an SQL transformation to update a database or to retrieve multiple database rows in a request-response mapping. The SQL transformation can return multiple database rows to the target. When database errors occur in processing, the SQL transformation receives the errors from the database and sends the error text to the target.

For an example of a web service that uses an SQL transformation to get multiple rows, see the real-time web services examples shipped with PowerCenter. By default, the real-time web services sample programs are installed in the following directory:

/<PowerCenterInstallDir>/server/samples/WebServices/samples/RealTimeWebServices

Creating a Source or Target Definition:-

If you do not have a WSDL from which to import a web service source or target definition, you can create the definition from a relational or flat file source or target. You can also manually define the ports for the source or target and specify the datatype and the occurrence.

When you create web service source and target definitions from other sources and targets or from manually defined columns, the Designer creates the views in the entity relationship mode. You cannot create web service sources or targets from other sources or targets in hierarchical relationship mode.

You can create web service source and target definitions from relational sources and targets created from the following relational databases:

Oracle
DB2
Informix
Teradata
Microsoft SQL Server
Sybase

When you create a web service source or target definition from relational or flat file sources or targets, the Designer lists the sources and targets available in the folder, including shortcuts to sources and targets.

Create the source and target definitions in the same process. After you create a web service source or target based on relational or flat file source or target, you can edit the columns of the source or target definition in the Designer workspace.

When you import a web service source or target definition from a WSDL, you can select the following options:

Multiple-occurring Elements
Message Ports

Creating a Source or Target from a Relational or Flat File Source or Target:-

Use this procedure to create a web service source or target in one of the following ways:-

From a flat file source or target
From a relational source or target
By manually adding a column and specifying its name, datatype, and precision

To create a web service source or target from a relational or flat file source or target:-

1.
To create a web service source, in the Source Analyzer, click Sources > Web Services Provider > Create Web Service Definition. To create a web service target, in the Target Designer, click Targets > Web Services Provider > Create Web Service Definition.
2.
Enter a name for the web service mapping where you plan to use the source and target definition.

The Designer uses the web service definition name as the name of the source and target definitions. It adds the suffix _input to the source definition name or _output to the target definition name.

If you know the columns you want to include in the web service source or target definition, you can add them directly to the source or target definition. If you have relational or flat file sources or targets in the folder, you can create the source or target definition based on the relational or flat file columns.

3.
To add a column to the list, click the Add button and specify the column name, datatype, and precision.

The Web Services Hub ignores the Not Null property when you create a web service source with multiple occurring elements or when you create a web service target.

4.
To create a web service source or target based on the columns in a relational or flat file source or target definition, click the Import from Source/Target button and select a source or target definition.

The Designer lists the columns found in the selected source or target.

5.
Click OK.
6.
Edit the column names and the precision of string columns if necessary.

You can add columns to the definition and define their data types and properties. You can delete columns you do not want to use.

You can specify whether the columns you define in the source or target definition occur once or multiple times.

7.
If the columns occur multiple times, select Multiple occurring elements.

This option indicates that the columns as a group occur more than once. When you select this option, the Designer generates an element view that contains all the columns.

8.
If you are creating a source definition and you also want to create the target definition, click Create Target and repeat steps 3 to 7 to add the ports to the target definition.

If you are creating a target definition and you also want to create the source definition, click Create Source and repeat steps 3 to 7 to add the ports to the source definition.

9.
To add message and client ports to the source or target definition, click Add message ports.

The Designer adds the message and client ports to the envelope view of the source or target definition. If you are creating source and target definitions in the same process, the Designer adds the message and client ports to the envelope views of the source and target definitions.

10.
Click OK.

The Designer creates the web service source or target definition.

Review the XML views in the source and target definitions to verify that the views and ports match your web service mapping requirements. To add, delete, or modify the columns, edit the source or target definition in the Designer workspace.

Staged Mappings:-

If you want to run a request-response session, but you need to stage the data first, you can create multiple mappings to process the data.

For example, you receive message data that you need to process. You must make an asynchronous call to an external system through WebSphere MQ. You create the following mappings:

1.
Create a request mapping with a web service source definition. This mapping writes to a flat file target and a WebSphere MQ target. You write all message data to both targets.

An external application receives messages from the WebSphere MQ target, processes them, and sends messages to another WebSphere MQ queue.

2.
Create a response mapping with a web service target definition. This mapping uses the flat file target in the first mapping as a source. It also uses the WebSphere MQ queue with the processed data as a source.

The Web Services Hub uses a message ID to connect the requests and responses in a staged mappings. To use web service source and target definitions in a staged mapping, you must include a message ID in the web source and target definitions.

Generating a Mapping from a WSDL You can generate a web service mapping by importing the web service source or target from a WSDL that you can access locally or through a URL.

When you generate a web service mapping by importing source and target definitions from a WSDL, the Designer creates the source definition from the input message of the operation you select. It creates the target definition from the output message of the operation you select.

The web service mapping generated from a WSDL contains the objects:

Web service source definition

Source qualifier

Web service target definition

The Designer links the ports from the source instance through the target instance. To complete the mapping, add the transformations and other mapping component necessary for the web service you want to create.

To generate a mapping from a WSDL:

1.  In the PowerCenter Designer, open the Mapping Designer.

2.  Click Mappings > Create Web Service Mappings > Import from WSDL.

The procedure to generate a web service mapping by importing sources and targets from a WSDL is the same as the procedure to create web service sources or target definitions from a WSDL. For more information, see Importing a Web Service Source or Target Definition.   3.  Save the mapping to the repository.

Mapping from a Relational or Flat File Source or Target You can generate a web service mapping based on a relational or flat file source or target. Use the relational or flat file source or target to define the columns in the web service source and target definitions.

When you generate a mapping from a relational or flat file source or target, the web service mapping generated contains the following objects:

* Web service source definition

** Source qualifier

*** Web service target definition

The Designer links the ports from the source instance through the target instance. To complete the mapping, add the transformations and other mapping component necessary for the web service you want to create.

Note: When you generate a mapping from a relational or flat file source or target, create the web service source and target in the same process. When you run a workflow that contains a mapping with the web service source and target created at different times, the workflow can fail. To generate a mapping from a relational or flat file source or target:

1.  In the PowerCenter Designer, open the Mapping Designer.

2.  Click Mappings > Create Web Service Mappings > Use Source/Target definitions.

The procedure to generate a web service mapping from a relational or flat file source or target is the same as the procedure to create web service source and target definitions from relational or flat file sources or targets. For more information, see Creating a Source or Target Definition.   3.  Save the mapping to the repository.

Transformation or Mapplet:-

You can generate a mapping from a reusable transformation or a mapplet. The Designer uses the ports in the transformation or mapplet to generate the web service source and target definitions.

Note: When you generate a mapping from a transformation or mapplet, create the web service source and target in the same process. When you run a workflow that contains a mapping with the web service source and target created at different times, the workflow can fail.

Generating a Mapping from a Reusable Transformation

You can generate a web service mapping based on the following types of transformation:

Transformation Type Group
Expression Passive Single
HTTP Passive One input and one output
Java Active or passive One input and one output
Lookup Passive Single
SQL Active or passive One input and one output
Stored Procedure Passive Single

The transformation you use to generate a web service mapping must be a reusable transformation. When you generate a web service mapping based on a transformation, the Designer lists the reusable transformations and shortcuts to reusable transformations available in the folder.

When you generate a web service mapping from a transformation, the Designer uses the ports in the transformation to define the columns for the source and target definitions. It then creates a mapping that contains a source with XML views that reflect the transformation input ports and a target definition with XML views that reflect the transformation output ports.

The web service mapping generated from a transformation contains the following objects:-

Web service source definition
Source qualifier
Transformation used to generate the mapping
Web service target definition

The Designer links the ports from the source instance through the target instance.

Generating a Mapping from a Mapplet:-

You can generate a web service mapping from the following types of mapplets:

Mapplets that contains one input transformation and one output transformation
Mapplets that contains no active transformation

When you generate a web service mapping from a mapplet, the Designer lists the mapplets and shortcuts to mapplets that are permitted for the process.

When you generate a web service mapping from a mapplet, the Designer uses the ports in the mapplet to define the columns for the source and target definitions. It then creates a mapping that contains a source with XML views that reflect the mapplet input ports and a target definition with XML views that reflect the mapplet output ports.

The web service mapping generated from a mapplet contains the objects:

Web service source definition
Source qualifier
Mapplet used to generate the mapping
Web service target definition

The Designer links the ports from the source instance through the target instance.

Generating a Mapping from a Reusable Transformation or a Mapplet :-

You use the same procedure to generate a web service mapping from a reusable transformation or from a mapplet.

To generate a web service mapping from a reusable transformation or mapplet:

1.
In the Mapping Designer, click Mappings > Create Web Service Mapping > Use Transformation/Mapplet definitions.
2.
Select the transformation or mapplet you want to use for the web service mapping.

The Designer displays the list of input ports and the datatype, precision, and scale.

You can specify whether the columns in the source and target definitions in the mapping occur once or multiple times.

3.
If the columns occur multiple times, select Source and Target are Multiple Occurring Objects.

This option indicates that the columns in the source and target are arrays. The columns as a group occur multiple times.

4.
To add message and client ports to the source or target definition, click Add Message Ports.

The Designer adds the message and client ports to the envelope view of the source and target definitions.

5.
Click OK.

The Designer creates the web service mapping and displays a message that the mapping was created successfully. It uses the transformation or mapplet name as the name of the source and target definitions prefixed with m_. It adds the suffixes _input to the source definition name and _output to the target definition name.

Your comments are always welcome here ….                                                                                                 Skip to top

Mehboob

MCTS – BI

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s