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.

No comments:

Post a Comment