« Mediator 11g new feature - echo to requestor | Main | SOA Suite 11g - api tricks part 2 - finding instances »

Using the new 11g SOA Suite API - changes to 10.1.3x

With 11g and the new SCA composite support our API has been revamped a little as well.

The Locator is still available and is created against WL jndi properties


Hashtable jndiProps = new Hashtable();
jndiProps.put(Context.PROVIDER_URL,
"t3://" + props.get(STR_MGDSERVER_HOST_KEY) + ":" +
props.get(STR_MGDSERVER_PORT_KEY) + "/soa-infra");

jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, STR_WL_CTX);
jndiProps.put(Context.SECURITY_PRINCIPAL,
props.get(STR_USER_KEY));
jndiProps.put(Context.SECURITY_CREDENTIALS,
props.get(STR_PASSWORD_KEY));
jndiProps.put("dedicated.connection", "true");

System.out.println("Creating locator with properties: " + jndiProps);

return LocatorFactory.createLocator(jndiProps);

Finding your composite..

Composite composite = locator.lookupComposite(compositeDN);

The composite DN is based on

<domain name>/<composite name>!<version>
e.g.: default/OrderBookingComposite!1.0

And here is the difference to 10.1.3 - on a composite you can have multiple services defined - e.g.

<service name="orderprocessor_client_ep"
ui:wsdlLocation="oramds:/apps/FusionOrderDemoShared/services/orderbooking/OrderBookingProcessor.wsdl">
<interface.wsdl interface="http://www.globalcompany.example.com/ns/OrderBookingService#wsdl.interface(OrderProcessor)"/>
</service>
<service name="UpdateOrderStatus_ep" ui:wsdlLocation="UpdateOrderStatus.wsdl">
<interface.wsdl interface="http://xmlns.oracle.com/WebLogicFusionOrderDemo/OrderBookingComposite/UpdateOrderStatus#wsdl.interface(execute_ptt)"/>
</service>

So you need to find the appropriate service, to get a handle on the delivery service.

Service deliveryService =
composite.getService("UpdateOrderStatus_ep");

If you don't read on, you will get a nullpointer now, because while we allowed you to create a delivery service in 10.1.3 on an exposed client partnerlink / service, in 11g - you need to add a specific binding, so the you can bind to the service via api.

The exception stack will reveal:

Caused by: java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
at oracle.integration.platform.blocks.sdox.JavaEntryBindingComponent.invoke(JavaEntryBindingComponent.java:127)
at oracle.soa.management.internal.ejb.impl.FacadeFinderBeanImpl.executeServiceMethod(FacadeFinderBeanImpl.java:853)
... 31 more

To avoid this you'll need to add a binding.adf entry into your composite's service, such as the below one.


<service name="UpdateOrderStatus_ep" ui:wsdlLocation="UpdateOrderStatus.wsdl">
<interface.wsdl interface="http://xmlns.oracle.com/WebLogicFusionOrderDemo/OrderBookingComposite/UpdateOrderStatus#wsdl.interface(execute_ptt)"/>
<binding.adf serviceName="OrderProcessorService" registryName=""/>
</service>

From here on it's back to normal, create a normalized message, set the payload parts and use service.post / request.

NormalizedMessage nm = new NormalizedMessageImpl();

// create and set a conversation id - e.g. through the UUID class
String uuid = "uuid:" + UUID.randomUUID();
nm.addProperty(NormalizedMessage.PROPERTY_CONVERSATION_ID, uuid);
// get the payload off the normalized message and add an xml part
nm.getPayload().put(<partName>, <some xml>);

TrackBack

TrackBack URL for this entry:
http://blogs.oracle.com/mt/mt-tb.cgi/13088

Comments (1)

HI

Could you please let me know all the dependent jar files for the above code?

Thanks
Sankeerth

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on July 30, 2009 10:20 AM.

The previous post in this blog was Mediator 11g new feature - echo to requestor.

The next post in this blog is SOA Suite 11g - api tricks part 2 - finding instances.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle