Tutorials for Trading Partner Integration
|
|
|
The ebXML language (Electronic Business using eXtensible Markup Language) is a business protocol that enables enterprises to conduct business over the Internet. WebLogic Workshop uses ebXML controls for initiator processes and ebXML Participant Business Processes templates for participant processes to build business processes systems which exchange ebXML business messages between trading partners. The ebXML control provides the initiator business process with predefined customizable methods for sending and receiving ebXML messages in a conversation. The ebXML Participant Business Process template provides a head start for building public participant business processes for ebXML conversations. Although the template is not required to build ebXML participant business processes, it includes the nodes and business process annotations needed to integrate easily with ebXML initiator business processes. The purpose of this tutorial is to demonstrate the different options available for ebXML trading partner management in WebLogic Workshop and WebLogic Integration.
This topic describes tasks that you should perform before you begin using this tutorial. It contains the following sections:
To use this tutorial, you must have:
To gain a detailed understanding of how ebXML solutions are implemented in WebLogic Integration, consider reading the following material:
To learn how to build business processes and create data transformations in WebLogic Workshop, consider completing the following tutorials:
In this tutorial, the first couple of examples contains detailed instructions of how to use the WebLogic Workshop user interface and the WebLogic Integration Administration Console user interface to perform the steps outlined in the example. The preceding examples build on the skills you learn in the first couple of sections, but do not outline the steps in quite as much detail.
The tutorial is organized into these parts:
This section describes how to create the business process application in which you will create the business processes and other components required for the examples of the tutorial. It also describes how to import the sample data and schemas which are included in the zipped archive of the tutorial files.
Step 2: Sending an XML Message through an One-Way ebXML Exchange
This example demonstrates how to send an XML message from one trading partner to another through a simple one-way ebXML exchange. In this example, you will learn how to create participant and initiator business processes as well as, how to create and configure ebXML and file controls. The section also contains a detailed description of how to deploy and test business processes using the WebLogic Workshop Test Browser.
Step 3: Selecting the Trading Partner Information Dynamically Through Typed XML
This example is similar to the preceding one except for that this example demonstrates how to specify the trading partner information dynamically by using an XQuery selector, rather than specifying it statically in the ebXML control. It also describes how to configure the ebXML control to use typed XML data and specific method names.
Step 4: Sending Raw Data (Binary File) Through an ebXML Exchange
In this example, you learn how to use ebXML to send binary data between two trading partners through a Message Broker channel.
This section describes how to implement an ebXML conversation in which when a request message (order) is received, a response (invoice) message is sent back by adding a Client Response node to the participant business process and using the ebXML control callback feature to send the response message.
This example illustrates how to use subprocesses to implement the public/private pattern. The public/private pattern can be used to keep the details of backend integration contained to a private process definition, while the public process definitions are dedicated to trading partner interaction.
In this section, you learn how to at run time obtain trading partner information from the TPM repository. You also learn how to use the onAck callback of the ebXML control.
Step 8: Setting Partner ID Dynamically Based on Directory Name
In this example, you investigate the already built application included with the tutorial files to learn how to read the name of a sub-directory and use that as the partner ID. The business process sets the partner ID dynamically using the setProperties method included in the ebXML control.
This example briefly explains how to move to a distributed setup where one trading partner operates in one WebLogic Integration instance while the other trading partner operates in another instance. This is the setup that you would use in a production scenario where the two trading partners are running on two physically separated systems.
In this section you will learn how to add a service and a service profile in the WebLogic Integration Administration Console, which will give you control over trading partner communications.
Step 11: Exchanging Messages with WebLogic Integration - Business Connect
This example describes how to send messages between WebLogic Integration and WebLogic Integration - Business Connect. WebLogic Integration - Business Connect is a separate application which enables you to securely exchange large volumes of documents with your trading partners. You must have a current license of WebLogic Integration - Business Connect to be able to complete this example.
Before you start the ebXML tutorial, you have to complete the procedures described in Setting Up the Tutorials. If you have not yet completed these procedures, please do so before proceeding with this section.
In this step, you use WebLogic Workshop to create application, in which you build the ebXML tutorial business processes. You then import the sample data and schemas provided in the zipped archive that came with the tutorial files (see, Step 3: Install the Tutorial Files). The sample data and schemas are used to illustrate the functionality of the ebXML tutorial examples. Lastly, you create two directories on your hard drive which are used throughout the tutorial to read files from and to write files to.
This section contains the following procedures:
WebLogic Integration extends the WebLogic Workshop to allow the building of integrated enterprise applications. An application in turn contains projects and files. A project can contain several components including, business processes, Web services, and XML files. In this section, you will create the Business Process Application in which you will later build the ebXML tutorial processes and process components.
Start
If this is the first time WebLogic Workshop is started since it was installed, the samples project, which contains sample services installed with WebLogic Workshop, is displayed. Otherwise, the project which was opened last is displayed.
C:\myapps\tptutorialapps. If you create the directory in a different location or use another name, adjust the instructions accordingly.The Application pane displays a hierarchical representation of the files and resources available in your application. The components we will work with in this tutorial includes the following:
ebXMLWeb—A Web application project folder. Every application contains one or more projects. Projects represent WebLogic Server Web applications. In other words, when you create a project, you are creating a Web application. (The name of your project is included in the URL your clients use to access your application.)
Web Applications are J2EE deployment units that define a collection of Web resources such as business processes, Web services, JSPs, servlets, HTML pages, and can define references to external resources such as EJBs.
Note: The Web application project folder is named by appending Web to the name you gave your application.
Schemas—A Schemas project that contains the XML Schemas and the Message Broker channel file used in the application. It also contains ebXML envelope schemas that are used to package ebXML messages.
You have now completed the first step in this tutorial and are ready to start creating the tutorial ebXML business processes. For more information about business process applications, see Guide to Building Business Processes available at: http://edocs.bea.com/workshop/docs81/doc/en/integration/wfguide/wfguideIntro.html
In this tutorial, we use sample data files to send in the ebXML messages. You can use your own XML data files if you wish, but some sample data files have been provided for you in the tptutorial.zip archive that you downloaded from the http://dev2dev.bea.com web site (see, Step 3: Install the Tutorial Files).
[unzip location]\tptutorialapps\ebxml\ebxmlWeb\sampledata where [unzip location] is the directory to which you unzipped the files from the tptutorial.zip (see, Step 3: Install the Tutorial Files).Note: Instead of the preceding steps, you could simply drag and drop the sampledata folder from any file browser directly into your Application pane in Weblogic Workshop.
In this tutorial, specific schemas are used for the XML data that is sent by the ebXML messages. This section describes how to import the schemas into your schemas folder in your ebXML application.
[unzip location]\tptutorialapps\ebxml\Schemas. Where [unzip location] is the directory to which you unzipped the files from the tptutorial.zip file (see,Step 3: Install the Tutorial Files).When a XSD or MFL file is imported, a build of the current Schemas project folder is triggered. (The build verifies that the schema file is well formed. For XSD files, it also verifies that the element and attribute names in the XML Schema do not conflict with the XSD files that have already been imported into the current Schemas project folder.) For more information about what gets generated when you import schemas, see Importing Schemas available at http://edocs.bea.com/workshop/docs81/doc/en/integration/dtguide/dtguidemapperimportschemas.html.
To demonstrate how messages can be exchanged by ebXML, several of the examples in this tutorial write out files to and read files from directories on your hard drive. Before you start working with any of the examples in this tutorial, create the following two directories on your hard drive:
Note: This is assuming that you created your application in Creating the Business Process Application on the C drive. If you created the application on another drive, please place the above directories at the root level of that drive.
In this example, you will learn how to send an XML message from one trading partner to another using ebXML. Imagine that one of the trading partners is accepting and processing orders. We refer to this partner as the seller and it is the participator of the ebXML conversation. The other trading partner, which we call the buyer, sends an XML order to the seller. The buyer is the initiator of the conversation. The seller accepts the message and simply writes it out to a file. This section contains the following procedures:
The Seller business process is the participator of our ebXML conversation. When building ebXML participator processes, you can use the ebXML Participant Process file which comes pre-configured with the nodes, variables, and other components necessary for building participants processes. In this example, you add a File control to the business process which writes the test data out to a file located on your hard drive. This section includes the following tasks:
The New Folder dialogue opens.
Note: If the Application pane is not visible in WebLogic Workshop, choose View
A new ebXML participant process file is created in your oneway folder in the Application pane and is displayed in Design View.
The ebXML participant process file is created pre-configured with the nodes and business process annotations needed to integrate easily with ebXML initiator business processes. For more information about ebXML participant process files, see Building ebXML Participant Business Processes available at http://edocs.bea.com/workshop/docs81/doc/en/integration/wfguide/wfguideEbXML.html.
In this example, instead of responding to the buyer process, we add a File control which will write out the incoming ebXML messages to a file. This File control is then added to the business process as a Control Send with Return node.
The File control instance is added to your list of controls in the Data palette, and a JCX file corresponding to the File control is added to the Application palette. For more information about File controls, see File Control available at http://edocs.bea.com/workshop/docs81/doc/en/integration/controls/controlsFile.html. For more information about JCX files, see JCX Files: Extending Controls available at http://edocs.bea.com/workshop/docs81/doc/en/workshop/guide/devenv/conJwiFiles.html.
A new Control Send with Return node named write is added to your business process. For more information about Control Send with Return nodes, see Interacting With Resources Using Controls available at http://edocs.bea.com/workshop/docs81/doc/en/integration/wfguide/wfguideControls.html.
The next step in our procedure is to configure the Control Node we just created with the correct variables and method assignments.
Your seller side ebXML process is now complete. The process is invoked when an XML message is received from the Buyer initiator process by the Receive request node, the Receive request node assigns the XML to a variable, and the write node writes the XML message to a file named order.xml via the File control.
Note: The grey check box icon is there because the receive data tab of the node has not been configured which marks the node as incomplete. However, since the example is not receiving any data, no more configuration is necessary for the business process to run properly.
The ebXML binding information and service name of the business process is displayed in the Property Editor in Source View. To view these properties:
public class Seller implements com.bea.jpd.ProcessDefinition to display the Property Editor for the Seller class.eb:Service entry in the ebXML message envelope. It is also the name used by the initiator business process as the ebXML service name. This is the name that trading partners will use to identify this service, it also matches the initiator process with the participant process.For more information about Source View ebXML process annotations, see @jpd:ebxml Annotation available at http://edocs.bea.com/workshop/docs81/doc/en/integration/javadoc-tag/jpd/ebxml.html.
We are now ready to test the Seller business process. WebLogic Workshop provides a browser-based interface through which you can test the functionality of your business process. Using this Test View interface, you play the role of the client, invoking the business process's methods and viewing the responses.
If WebLogic Server is running, the following indicator is visible in the status bar at the bottom of the WebLogic Workshop visual development environment:
WebLogic Workshop builds your project. If there are no errors in the project, a Web browser is launched to display the Workshop Test Browser, through which you can test your business process using sample input values.
Note: It may take a while before the Test Browser window is launched after the application has completed the built process.
C:\myappstptutorialapps\ebXML\ebXMLWeb\sampledata\sampleorder.xml.C:\myapps\tptutorialapps\ebXML\ebXMLWeb\sampledata\sampleorder.xml, except for the first line of the file, into the xml variable (payload) field.It now contains a file named order.xml with identical content to that of sampleorder.xml. This file was written by the File control that you created and configured in the section To Create the Seller Business Process File.
For more information about the different options in the Test Browser and how to use it to test your business processes, see Running and Testing Your Business Process available at http://edocs.bea.com/workshop/docs81/doc/en/integration/wfguide/wfguideTest.html.
Your Seller business process is now deployed and ready to accept ebXML messaged. By default the protocols specified in the default ebXML 2.0 binding will be used, so no additional configurations are required. In production scenarios however, you typically create a TPM service profile using the WebLogic Workshop Administration Console. For more information about creating service profiles, see Adding Service Profiles to a Service in Trading Partner Management (available at http://edocs.bea.com/wli/docs81/manage/tpm.html) in Managing WebLogic Integration Solutions.
The Buyer business process is the initiator of our ebXML conversation. After creating the Buyer business process, we will use an ebXML control to communicate with the Seller participator business process. This section contains the following procedures:
Since we are creating a initiator business process file this time and will use a ebXML file control to communicate with the participator process, we will create a default process file rather than an ebXML participant process file.
We will now configure the Client Request node with the correct methods and variable types.
Your Client Request node is completed. To learn more about Client Request nodes, see Receiving Messages From Clients available at http://edocs.bea.com/workshop/docs81/doc/en/integration/wfguide/wfguideClientsReceiveNode.html. To learn more about variables and data types, see Working with Data Types available at http://edocs.bea.com/workshop/docs81/doc/en/integration/wfguide/wfguideDataTypesWorking.html.
It is now time to add the ebXML control which will be used to communicate with the Seller process. This control represents what would normally be the remote service we are trying to contact, although in this example, the service runs on the same machine as the Buyer process.
eb:Service entry in the ebXML message envelope.The ebXML control instance is added to your list of controls in the Data palette, and a JCX file corresponding to the ebXML control is added to the Application palette. You can double-click on the JCX file to open it in Design View and review the values which you just entered. For more information about ebXML controls, see ebXML Control. available at http://edocs.bea.com/workshop/docs81/doc/en/integration/controls/controlsebXML.html. For more information about JCX files, see JCX Files: Extending Controls available at http://edocs.bea.com/workshop/docs81/doc/en/workshop/guide/devenv/conJwiFiles.html.
void request(XmlObject payload)method. The name of the method on this control must match the method name of the Receive request node in the participant process.A new Control Send node named request is added to your business process. For more information about Control Send nodes, see Interacting With Resources Using Controls available at http://edocs.bea.com/workshop/docs81/doc/en/integration/wfguide/wfguideControls.html.
We will now configure the request node with the correct variable assignment.
Your buyer side ebXML process is now complete. The process sends a message to the Seller business process which is then written to a file named order.xml via the File control in the Seller process.
This part of the tutorial is now complete. You have successfully sent an XML message over ebXML from one trading partner to another. The participant (Seller) process wrote the XML out to the file system.
In this example we build on what you learned in the previous exercise, Step 2: Sending an XML Message through an One-Way ebXML Exchange. You will learn how to specify the trading partner information dynamically using an XQuery selector rather than specifying it statically in the ebXML control. Then you will customize the ebXML control in the initiator (buyer) process and the participant process file (Seller) to use typed XML and business specific method names.
This step contains the following procedures:
In this procedure, you create an ebXML participant business process which will accept typed XML data instead of the XmlObject variable you used in the previous example's participant process. This section contains the following tasks:
The next step involves configuring the Receive request node to accept XML data of a type that is specified in the Schemas which you imported into your application in Importing the Tutorial Schemas.
Your Client Request node is completed. To learn more about Client Request nodes, see Receiving Messages From Clients available at http://edocs.bea.com/workshop/docs81/doc/en/integration/wfguide/wfguideClientsReceiveNode.html. To learn more about variables and data types, see Working with Data Types available at http://edocs.bea.com/workshop/docs81/doc/en/integration/wfguide/wfguideDataTypesWorking.html.
As in the previous example, you will add a file control to the business process file, which will write the order variable out to a file.
Refer to the instructions in To Create the File Control and the Control Node to create a new File control. To save time, you can also drag and drop File.jcx from the \ebxml\oneway folder in the Application tab directly on to the Design View of the SelectorSeller. The control definitions you created earlier will be reused in a new instance for this business process.
This concludes the creation of the SelectorSeller business process.
You are now ready to go on and create a SelectorBuyer initiator process.
For the initiator process in this example you use an XQuery selector to retrieve the trading partner ID dynamically rather than specifying it statically in the ebXML control as done in the previous example. This section contains the following tasks:
Create a business process file named SelectorBuyer.jpd in the selector folder by following the instructions in To Create the Buyer Business Process File.
Your Client Request node is completed. To learn more about Client Request nodes, see Receiving Messages From Clients available at http://edocs.bea.com/workshop/docs81/doc/en/integration/wfguide/wfguideClientsReceiveNode.html. To learn more about variables and data types, see Working with Data Types available at http://edocs.bea.com/workshop/docs81/doc/en/integration/wfguide/wfguideDataTypesWorking.html.
In the next step you add a ebXML control and configure this control with an XQuery selector.
eb:Service entry in the ebXML message envelope.The ebXML control instance is added to your list of controls in the Data palette, and a JCX file corresponding to the ebXML control is added to the Application palette. You can double-click on the JCX file to open it in Design View and review the values which you just entered. For more information about ebXML controls, see ebXML Control available at http://edocs.bea.com/workshop/docs81/doc/en/integration/controls/controlsebXML.html. For more information about JCX files, see JCX Files: Extending Controls available at http://edocs.bea.com/workshop/docs81/doc/en/workshop/guide/devenv/conJwiFiles.html.
You will now modify the control definition file of the ebXML control. In the next section, you change the method name, change the message type, and add an XQuery selector.
The method name now matches the name of the method on the participant business process. This method name corresponds to the eb:Action element in the ebXML message envelope.
This ebXML control is now set up to use XML typed according to the schema you imported in To Import the Tutorial Schemas rather than generic untyped XML.
The ebXML control is now configured to pick out the trading partner ID from the message according to the specifications of the XQuery statement you generated in the selector. The next step is to add a processOrder Control Send node to the business process.
void processOrder(OrderDocument payload) method. The name of the method on this control must match the method name of the Receive request node in the participant process.A new Control Send node named processOrder is added to your business process. For more information about Control Send nodes, see Interacting With Resources Using Controls available at http://edocs.bea.com/workshop/docs81/doc/en/integration/wfguide/wfguideControls.html.
This concludes the creation of the SelectorBuyer business process. In this section, you learned how to customize the participant and initiator processes to use typed XML and custom method names. You also learned how to use and XQuery selector to extract the target trading partner ID form the payload message rather than declaring it statically. The next section describes how to test your business processes.
In this example, we will use ebXML to send binary data between two trading partners through a Message Broker channel. This example builds on the examples describes in previous sections. If at any time you need more information about how to complete a task that was previously explained, refer back to the preceding sections. This section contains the following procedures:
This example builds on what you have learned in the previous examples. If at any time you need more detailed instructions, refer back to Building the Seller Business Process. This section contains the following tasks:
For the initiator side of this example, the process will look very similar to those in previous examples, except that it will be invoked through a subscription to a file event which will cause the process to pick up a file from a directory. This section contains the following tasks:
Use the instructions outlined in detail in Building the Buyer Business Process to complete the following tasks:
Before you can start to configure the Message Broker Subscription node, you need to create a subscription channel file to which the subscription node can listen for events.
The sample channels defined in the file are now available for selection in the subscription node. For more information about channels, see Publishing and Subscribing to Channels available at http://edocs.bea.com/workshop/docs81/doc/en/integration/howdoI/howPubSub.html.
You have now completed the configuration of your subscription node. To learn more about subscription nodes, see Subscription Start (Asynchronous) available at http://edocs.bea.com/workshop/docs81/doc/en/integration/wfguide/wfguideStartSub.html and Subscription Start (Synchronous) available at http://edocs.bea.com/workshop/docs81/doc/en/integration/wfguide/wfguideStartSyncSub.html.
In the next section, you create a ebXML control to be used to communicate with the participator business process.
The BinaryBuyer business process is now complete, run and test it to ensure that it is working properly.
Note: Before you test your business process, make sure that you have completed the To Create the Channel File section. If you do not create a channel file before testing the process, you will encounter an error.
In this section you create the file event which will invoke the BinayBuyer business process when a raw data type file is dropped in a directory.
You have completed creating the File Event. For more information about the WebLogic Administration Console and Event Generators, see Event Generators available at http://edocs.bea.com/wli/docs81/manage/evntgen.html.
Note: About Message Tracking: In this and previous examples, all messages sent via ebXML are tracked in the tracking database. In the WebLogic Administration Console, navigate to Trading Partner Management
This example illustrates how to implement an ebXML conversation in which a request message (order request) is followed by a response message (invoice). The first part of the conversation is identical to the one-way scenario you developed earlier. In this example, you add a Client Response node to the participant business process and use the ebXML control callback for the response message. This section contains the following procedures:
This example builds on the previous examples that you have completed. If at any time you need more detailed instructions, refer back to Building the Seller Business Process to complete the following sections:
For illustration purposes, this example simplifies the order/invoice process.The seller will again write the incoming order out to file and for the response, the seller will read an invoice document from the file system. The invoice will be the same for each order. In production scenarios, the seller process could instead read the information from a database, obtain it from a message queue, or get it from a backend application as an event from an Application View control. The process could also delegate processing of the order to a subprocess, which is illustrated in the next example Step 6: Implementing the Public/Private Pattern. For more information about Application View controls, see Application View Control available at http://edocs.bea.com/workshop/docs81/doc/en/integration/controls/controlsAppView.html.
Note: To save time, you can drag and drop the File.jcx in the oneway folder onto the RoundtripSeller.jpd Design View. This will create a new instance of the File.jcx.
C:\myapps\tptutorialapps\ebxml\ebxmlWeb\sampledata\sampleinvoice.xml to the C:\tptutorial\invoice directoryC:\tptutorial\invoice directory by using the following configurations:The method expects untyped XML (XmlObject) but our invoice.xml file contains typed XML so we will need to do a simple transformation between the two.
The transformation you created in the preceding steps, only transforms from one data type to another. In production scenarios, you would use the Transformation Tool to convert from the backend system format to the format expected by the trading partner. You can also use the Transformation Tool to manipulate data. For more information about the Transformation Tool, see Guide to Data Transformation available at http://edocs.bea.com/workshop/docs81/doc/en/integration/dtguide/dtguideIntro.html.
The next step in this example is to configure the Respond to request node.
You have completed building the seller (participant) side of this example. The seller will receive an order document from the buyer, write it out to file, read in an invoice file and send it to the buyer. The name of the ebXML service created for this transaction is RoundtripSeller. The message exchange will be carried out as a single ebXML conversation. The Trading Partner Integration (TPI) system automatically manages the ebXML conversation and ensures that the same conversation ID is used within the same participant process instance.
Testing the process at this point would create an exception on the callback method since you have not yet created the initiator process. That is why you only deploy the process so that it will run properly when you test the initiator process later on.
This section builds on the tasks that you have learned in previous examples. If at any time you need more detailed descriptions, refer back to Building the Buyer Business Process while completing the following tasks: