Skip to main content

JAXB/JAXRPC 2.0 Namespaces control

8 replies [Last post]
hr_stoyanov
Offline
Joined: 2004-04-01

Apologies if this is somewhere in docs, but how can one make JAXB/JAXRPC generate a schema file where the namespace is defined only once at the begining of the schema1.xsd file?

I need to get some more readable .XSD and .WSDL files, currently I get a lot of automatic namespaces: ns1 ns2 ...

Thanks
Hristo

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kohsuke
Offline
Joined: 2003-06-09

There has been some problems in the access control daemon, so I suggest you go through the click-through one more time.

Sorry for the inconvenience...

malachid
Offline
Joined: 2004-05-16

Although I am using JAXB without JAXRPC, I managed to fix that by using the NamespacePrefixMapper.

My output files only include the namespace declarations on the root element, and only include the namespace prefix on the same root element (unless they refer to another xsd in which case it only includes the prefix, not the entire namespace URI).

kohsuke
Offline
Joined: 2003-06-09

Right. NamespacePrefixMapper is for writing out instances, whereas I believe this question is about generating a schema document.

hr_stoyanov
Offline
Joined: 2004-04-01

Yep, Kohsuke is right - this is for schema generation.
Doug promisssed Sun will put their JAXRPC2.0 house in order next month, so fresh JAXRPC2.0 weeklies will start showing up regularly, similar to the excellent job Kohsuke and Ryan did for JAXB2.0 updates.

This particular issue is minor, compared to other issues I bumped into with JAXRPC2.0 EA. I can wait for now.

Thanks,
Hristo

kohsuke
Offline
Joined: 2003-06-09

I think you can use @XmlSchema annotations (and its xmlns property) on a package to declare additional namespace URIs in prefixes of your choice, although I'm actually not sure if they are implemented.

kohsuke
Offline
Joined: 2003-06-09

I just committed the code to handle XmlSchema.xmlns.
You can build the workspace on your own to try it, or
you can wait for next Monday for the build to show up in the weekly build area.

hr_stoyanov
Offline
Joined: 2004-04-01

Thanks Kohsuke-,
I will wait until Monday, since I still have not received my approval for the JAXB sources.

I read the JAXB 2.0 specs and I see how XmlSchema can help (I annotate my whole package). However, I suspect since it is the JAXRPC apt tool that drives the JAXB schemagen internaly, it might be a job for the JAXRPC team as well, to provide support for passing the "namespace" parameters to it somehow. Not sure ...

Thanks again,
Hristo

kohsuke
Offline
Joined: 2003-06-09

Sounds like you are running the schema generator in the context of wscompile/wsdeploy?

As long as you pass in package-info.java to wscompile/wsdeploy/APT, JAXB should pick that up and generate a proper schema into WSDL.

The problem is that I'm not sure if there's a build of the JAX-RPC RI that can use the latest JAXB RI...