users@jaxb.java.net

JAXB problems with reserved word "Public"

From: Britton LaRoche <britton_laroche_at_yahoo.com>
Date: Tue, 16 Jun 2009 15:28:18 -0700 (PDT)

The current project I'm working on with glassfish has hit a snag. I'm using JAX-WS and wsimport to get java classes for a WSDL that uses the word "Public" with a capital "P" in the namespace. There is a bug notification on the glassfish site here:

--- Reserved word public error in JAXB ---
https://jax-ws.dev.java.net/issues/show_bug.cgi?id=599

Examples of the errors generated on import are listed below:

[ERROR] The package name 'com.metro.mss.mss.namespaces.types.public.metrodatamodel' used for this schema is not a valid package name.
line 6 of file:/C:/MSSBillingSim/WSDL/original/MetroDataModel.xsd

The solution is to get wsimport to work was to rename all uppercase "Public" refernces to lowercase "public" in the namespaces for all the WSDLs and xsd files. Example below

xmlns:cdm="http://mss.metro.com/MSS/Namespaces/Types/Public/MetroDataModel.xsd"
xmlns:cdm="http://mss.metro.com/MSS/Namespaces/Types/public/MetroDataModel.xsd"

--- SOAP Message Mismatch ---

Now that I've loaded in the wsdl with _public and created a webservice the SOAP messages no longer match. We get the following error, trying the echo request.

Cannot find dispatch method for {http://mss.metro.com/MSS/Namespaces/Container/Public/EchoRequest.xsd}EchoRequest

I cannot find a way to load in the WSDL and get an echo response with the proper namespace. Could you lend a hand with this, or point me to someone who could help? I'm trying another approach with "_Public" in the namespace, is there an escape character that will allow WSIMPORT to work and still keep "Public" as part of the name space?

I also tried the underbar with the uppercase "_Public" and it fails with the following messages when I send a soap request:

java.lang.NoClassDefFoundError: com/metro/mss/mss/namespaces/container/_public/inquireaccountprofilerequest/InquireAccountProfileRequestInfo

java.lang.ClassNotFoundException: com.metro.mss.mss.namespaces.container._public.inquireaccountprofilerequest.InquireAccountProfileRequestInfo

I checked and the class is there. I found that changing "Public" to a nonreserved word like "Nublic" works great. Unfortunately Metro web has had this WSDL for several years and will not change it.

I've attached the WSDL files both "Public" and "Nublic" for comparison. I've also attached a working "Nublic" sample JMETER test with a soap message and the default echo command in the MetroWebMSSService.java generated by netbeans.

Any help will be greatly appreciated!

Thanks,

Britton