users@jax-rpc.java.net

Re: [JAX-WS] NullPointerException in com.sun.xml.ws.client.ServiceFactoryImpl.createService(Unknown Source)

From: <jastrachan_at_mac.com>
Date: Thu, 1 Sep 2005 13:04:23 +0100

Aha! I've just spotted that the source is available on the site after-
all under the weekly binary downloads
https://jax-rpc.dev.java.net/servlets/ProjectDocumentList?
folderID=1182&expandFolder=1182&folderID=1182

The website clearly says in the 'Sources' section (https://jax-
rpc.dev.java.net/) that the sources are in the other project - http://
jax-ws-sources.dev.java.net/ which is why I've been trying to get
access.

With the source its easier to debug :). So here's a patch...

I don't have CVS access so can't give you a CVS patch, but here's the
fix for the bug. Basically if no 'si' was passed in, the
ServiceContext was created with no WsdlContext. So I just ensured
that the WsdlContext was created irrespective of the value of
'si' (mostly just moving the braces around a little )

So here's my modified version of the build method...

     public static ServiceContext build(URL wsdlLocation, Class si,
EntityResolver er) throws WebServiceException {

         ServiceContext serviceContext = new ServiceContext(er);
         SIAnnotations serviceIFAnnotations = null;
         if (si != null) {

             serviceIFAnnotations = getSIAnnotations(si);
             if (serviceIFAnnotations == null )
                 throw new WebServiceException("Service Interface
Annotations required, exiting...");
             serviceContext.setSiAnnotations(serviceIFAnnotations);
         }

         if(wsdlLocation == null)
             try {
// wsdlLocation = new URL
(serviceIFAnnotations.wsdlLocation);
                 wsdlLocation = new URL(JAXWSUtils.getFileOrURLName
(serviceIFAnnotations.wsdlLocation));
             } catch (MalformedURLException e) {
                 throw new WebServiceException(e);
             }
         serviceContext.setWsdlContext(new WSDLContext
(wsdlLocation,er));

         if (si != null) {
             serviceContext.setServiceInterface(si);
             for (Class clazz : serviceIFAnnotations.classes) {
                 processAnnotations(serviceContext,clazz);
             }
         }
         return serviceContext;
     }

This fixes my issue and I can now create a Service properly.

James

On 31 Aug 2005, at 20:01, Kathy Walsh wrote:

> James-
> What drop of the kaxws are you using-
> there have been bugs reported on this previously.
> Kathy
>
> jastrachan_at_mac.com wrote:
>
>
>> Any chance of turning on debug information in the nightly binary
>> distros? It makes debugging a bit hard.
>>
>> Right now I'm trying to create a Service from the ServiceFactory,
>> specifying a URL to the WSDL and a QName and get this exception...
>>
>> [junit] java.lang.NullPointerException
>> [junit] at
>> com.sun.xml.ws.client.ServiceFactoryImpl.createService(Unknown
>> Source)
>>
>> Which has me a bit stumped :). I'm still waiting to be allowed to
>> see the source code - in the meantime, anyone care to take a
>> guess at what's wrong? (BTW both parameters i'm passing in are
>> non-null and look valid to me).
>>
>> James
>> -------
>> http://radio.weblogs.com/0112098/
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
>> For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>


James
-------
http://radio.weblogs.com/0112098/