Sunday, November 27, 2011

The issuse with NullPointer in Oracle 11g SOA



In recent couple of days I am working on BPEL project in Oracle SOA 11g and found one thing which took me a while to figure out where the problem is from.   When I deploy the BPEL into development server through JDeveloper directly without using cfgplan.xml BPEL works fine.  But when the application is deployed to testing server by manually deployment with cfgplan.xml, there will be one NullPointer exception when one reference web service is invoked from BPEL.   After some investigation the problem was fixed by changing the port of reference web service.
The below are the reference definition in composite.xml

  <reference name="ISL-FUL-MPSA"
             ui:wsdlLocation="Med_SC_SP_ManageServiceParametersAllocationHttp_Service.wsdl">
    <interface.wsdl interface="http://Med_Lib_Service/ManageServiceParametersAllocationV2#wsdl.interface(ManageServiceParametersAllocation)"/>
    <binding.ws port="http://Med_Lib_Service/ManageServiceParametersAllocationV2/Binding2#wsdl.endpoint(Component1Export_ManageServiceParametersAllocationHttpService/Component1Export_ManageServiceParametersAllocationHttpPort)"
                location="Med_SC_SP_ManageServiceParametersAllocationHttp_Service.wsdl"
                soapVersion="1.1">
      <property name="weblogic.wsee.wsat.transaction.flowOption"
                type="xs:string" many="false">WSDLDriven</property>
    </binding.ws>
  </reference>

In this definition the service and port of the reference web service is:  

Component1Export_ManageServiceParametersAllocationHttpService and Component1Export_ManageServiceParametersAllocationHttpPort.   

They are from Med_SC_SP_ManageServiceParametersAllocationHttp_Service.wsdl.

            <wsdl:service name="Component1Export_ManageServiceParametersAllocationHttpService">
                        <wsdl:port name="Component1Export_ManageServiceParametersAllocationHttpPort" binding="this:Component1Export_ManageServiceParametersAllocationHttpBinding">
                                    <soap:address location="http://xxx.yyy.zzz.com:8001/ISL-FULAdaptor/BS/ISL-FULServiceAdaptor-v1"/>
                        </wsdl:port>
            </wsdl:service>

The actual reference service is deployed on OSB 10g.    For some reason after the deployment the service and port are changed to:
Component1Export_ManageServiceParametersAllocationHttpBindingQSService and Component1Export_ManageServiceParametersAllocationHttpBindingQSPort.

The below is the portion of the published WSDL from the referenced service deployed on OSB10g.

<s0:service name="Component1Export_ManageServiceParametersAllocationHttpBindingQSService">
                        <s0:port binding="s5:Component1Export_ManageServiceParametersAllocationHttpBinding" name="Component1Export_ManageServiceParametersAllocationHttpBindingQSPort">
                                    <s4:address location="http://xxx.yyy.zzz.com:8001/ISL-FULAdaptor/BS/ISL-FULServiceAdaptor-v1"/>
                        </s0:port>
</s0:service>

The original generated cfgplan.xml is like the below:

     <reference name="ISL-FUL-MPSA">
         <!--Add search and replace rules for the binding properties-->
         <binding type="ws">
            <attribute name="port">
               <replace>http://Med_Lib_Service/ManageServiceParametersAllocationV2/Binding2#wsdl.endpoint(Component1Export_ManageServiceParametersAllocationHttpService/Component1Export_ManageServiceParametersAllocationHttpPort)</replace>
            </attribute>
            <attribute name="location">
               <replace> http://xxx.yyy.zzz.com:8001/ISL-FULAdaptor/BS/ISL-FULServiceAdaptor-v1?wsdl </replace>
            </attribute>
            <property name="weblogic.wsee.wsat.transaction.flowOption">
               <replace>WSDLDriven</replace>
            </property>
         </binding>
      </reference>

This  cfgplan.xml will cause NullPointer exception on the testing server since the service and port names do not match actual service deployed on OSB 10g.
After we change the cfgplan.xml to use the matched service name and port like the below:

      <reference name="ISL-FUL-MPSA">
         <!--Add search and replace rules for the binding properties-->
         <binding type="ws">
            <attribute name="port">
               <replace>http://Med_Lib_Service/ManageServiceParametersAllocationV2/Binding2#wsdl.endpoint(Component1Export_ManageServiceParametersAllocationHttpBindingQSService/Component1Export_ManageServiceParametersAllocationHttpBindingQSPort)</replace>
            </attribute>
            <attribute name="location">
               <replace>http://xxx.yyy.zzz.com:8001/ISL-FULAdaptor/BS/ISL-FULServiceAdaptor-v1?wsdl</replace>
            </attribute>
            <property name="weblogic.wsee.wsat.transaction.flowOption">
               <replace>WSDLDriven</replace>
            </property>
         </binding>
      </reference>

The testing shows that NullPointer exception is gone.

Monday, October 17, 2011

Gregor Hohpe's Enterprise Integration Patterns Link

The web site by Gregor Hohpe. It contains lots of useful information about enterprise integration patterns

http://eaipatterns.com/index.html

Thursday, October 13, 2011

Change the port number for Oracle XE

Found a good blog which describes how to change the port number for Oracle XE. Here is the link:

http://daust.blogspot.com/2006/01/xe-changing-default-http-port.html

Wednesday, September 21, 2011

Two scenarios of invoking asychronous service from BPEL

OrderService is one asynchronous service. When invoking it from one BPEL process we can have the different behaviour by using different activities: in one scenario OrderService is invoked and then BPEL process will wait for the callback response from OrderService. If the specified timeout occurs the notification is sent off but BPEL process continues the waiting for the response. However in another scenario after invoking OrderService BPEL will wait for the callback response. If the specified timout occurs BPEL will handle the timeout and will not wait for the callback response any more.

The first scenario can be implemented by using the activity invoke, receive wrapped in the scope with which onAlarm is attached.

The second scenario is implemented using pick activity. One branch of pick is onMessage to wait for the callback and another branch is onAlarm.

Thursday, September 15, 2011

Using MDS in JDeveloper

When using WSDL in MDS in Oracle SOA 11g, JDeveloper uses .adf\META-INF\adf-config.xml to decide where MDS is.

For example, in the following component.xml the WSDL's location is defined as:
oramds:/apps/SOInterfaces-2.3.9.8/BSC/OrderAndActivation/Activation/ServiceProvisioning-v1.wsdl.


When building the SOA application JDeveloper will look up the MDS from adf-config.xml in order to load the WSDL. From adf-config.xml we know that for /apps/SOInterfaces-2.3.9.8 it uses the metadata-store-usage is mstore-usage-2 which is a database-based MDS. Its database details is defined in metadata-store-usage with id="mstore-usage-2".