axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ali Sadik Kumlali (JIRA)" <j...@apache.org>
Subject [jira] Created: (AXIS2-679) Calling a service from within another service causes NPE
Date Fri, 05 May 2006 22:03:28 GMT
Calling a service from within another service causes NPE
--------------------------------------------------------

         Key: AXIS2-679
         URL: http://issues.apache.org/jira/browse/AXIS2-679
     Project: Apache Axis 2.0 (Axis2)
        Type: Bug

  Components: core  
    Versions: 1.0    
 Environment: WinXP Pro, JDK 1.4, Tomcat 5.5
    Reporter: Ali Sadik Kumlali


Here is my scenario:
1) I have serviceA.wsdl and serviceB.wsdl. 
2) I generate skeletons and stubs with WSDL2Java
3) I have serviceA.aar which has serviceB.wsdl's stub
4) When I call serviceB's stub from a class found in serviceA.aar I get the following error:

----------------------------------------------------------------
java.lang.NullPointerException
	at org.apache.axis2.context.ServiceGroupContext.getServiceContext(ServiceGroupContext.java:59)
	at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:101)
	at com.mycompany.service.test.account.AccountServicesStub.<init>(AccountServicesStub.java:79)
----------------------------------------------------------------

I founded that "unassinged parent" caused the NPE. If the service is already registered in
axisConfig it doesn't enter in the code that assings a parent to the service. Also, it doesn't
uses the parent of the registered service.

The code causes NPE is here:
----------------------------------------------------------------
// org.apache.axis2.client.ServiceClient
public ServiceClient(ConfigurationContext configContext,
                     AxisService axisService) throws AxisFault {

  ...
  // If the service is already registered, it doesn't enter
  // here so there will be no parent.
  if (this.axisConfig.getService(this.axisService.getName()) == null) {
    this.axisConfig.addService(this.axisService);
  }
  ServiceGroupContext sgc = new ServiceGroupContext(this.configContext,
                (AxisServiceGroup) this.axisService.getParent());
  this.serviceContext = sgc.getServiceContext(this.axisService);
}
----------------------------------------------------------------

I made the following change and it worked:

----------------------------------------------------------------
// org.apache.axis2.client.ServiceClient
public ServiceClient(ConfigurationContext configContext,
                     AxisService axisService) throws AxisFault {
  ...
  AxisService service = null;
  AxisService registeredService = 
    this.axisConfig.getService(this.axisService.getName());
  if (registeredService != null) {
    service = registeredService;
  } else {
    this.axisConfig.addService(this.axisService);
    service = this.axisService;
  }
    
  ServiceGroupContext sgc = new ServiceGroupContext(this.configContext,
            (AxisServiceGroup) service.getParent());  
  this.serviceContext = sgc.getServiceContext(service);
}
----------------------------------------------------------------

But  this time, there was no addressing and security headers in the soap message. Then I tried
to manually engage the modules as following:

----------------------------------------------------------------
stubB._getServiceClient().engageModule(new QName("addressing"));
stubB._getServiceClient().engageModule(new QName("rampart"));
----------------------------------------------------------------

It didn't work either.

P.S.: I tried both 1.0 RC5 and 1.0 releases.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message