users@jax-rpc.java.net

Re: NullPointerException when trying to generate JAX-WS client from WS-Notification WSDL

From: Vivek Pandey <Vivek.Pandey_at_Sun.COM>
Date: Tue, 23 Aug 2005 07:06:41 -0700

jastrachan_at_mac.com wrote:

> Just a quick update in case anyone's interested. I've managed to get
> all the main PortTypes in WS-Notification working with JAX-WS now.
> Its all in CVS if you wanna grab it...
>
> http://cvs.servicemix.codehaus.org/servicemix/ws/jaxws/wspojo/
>
> cvs -d :pserver:anonymous_at_cvs.servicemix.codehaus.org:/home/projects/
> servicemix/scm login
> cvs -z3 -d :pserver:anonymous_at_cvs.servicemix.codehaus.org:/home/
> projects/servicemix/scm co servicemix/ws/jaxws/wspojo
>
>
> I did find I had to hack the WS-BaseNotification WSDL a bit as JAX-WS
> was getting confused over the duplicate definitions of
> ResourceUnknownFault which is defined in a bunch of different
> namespaces (see the TODO comments in the WSDLs). e.g. I kept getting...
>
> [wsimport] error: the following naming conflicts occurred:
> org.servicemix.wspojo.notification.ResourceUnknownFault
>
Sounds great!

I think you didnt need to change the WSDL for the above error. There are
certain rules that wsimport MUST follow inorder to be consistent while
processing the WSDL as per JAXWS 2.0 spec. You can customize the
generated fault exception class that have name conflict using XPath like
notation. Here is the section of user guide that explains it:

https://jax-rpc.dev.java.net/jaxws20-ea2/docs/customizations.html#2.6_Class_Customization

see section 2.6.2 that specifically addresses customizing generated
exception class.

You may like to see external-customize sample that you may find in
samples directory of jaxws release.

Hope it helps,

-vivek.


> I'm unsure if thats a bug in the WSDL or an issue with JAX-WS though.
>
> But this WSDL successfully generates all the core operations in WS-
> Notification.
> http://cvs.servicemix.codehaus.org/servicemix/ws/jaxws/wspojo/wsdl/
> SoapServices.wsdl?rev=HEAD&view=auto
>
>
> Thanks folks for a great tool!
>
>
> On 22 Aug 2005, at 19:30, jastrachan_at_mac.com wrote:
>
>> Awesome! Many thanks Vivek - the NPE completely threw me! :)
>>
>> Making that change made it work perfectly.
>>
>> On 22 Aug 2005, at 19:06, Vivek Pandey wrote:
>>
>>> hi James,
>>>
>>> the NPE is result of missing required input binding for operation
>>> "Notify".
>>>
>>> The abstract definition defines it as one way operation in wsdl\WS-
>>> BaseNotification-1_2-Draft_01.wsdl:
>>>
>>> <!-- ================ NotificationConsumer::Notify ================
>>> Notify(
>>> NotificationMessage
>>> (TopicExpression, ProducerReference, Message)*
>>> returns: n/a (one way)
>>> -->
>>> <wsdl:message name="Notify">
>>> <wsdl:part name="Notify" element="wsnt:Notify"/>
>>> </wsdl:message>
>>>
>>> <!-- ========= NotificationConsumer PortType Definition ===========
>>> -->
>>> <wsdl:portType name="NotificationConsumer">
>>>
>>> <wsdl:operation name="Notify">
>>> <wsdl:input message="wsntw:Notify"/>
>>> </wsdl:operation>
>>>
>>> </wsdl:portType>
>>>
>>>
>>> But while binding you're not providing binding for the input. Here
>>> is your binding from wsdl/Service-Consumer.wsdl:
>>>
>>> <wsdl:operation name="Notify">
>>> <soap:operation />
>>> <wsdl:input></wsdl:input>
>>> </wsdl:operation>
>>>
>>> if you change your wsdl:input binding to:
>>> <wsdl:operation name="Notify">
>>> <soap:operation />
>>> <wsdl:input>
>>> <soap:body parts="Notify" use="literal"/>
>>> </wsdl:input>
>>> </wsdl:operation>
>>>
>>> I think wsimport should work fine with this change.
>>>
>>> Regardless of that NPE shouldnt be thrown, instead a proper
>>> exception giving the problem with WSDL should have been trown. It
>>> will be fixed.
>>>
>>> -vivek.
>>>
>>> jastrachan_at_mac.com wrote:
>>>
>>>
>>>
>>>> I've a demo attempting to generate a JAX-WS client for WS-
>>>> Notification here...
>>>>
>>>> http://codehaus.org/~jstrachan/wsn.zip
>>>>
>>>> unzip and type
>>>>
>>>> ant
>>>>
>>>> and you should see the NullPointerException. Maybe I've done
>>>> something silly in the WSDL but it seems to validate fine in
>>>> Eclipse WebTools. The NullPointerException gives no stack trace,
>>>> if I use ant -v or ant -d so I cannot find any more info on the
>>>> error.
>>>>
>>>> Any ideas? Has anyone ever managed to generate a JAX-WS client for
>>>> WS- Notification WSDLs? (They seem complex enough to be a good
>>>> test case for you to try out).
>>>>
>>>> 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
>>>>
>>>>
>>>>
>>>
>>> --
>>> Vivek Pandey
>>> Web Services Standards and Technologies
>>> Sun Microsystems Inc.
>>>
>>>
>>
>>
>> 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
>>
>>
>
>
> 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
>

-- 
Vivek Pandey
Web Services Standards and Technologies
Sun Microsystems Inc.