Chris Tinning wrote:
> 
> This is my code - 
> Setup -
> 
> ConfigurationContext config
> =ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,
>                       AXIS2_CONFIG_FILE_LOCATION);
> // serviceUrl of the form http://host:8080/app/services/session               
> serviceStub = new SessionServiceStub( config, serviceUrl);
> 
> 
> And later calling the service - 
> 
> GetAvailableConnectionsDocument request =
> GetAvailableConnectionsDocument.Factory.newInstance();
> GetAvailableConnectionsResponse response =
> serviceStub.getAvailableConnections( request );
> 
> The call to getAvailableConnections results in the NullPointer. As far as
> I can see this is the same as in the documentation. It is loading the
> axis2.config file as I've had to comment out the addressing module from
> that - could this be the problem? I am using the supplied axis2.xml with
> only that change, I've also tried without supplying the config (ie. new
> SessionServiceStub(serviceUrl) ) and got the same error.
> 

I am re-replying because I suspect you are not seeing the last update I did
in my last reply (I don“t know how exactly this forum works yet). Here I
go... read below:

Is really the SessionServiceStub a XML Beans client stub, generated from
Axis2? Did you modify the default code of the auto-generated
SessionServiceStub class?

In the following line:
GetAvailableConnectionsDocument request =
GetAvailableConnectionsDocument.Factory.newInstance();

Instead of doing that, rename the "request" variable to "requestDocument"
(just to make things more clear):
GetAvailableConnectionsDocument requestDocument =
GetAvailableConnectionsDocument.Factory.newInstance();

Next, you also have to define the instance of the GetAvailableConnections
class, that would be something like this:
GetAvailableConnections request =
GetAvailableConnections.Factory.newInstance();

And then you have to pass this "request" to the "requestDocument", that
would be something like this:
requestDocument.setAvailableConnections(request);

In the following line:
GetAvailableConnectionsResponse response =
serviceStub.getAvailableConnections( request );

I do not know how you wrote the method getAvailableConnections (how did you
create the SessionServiceStub class?), I even doubt that your code compile
(post the full code, please, or upload your code in a zip file), but,
instead of calling the webservice like that, you should call this way:
GetAvailableConnectionsResponseDocument responseDocument =
serviceStub.getAvailableConnections( requestDocument);

You should have, in your client stub class (supposedly, the
SessionServiceStub class), a method that returns a
GetAvailableConnectionsResponseDocument , not a
GetAvailableConnectionsResponse.

Finally, to obtain a GetAvailableConnectionsResponse, you have to do this:
GetAvailableConnectionsResponse response =
responseDocument.getAvailableConnectionsResponse();

This "response" object is an instance of GetAvailableConnectionsResponse in
which you have all the things you want.
-- 
View this message in context: 
http://www.nabble.com/Client-stubs-NullPointer-Exception-tp20721127p20782028.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to