This technique doesn't seem to work for exceptions. I have an exception package with all exception classes defined. When I use package-info with a namespace definition, JAXB seems to ignore it. I am able to get the exception class map to a namespace only by using @WebFault. Any pointers on how to get the package level namespace working for exceptions?
- Kannan Adrian Trenaman wrote: > > Yup, > > Kudos to Roman Roelofsen for dreaming this one up! > > Cheers, > Ade. > > > Jim Ma-3 wrote: >> >> Great! Ade. It's artful hackery . >> >> -Jim >> >> Adrian Trenaman wrote: >>> Hi Jim, >>> >>> Just to follow up on this - I had a go at providing a skeleton Java >>> package >>> with the package-info.java(.class) in place: CXF correctly picked up the >>> class and placed all JAX-B related artifacts from that package into the >>> namespace specified in package-info: >>> >>> --- package-info.java (in directory my/package) >>> @javax.xml.bind.annotation.XmlSchema(namespace >>> ="http://i.wandered.lonely.as.a.cloud"); >>> package my.package; >>> --- >>> >>> So, this clever little hack works just fine. >>> >>> Cheers, >>> Ade. >>> >>> >>> Adrian Trenaman wrote: >>> >>>> Hi Jim, >>>> >>>> Thanks for the idea - if only I could modify the class!! It's been made >>>> available to me only as a JAR, not in source format, so I don't have >>>> the >>>> possiblity of adding the familiar JAX-B annotations that would do this. >>>> >>>> One suggestion I've had from a colleague in Dublin is to create a >>>> skeleton >>>> directory structure that matches the package structure, and create a >>>> package-info.java file in each directory with a >>>> @javax.xml.bind.annotation.XmlSchema(namespace="...") annotation; if I >>>> compile and then put this ahead of my JAR in the classpath then >>>> java2wsdl >>>> might pick up these annotations and help out. >>>> >>>> What do you think? Pragmatic workaround or artful hackery? >>>> >>>> Cheers, >>>> Ade. >>>> >>>> >>>> Jim Ma-3 wrote: >>>> >>>>> Hi Adrian, >>>>> >>>>> If this class can be modified , I think we can add some annotations >>>>> for >>>>> this method to avoid generating wrapper element and resolve clash : >>>>> >>>>> pacakge com.foo; >>>>> public class Bar { >>>>> @ResponseWrapper(targetNamespace = "http://apache.org/namespace", >>>>> className = "com.foo.CreateCaseResponse", localName = >>>>> "createCaseResponse") >>>>> @RequestWrapper(targetNamespace = "http://apache.org/namespace", >>>>> className = "com.foo.CreateCaseRequest2", localName = >>>>> "createCaseRequst") >>>>> public CreateCaseResponse createCase(String arg0, CreateCaseRequest >>>>> arg1); >>>>> } >>>>> >>>>> When java2wsdl can not read these annotations for this method , it >>>>> will >>>>> try to load the RequestWrapper class and ReponseWrapper class from >>>>> package com.foo.jaxws (as per jaxws spec). >>>>> If it is failed to load , it will generate wrapper elements for this >>>>> method . >>>>> >>>>> Regards >>>>> >>>>> Jim >>>>> >>>>> >>>>> Adrian Trenaman wrote: >>>>> >>>>>> Hi Jim, >>>>>> >>>>>> Thanks for the info! The collision I'm running into is due to the >>>>>> Java >>>>>> API >>>>>> (based on an EJB) already providing wrappers classes for parameter >>>>>> lists. >>>>>> For example: >>>>>> >>>>>> public CreateCaseResponse createCase(String arg0, >>>>>> CreateCaseRequest >>>>>> arg1) >>>>>> >>>>>> ... as you can see, our java2wsdl will try and create a wrapper >>>>>> element >>>>>> for >>>>>> CreateCaseResponse (as per the JAXWS spec) which then clashes with >>>>>> the >>>>>> already existing type CreateCaseResponse. Ugly, huh?! >>>>>> >>>>>> The original CreateCaseResponse is in a different Java package from >>>>>> the >>>>>> interface, so if we could map individual packages to schema >>>>>> namespaces >>>>>> then >>>>>> I would be able to resolve the clash. However, as you say in your >>>>>> email, >>>>>> CXF >>>>>> doesn't provide support for this. >>>>>> >>>>>> Best, >>>>>> Ade. >>>>>> >>>>>> >>>>>> Jim Ma-3 wrote: >>>>>> >>>>>> >>>>>>> Hi Adrian, >>>>>>> >>>>>>> What type of collision did you run into ? Is this schema element >>>>>>> name >>>>>>> collision? >>>>>>> >>>>>>> Java2wsdl uses converted packagename or annotated namepace as it's >>>>>>> namespace , >>>>>>> and there is no way to customize the namespace on per-package basis >>>>>>> like >>>>>>> wsdl2java does. >>>>>>> >>>>>>> Cheers >>>>>>> -Jim >>>>>>> >>>>>>> Trenaman, Adrian wrote: >>>>>>> >>>>>>> >>>>>>>> Hi all, >>>>>>>> >>>>>>>> I'm creating some WSDL from classes in an existing Jar file; CXF's >>>>>>>> java2wsdl is putting everything into the same schema namespace >>>>>>>> which >>>>>>>> is >>>>>>>> causing collisions. Is there any way to customise the namespace on >>>>>>>> a >>>>>>>> per-package basis so that I can avoid the collisions? >>>>>>>> >>>>>>>> Thanks, >>>>>>>> Ade. >>>>>>>> >>>>>>>> >>>>>>>> Adrian Trenaman >>>>>>>> >>>>>>>> Principal Consultant, IONA Technologies. >>>>>>>> >>>>>>>> E: [EMAIL PROTECTED] >>>>>>>> >>>>>>>> P: +353-1-6372659 >>>>>>>> >>>>>>>> M: +353-86-6051026 >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> ---------------------------- >>>>>>>> IONA Technologies PLC (registered in Ireland) >>>>>>>> Registered Number: 171387 >>>>>>>> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, >>>>>>>> Ireland >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>> >>> >>> >> >> > > -- View this message in context: http://www.nabble.com/Is-there-any-way-to-customise-schema-namespaces-with-java2wsdl--tp12257051p14901980.html Sent from the cxf-user mailing list archive at Nabble.com.
