users@jax-ws.java.net

Re: NullPointerException when running client

From: Daniel Robinson <nelkahn_at_gmail.com>
Date: Wed, 28 Jun 2006 16:41:59 +0200

Kathy,

Thanks for the quick reply.

The server side in running in Java 6_beta2_b84 (and therefore the integrated
jaxws).

The client side is running on Java 5 with version
JAXWS2.0.1ea_2006-06-23_11-00-18.jar that I downloaded from the nightly
build web site : https://jax-ws.dev.java.net/ri-download.html.

I am not quite certain what you mean by your HelloService example. What
service class do you want me to instantiate? I do not have a service
implementation on the client side. All I have is a java interface that
matches the WSDL signature.

Is this the part that I went wrong? Should I have generated something on the
client side based on the WSDL?


Daniel



On 28/06/06, kathy walsh <Kathleen.Walsh_at_sun.com> wrote:
>
>
> Daniel,
>
> What version of jaxws are you using with your program and where did you
> get it from?
>
> I suspect that there is a difference in the runtime you are using of
> jaxws that comes with java 6
> versus what you are using with java 5.
>
> In your program try creating the service by instantiating the
> service class.
>
> HelloService helloService = new HelloService();
>
> HelloPort hello = helloService.getHelloPort();
>
>
> Please let us know if you have more problems-
>
> Thanks,
> Kathy
>
>
>
>
>
> Daniel Robinson wrote:
>
> >
> > Hello all,
> >
> > I have got a simple WebService running. I have successfully called it
> > from Perl.
> >
> > I have also sucessfully called it using a java client running in Java 6.
> >
> > However I now need to get this working in Java 5. I am starting by the
> > client side of things. This is where I get the NullPointerException. I
> > have had a look through the source code and am unsur how this could
> work.
> >
> > This is the trace I get :
> >
> > java.lang.NullPointerException
> > at
> > com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(
> WSServiceDelegate.java:352)
> > at com.sun.xml.ws.client.WSServiceDelegate.getPort
> > (WSServiceDelegate.java:242)
> > at javax.xml.ws.Service.getPort(Service.java:94)
> > at
> > jet.container.managers.webservicesclient.WebServicesClientManager$1.run(
> WebServicesClientManager.java:101)
> > at java.security.AccessController.doPrivileged (Native Method)
> > at
> >
> jet.container.managers.webservicesclient.WebServicesClientManager.getWebServiceInstance
> (WebServicesClientManager.java:96)
> > at
> > jet.container.managers.webservicesclient.WebServicesClientManager.invoke
> > (WebServicesClientManager.java:77)
> > at
> > jet.container.exchange.AbstractContext.invoke(AbstractContext.java:300)
> > at
> >
> jet.container.managers.webservicesclient.WebServicesClientManagerContextImpl.getWebServiceInstance
> > (WebServicesClientManagerContextImpl.java:28)
> > at
> > be.inveo.jet.test.webservices.WebServiceTestNut.run(
> WebServiceTestNut.java:92)
> > at java.lang.Thread.run(Thread.java:595)
> >
> >
> > AS you can see the problem starts in the getPort method. This is how
> > things are called in the client :
> >
> >
> > private Object getWebServiceInstance(final Class sei, final URL
> > wsdlLocation, final String namespaceURI, final String serviceName,
> > final String portName) throws ConnectException {
> > final QName serviceQName = new QName(namespaceURI, serviceName);
> >
> > Object obj = null;
> > try {
> > obj = AccessController.doPrivileged(new
> > PrivilegedExceptionAction<Object>() {
> > public Object run() throws Exception {
> > Service service = Service.create(wsdlLocation,
> > serviceQName);
> >
> > QName portQName = new QName(namespaceURI, portName);
> > Object proxy = service.getPort(portQName, sei);
> > BindingProvider bp = (BindingProvider) proxy;
> >
> > Map<String, Object> context = bp.getRequestContext
> ();
> >
> > context.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
> >
> > return proxy;
> > }
> > });
> > } catch (PrivilegedActionException pae) {
> > Throwable t = pae.getCause();
> > if (t instanceof WebServiceException) {
> > WebServiceException wse = (WebServiceException) t;
> > throw wse;
> > }
> > if (t instanceof ConnectException) {
> > ConnectException ce = (ConnectException) t;
> > throw ce;
> > }
> > }
> >
> >
> > return obj;
> > }
> >
> >
> >
> > When I run this through the debugger I can see that the problem is
> > that the seiContext in the WSServiceDelegate is empty. This is the
> > case as the addSEI() method is not called in the constructor as the
> > serviceClass == Service.class.
> >
> > It is not clear where I have gone wrong (though I am certain I have
> > gone wrong somewhere). The NullPointerException is not much help
> however.
> >
> > Does anybody with a better understanding of the inner workings of
> > JAX-WS know what is going on here?
> >
> > Thank you in advance for any help.
> >
> > Daniel
> >
> >
> >
> >
> >
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
> For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
>
>