- B2B Requirements
- ebXML Concepts
- Web Services Architecture Defined
- Sample B2B Collaborative Prototype
- About the Author
- Acknowledgements
- Related Resources
- Ordering Sun Documents
- Accessing Sun Documentation Online
Sample B2B Collaborative Prototype
This section describes how you can implement a B2B relationship using ebXML. Throughout this paper, we have discussed the requirements of B2B systems and we have described how Web services technologies can advance the development of these solutions over the Internet. In addition, a detailed review of the Web services technologies and architectures has been presented. This section puts these technologies into practice and describes the construction of a prototype that leverages Web services technologies. The prototype is based on an actual implementation at a large automotive dealer and was built using a combination of tools from Sun Microsystems and Sybase.
FIGURE 6 depicts the flow of events in the ebXML Sun ONE Application Server B2B collaboration prototype. A description of this graphic, starting from the top, follows.
FIGURE 6 ebXML Prototype Implementation Flow Chart
Model process. This prototype used a graphical UML modeling tool from Together Soft, though other UML modeling tools can work, too.
Create BPSS and CPA ebXML documents. Power-Designer from Sybase was used in this prototype to create the BPSS and CPA ebXML documents.
Create BPSS. The graphical modeling tool automatically generates the BPSS document, which is stored in a shared ebXML Registry.
Create CPA. Accomplished with a form-based UI, this document is stored in a shared ebXML Registry.
Get documents. BPSS and CPA are obtained from the shared ebXML Registry using a graphical UI client.
Negotiate CPP. In this iteration of the prototype, we assumed trading partner templates would define how to trade with the sample partners. Partners who wanted to interact with other partners would have to support the CPA as mandated. The document should be stored in a shared ebXML Registry.
Configure MSH. This task typically entails the installation of BPSS and CPA documents into the particular MSH implementation being used by the trading partners.
Initiate trading process. Accomplished at the BBB Auto Sales side (see FIGURE 7 on page 27), using a simple JSP-technology based form. In a real situation, it could be triggered by the trading partner's back-office systems.
Transact over BPSS and MSH. This involves sending and receiving ebXML messages (and related payloads) according to BPSS and CPA specifications.
Execute Web services. Various Web services are invoked automatically to illustrate how back-end fulfillment can be accomplished.
Issue requests. Simple forms created using JSP technology are used to review transaction results (such as Available Vehicle Response to a query) and initiate the next part of the business process on the BBB side. The prototype does this to better demonstrate the trading process. In a real-world implementation, many of these requests would be issued automatically by the trading partner's back-end systems.
Monitor transactions. ebXML transactions are monitored in real time during the prototype.
Creating a Trading Partner Agreement
The CPA is responsible for defining and tying together all of the messaging details required between two parties. The goal for this scenario is to create a bulk buying collaboration. While in some scenarios, a CPP is used to describe the partner's capabilities, this scenario used a template. Unlike two ad hoc trading partners who need CPPs to arbitrate how they can do business together, in this Sun ONE Application Server B2B collaboration prototype, a template CPA was created that mandated how trading partners would conduct business.
The bulk buying business activity contains a number of different business transactions, such as Check Vehicle Availability, Dealer Location, Vehicle History, and so on. The transactions are carried out using XML DTDs, because the STAR BODs were not available during the design of this project.
FIGURE 7 Trading Partner AgreementCPA
Note that the code snippet included here represents a small portion of the CPA. It is intended to convey a glimpse of what the XML structure for the CPA specification is and the core concepts around how a CPA defines the parameters in a trading partner agreement. The snippet contains time-outs, reliability, and security tag samples.
<!-- BTA Name = "Available Vehicle Activity" --> <tp:CanReceive> <tp:ThisPartyActionBinding tp:id="action_A01" tp:action="Available Vehicle Activity" tp:packageId="N0402"> <tp:BusinessTransactionCharacteristics tp:isNonRepudiationRequired="false" tp:isNonRepudiationReceiptRequired="false" tp:isSecureTransportRequired="false" tp:isConfidential="none" tp:isAuthenticated="none" tp:isTamperProof="none" tp:isAuthorizationRequired="false" tp:timeToAcknowledgeAcceptance="P2D" tp:timeToAcknowledgeReceipt="P2D"/> <tp:ActionContext tp:binaryCollaboration="Bulk Buying" tp:businessTransactionActivity="Available Vehicle Activity" tp:requestOrResponseAction="VehiclesAvailableRequest"/> <tp:ChannelId>N04</tp:ChannelId> </tp:ThisPartyActionBinding> <tp:OtherPartyActionBinding>action_B01</tp:OtherPartyActionBinding> <tp:CanSend> <tp:ThisPartyActionBinding tp:id="action_A02" tp:action="Available Vehicle Activity" tp:packageId="N0402"> <tp:BusinessTransactionCharacteristics tp:isNonRepudiationRequired="false" tp:isNonRepudiationReceiptRequired="false" tp:isSecureTransportRequired="false" tp:isConfidential="none" tp:isAuthenticated="none" tp:isTamperProof="none" tp:isAuthorizationRequired="false" tp:timeToAcknowledgeAcceptance="P2D" tp:timeToAcknowledgeReceipt="P2D"/> <tp:ActionContext tp:binaryCollaboration="Bulk Buying" tp:businessTransactionActivity="Available Vehicle Activity" tp:requestOrResponseAction="VehiclesAvailableRespond"/> <tp:ChannelId>N04</tp:ChannelId> <tp:OtherPartyActionBinding>action_B02</tp:OtherPartyActionBinding> </tp:CanSend>
Creating the BPSS
PowerDesigner from Sybase was used to graphically lay out and define business activity, and to map concepts together. PowerDesigner and similar tools enable developers to create libraries of activities that can be used to execute different scenarios. Each of these objects is reusableafter an object has been developed, it can be used in other scenarios or services, shortening future development projects. After the process has been defined, the tool programs the BPSS engine to execute the expected choreography.
Figure 7 is a logical description of the BPSS document responsible for implementing business process choreography in this RI. The state diagram describes the flow of the ebXML business transactions that are mapped to back-end Web services. B2B collaboration is composed of several business transactions, and the resulting sequence is captured in a BPSS.
To implement this scenario, an ebXML BPSS document is built describing the business process choreography between the deployed Web services. This BPSS is referenced from the template CPA. Messages are exchanged using the Sybase New Era's MSH implementation. Documents are stored and retrieved from the open source ebXML Registry implementation, and the business process choreography is navigated through the New Era Networks process engine.
FIGURE 8 BPSS Choreography
Note that the code snippet included here is intended to convey the core concepts around creating a BPSS document. It includes state transition representation, time-outs, and error handling.
<BinaryCollaboration name="Bulk Buying"> <InitiatingRole name="BulkUsedCarBuyers"> </InitiatingRole> <RespondingRole name="General Motors"> </RespondingRole> // Define the TransactionActivity <BusinessTransactionActivity name="VehiclePurchase Approval Activity" businessTransaction="VehiclePurchaseApproval" fromAuthorizedRole="General Motors" toAuthorizedRole="BulkUsedCarBuyers"> </BusinessTransactionActivity> <BusinessTransactionActivity name="Dealer Location Activity" businessTransaction="Dealer Location" fromAuthorizedRole="BulkUsedCarBuyers" toAuthorizedRole="General Motors"> </BusinessTransactionActivity> ... //Build the Error Handling <Start toBusinessState="Available Vehicle Activity"/> <Success fromBusinessState="VehiclePurchase Approval Activity" conditionGuard="Success"> </Success> <Failure fromBusinessState="VehiclePurchase Approval Activity" conditionGuard="BusinessFailure"> </Failure> //Build the state Transitions <Transition fromBusinessState="Available Vehicle Activity" toBusinessState="Dealer Location Activity" conditionGuard="Success"> </Transition> <Transition fromBusinessState="Dealer Location Activity" toBusinessState="Vehicle History Activity" conditionGuard="Success"> </Transition> // Build into the BPSS a way to define the messages and timeouts <BusinessTransaction name="Vehicle History"> <RequestingBusinessActivity name="VehicleHistoryRequest" timeToAcknowledgeAcceptance="P2D" timeToAcknowledgeReceipt="P2D"> <DocumentEnvelope businessDocument="VehicleHistoryQueryDocument"> </DocumentEnvelope> </RequestingBusinessActivity> <RespondingBusinessActivity name="VehicleHistoryRespond" timeToAcknowledgeReceipt="P2D"> <DocumentEnvelope businessDocument="VehicleHistoryResponseDocument"> </DocumentEnvelope> </RespondingBusinessActivity> ./// <BusinessTransactionActivity name="Dealer Location Activity" businessTransaction="Dealer Location" fromAuthorizedRole="BulkUsedCarBuyers" toAuthorizedRole="General Motors">
Reliable Messaging
Business transactions define reliable messaging exchange between two trading partners using acknowledgments, error handling, logging, and roles. MSH enables reliable messaging for this scenario. For each business transaction in the BPSS document, a unique configuration of reliable messaging can be configured. Sybase's PowerDesigner allows developers to drill down on any step in the BPSS flow and define the reliability details. FIGURE 9 on page 32 shows how the document reliability is defined from a trading partner's RequestAvailableVehicle to the local RespondAvailableVehicle, where it is separately acknowledged for both receipt and acceptance. When the information is returned from RespondAvailableVehicle to RequestAvailableVehicle, an acknowledgment receipt is sent.
FIGURE 9 Messaging Reliability
Federating ebXML to Web Services
Up to this stage, the entire application layer consists of XML documents created through a graphical user interface (GUI) tool. Thus, no coding has been required. In this stage, we are mapping our public interface to our private interface and mapping code in Java. Down the road, it is expected that mapping tools will be able to generate most of this code, just as Toplink provided a mapping layer for databases.
After a relationship between trading partners has been established and a BPSS conversation has been initiated, BPSS choreographs back-and-forth communication of information between the two parties, a request will be made to back-end enterprise services at each trading partner. To retrieve the enterprise data a mapping from the public to the private interface is required. Typically, business analysts map B2B transactions to the services available in the back-end SOA. For example, the DealerLocation activity is mapped to the DealerLocater Web service.
FIGURE 10 on page 33 illustrates how XML messages, which are used to communicate between trading partners, are federated to the private back-end systems within a company. The blue represents business activities from the public interface, while orange is the fa_de to private back-end Web service implementations.
FIGURE 10 Mapping Business Activity To Back-End SOAP Objects
For example, DealerLocationActivity is mapped to DealerLocator, a SOAP-based application behind the enterprise private interface. The DealerLocator function is an EJB component exposed as a Web service. BPSS calls a message-driven bean, which calls and maps the available dealer information to the DealerLocator input. BPSS is also configured to handle any exceptions.
Note that the code snippet included here is intended to convey the core concepts around the mapping layer. The mapping component is an MDB in the application server that receives an ebXML message, saves off the header information, then formulates and executes a SOAP call. Once the synchronous response is returned, the MDB makes a JAX-M call back to the ebXML infrastructure.
package xx.vehicle.mdb; public class XXBulkBuyingMDB implements MessageDrivenBean, MessageListener { ... public void onMessage(Message msg) { // Routing Ids that are used: Properties msgProps = BpioUtils.jmsToProps(msg); String msgId = msg.getStringProperty(BISConst.MESSAGEID); String refMsgId = msg.getStringProperty(BISConst.REF_TO_MESSAGEID); String cpaId = msg.getStringProperty( BISConst.TPAID); String conversationId = msg.getStringProperty( BISConst.INSTANCEID); String fromPartyId = msg.getStringProperty( BISConst.FROM_PARTY); String toPartyId = msg.getStringProperty( BISConst.TO_PARTY); String service = msg.getStringProperty( BISConst.SERVICE); String action = msg.getStringProperty( BISConst.ACTION); // Map to and call different web services based on the action else if (action.equals("Vehicle History Activity")) { String text = tm.getText(); VehicleHistoryQuery vhq = new VehicleHistoryQuery(); String retProps = vhq.run(text); content = retProps.getBytes(); else if (action.equals("Vehicle Purchase Request Activity")) { String text = tm.getText(); PurchaseRequest vhq = new PurchaseRequest(); String retProps = vhq.run(text); ... // Return the results to the Process Server to find the next step in BPSS client.send(dCont, null, retProps, EBXMLClientConst.SENDREQUEST_ACTION); ... } ... ... The run method of each service makes the WSDL call // Making the web service call for Vehicle History Web Service VehicleHistory vh = vPort.getVehicleHistory(vin); ServiceRecord srs[] = vh.getRecords();
Finally, both the public and the private interface details of the Sun ONE Application Server B2B collaboration prototype system are shown in FIGURE 11. The diagram addresses both the run-time and design-time infrastructure, as well as the architectural details.
FIGURE 11 Logical View of Public and Private Interfaces
The preceding graphic illustrates how ebXML technology facilitates the collaborative public side of the relationship, while Web services are used as an interface to private back-end systems. The following tasks are shown in the orange boxes on the left:
CPAs and BPSS documents are published on the ebXML Registry.
Available trading partners look up the CPA and BPSS.
Offline negotiations such as legal contracts are finalized.
BPSS orchestrates electronic activity.
The yellow boxes on the right represent Web services. These services are either a fa_de to J2EE applications, other enterprise applications or services, or legacy applications of data through a Web service interface.
Available back-end services are resources published in a ebXML Registry.
Web services are retrieved from the ebXML Registry.
Back-end business processes are built and exposed through the Web services fa_de.
The Web services fa_de provides an abstraction to the choreography of back-end Web services.
The overall design highlights two concepts. The first is the declarative nature of how businesses communicate with each other. Using XML documents on top of a standardized infrastructure, trading partners can publish, discover, negotiate, and transact business. A private SOA can be extended to a public interface, enabling businesses to connect existing IT systems to others using open and standardized technologies and protocols.
Second, existing back-end applications and services can be exposed as new services. Process engines or services fa_des choreograph Web services (or proprietary applications abstracted as Web services) into business processes. Developers and business analysts can build and architect both internal and external services, in most cases without writing code.
In this Sun ONE Application Server B2B collaboration prototype, WS-I BP, and ebXML technology provide complementary services and a federated approach to leverage the strengths of each set of standards. The ebXML provides the business-to-business (public) interface that connects trading partners, enabling them to find each other, then negotiate and collaborate in a reliable, secure way. WS-I BP specifications provide the abstraction and choreography of the back-end enterprise services.
As the XML standards, their implementations, and tools evolve, it is expected that the days of proprietary customized point-to-point application development, which give way to the trend of open, standardized, collaborative B2B solutions over the Internet.