In my endpoint implementation I have a user-defined exception thrown by some operations.
The generated wsdl then looks something like:
...
| <xs:complexType name='AuthorizationException'>
| <xs:sequence>
| <xs:element minOccurs='0' name='message'
type='xs:string'/>
| </xs:sequence>
| </xs:complexType>
| ...
| <operation name='read'>
| ...
| <fault name='AuthorizationException'>
| <soap:fault name='AuthorizationException'
use='literal'/>
| </fault>
| </operation>
| ...
From this wsdl wsconsume generates the following client-side
artifacts:
AuthorizationException (jaxb type)
AuthorizationException_Exception (java exception)
In the client I then I then get some awkward code like
try {...}
| catch (AuthorizationException_Exception ex) {...}
To get around these problems I defined a custom jax-ws binding, which is then provided to
wsconsume:
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
| <bindings
|
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
|
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
| wsdlLocation="http://localhost:8080/static/test.wsdl"
|
xmlns="http://java.sun.com/xml/ns/jaxws">
| <bindings node="wsdl:definitions">
| <package name="com.test"/>
| </bindings>
| <bindings
node="wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='http://com.test']">
| <jaxb:schemaBindings>
| <jaxb:package name="com.test.jaxb"/>
| </jaxb:schemaBindings>
| </bindings>
| </bindings>
basically this puts jaxws and jaxb generated artifacts into separate packages.
However, this works only if I remove the 'package' attribute from the wsconsume
task. From this I conclude that the 'package' attribute takes precedence over any
custom bindings. Why is this so?
Is there any other way to get nice exception class names with wsconsume?
Regards,
Magnus
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033007#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...