users@jaxb.java.net

Re: Namespace for Exceptions

From: Vampire <vampire0_at_gmail.com>
Date: Wed, 4 Aug 2010 22:37:19 +0200

Oh, sorry. I thought what have looked at was in the JAXB source, but you are
right, it was in the JAX-WS RI code.

2010/8/4 Glen Mazza <glen.mazza_at_gmail.com>

> Your question might be better asked on the JAX-WS (Metro) user's list,
> because the Java class generated for WSDL exceptions (as well as the
> Service/Port class) is not handled by JAXB but by JAX-WS.
>
> Anyway, the JAX-WS 2.2 specification (Dec 2009), section 8.7.4, gives a
> customization which apparently allows you to specify the class to use for
> the fault within the WSDL:
>
> <Quote>
> 8.7.4 PortType Fault Message
> The following binding declarations MAY appear in the context of a WSDL
> portType operation’s fault mes-
> sage, either as an extension to the wsdl:portType/wsdl:operation/wsdl:fault
> element or with a
> node attribute pointing at one.
> 1 <jaxws:class name="xs:string">?
> 2 <jaxws:javadoc>xs:string</jaxws:javadoc>?
> 3 </jaxws:class>
>
> Semantics
> class/_at_name Fully qualified name of the generated exception class for this
> fault.
> class/javadoc/text() Class-level javadoc string.
> It is an error if faults that refer to the same wsdl:message element are
> mapped to exception classes with
> different names.
> </Quote>
>
> I have not used this before, however, so am unsure if this will do what you
> actually want.
>
> HTH,
> Glen
>
>
>
> Vampire wrote:
>
>> Hi,
>>
>> I'm using Metro which includes JAXB for providing a Java-first SOAP
>> WebService. I want my Exceptions to be in a dedicated namespace. Is there
>> any way to achieve this?
>> From a quick look through the JAXB source code it seems to me that for an
>> Exception always the targetNamespace is used. The only thing you can do via
>> a WebFault annotation is to set the targetNamespace for the fault element,
>> but not for the fault type. For the fault type always the targetNamespace is
>> used. Using an XmlType annotation doesn't work as the code only takes the
>> propOrder attribute of that annotation into consideration. When taking the
>> generated wsdl/xsd, you have an own namespace for the exception elements,
>> but not for the types. If you run this through wsdl2java from Axis, the
>> Exceptions of course end in the main targetNamespace. :-(
>>
>> I hope someone can enlighten me.
>>
>> Regards
>> Vampire
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>