axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Davis" <>
Subject RE: NullPointerException in ServiceClient
Date Fri, 31 Aug 2001 17:56:50 GMT
Can we always assume that there's a URL?  Isn't that a bit specific
for just certain transports?

Glen Daniels <> on 08/31/2001 01:20:35 PM

Please respond to

To:   "''" <>
Subject:  RE: NullPointerException in ServiceClient

Hi Ryo, all:

There are a few ways we could go here.

1) take out the reset(), so the value hangs out.  It's a little odd that we
don't do this for every entry point, just the one with the SOAPEnvelope.

2) tie a URL into the Transport object (this asks the question - is there a
direct mapping between a Transport and a URL), and let it always set that
setupMessageContext() time.

3) Have the ServiceClient itself set the URL property in invoke(), right
before calling the transport setupMessageContext()

Note that I would suggest putting the reset() in all the invoke()s for
either of the latter two approaches, for consistency.

I rather like the second approach, since our transports really do already
work this way (you give a server+port to a TCPTransport, a URL to an
HTTPTransport, a server to a LocalTransport).  I've implemented a first cut
at this, but will wait to check it in until I hear opinions back from the


> -----Original Message-----
> From: Ryo Neyama []
> Sent: Friday, August 31, 2001 11:23 AM
> To:
> Subject: NullPointerException in ServiceClient
> The following code doesn't work as I expected but it throws
> NullPointerException.
> SOAPEnvelope reqEnv = ...;
> ServiceClient call = new ServiceClient(url);
> SOAPEnvelope respEnv = call.invoke(reqEnv);
> This is caused by the following code in ServiceClient.
>     public SOAPEnvelope invoke(SOAPEnvelope env) throws AxisFault
>     {
>         msgContext.reset();
>         msgContext.setRequestMessage(new Message(env));
>         invoke();
>         return msgContext.getResponseMessage().getAsSOAPEnvelope();
>     }
> More specifically, msgContext.reset() removed the url set in the
> constructor.
> Is this a bug or spec?
> If it's spec, why?
>     Ryo Neyama @ IBM Research, Tokyo Research Laboratory
>     Internet Technology

View raw message