Showing posts with label bpel. Show all posts
Showing posts with label bpel. Show all posts

Tuesday, July 17, 2007

How to inject xml fragments into Netbeans BPEL Editor

Some JBI components, such as the RSS Binding Component, require specific inputs that are complex types verses simple types like xsd:string. For example when wishing to subscribe to multiple feeds at one time you need to specify an EndpointReferenceList which extends the WS-Addressing schema.

One way to populate this list is to use the UDDI Binding Component, which returns an EndpointReferenceList containing multiple addresses. However, if you want something simpler without the burden of setting up a UDDI Server ,you can also use a BPEL String literal to specify XML fragments directly in a BPEL Process using Netbeans/OpenESB.

The key is to use the Source View verses the Design View because is not currently supported in the Design View (I am using Netbeans 6.0 20070622). After creating a new BPEL Module, process, and adding a sequence, go ahead and view the process in the Source View. Now a typical Assignment in BPEL looks like the following:

<variables>
<bpws:variable name="queryUddiOut" messageType="ns1:queryUddiOutReply"/>
<bpws:variable name="rssSubscribeIn" messageType="ns2:rssSubscribeInRequest"/>
</variables>

<sequence>
.........
<bpws:assign name="BasicAssign">
<bpws:copy>
<bpws:from variable="queryUddiOut" part="part1"/>
<bpws:to variable="rssSubscribeIn" part="part1"/>
</bpws:copy>
</bpws:assign>
.........
<sequence>

This next example should be exciting as it shows how to assign an XML fragment to a variable (which can next be used as input to an invocation) using a String literal:
<bpws:assign name="AssignXmlFragment">
<bpws:copy>
<bpws:from>
<bpws:literal>
<wsa:EndpointReference>
<wsa:Address>http://localhost:18181/stockQuoteService/stockQuotePort</wsa:Address>
<wsa:ServiceName PortName="stockQuotePort">
{http://j2ee.netbeans.org/wsdl/stockQuote}stockQuoteService
</wsa:ServiceName>
</wsa:EndpointReference>
</bpws:literal>
</bpws:from>
<bpws:to>$EPRVariable/wsa:EndpointReference</bpws:to>
</bpws:copy>
</bpws:assign>

The goal of this entry was to quickly explain how you can use the BPEL editor in Source View to assign XML fragments for whatever purpose you may require. Obviously it's not the best long-term solution because this is no different than hardcoding file paths in a java program. But is very useful for quick testing.

Multiple BPEL Processes using a single WSDL

When working with the Sun BPEL SE in Netbeans, sometimes you might have the requirement of defining a WSDL Port Type with two operations and then reference that WSDL in two different BPEL Processes.
It turns out this currently is not supported and if you try to attempt it you will receive the following exception from the BPEL SE:

java.lang.RuntimeException: Could not find a business process providing service for the endpoint specified in the message exchange.

Here is the bug related to this issue and the conversation over the mailing list discussing this issue with the OpenESB dev mailing list.

The solution that worked for us was using the BPEL Pick activity the single BPEL Process to support the second operation. Alternatively we could have created a second WSDL, which doesn't scale very well. Also as Murali points out here, you could also make the targetNamespace the same in both BPEL Processes.