Skip to main content

Trouble with WSDL generation from java source

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

I am trying to generate a WSDL files and schema files of my service class with something like:
------------------------------------

------------------------------------

So, I do set the "nd" option, but the WSDL output directory remains empty ??? Next, I decided to give up on WSDl generation and deploy the war, hopeing to extract it from the deployed dervice, but at deployment time (JBoss 4.0.2) I got:
-------------------------------------
11:33:06,309 INFO [TomcatDeployer] undeploy, ctxPath=/com.intuit.efe-web_services, warUrl=file:/C:/efe/local/jboss-4.0.2/server/efe/tmp/deploy/tmp62864com.intu
it.efe-web_services-exp.war/
11:33:06,309 INFO [STDOUT] Jul 19, 2005 11:33:06 AM com.sun.xml.ws.transport.http.servlet.JAXRPCServletDelegate destroy
INFO: JAXRPCSERVLET15: JAX-RPC servlet destroyed
11:33:06,309 INFO [STDOUT] Jul 19, 2005 11:33:06 AM com.sun.xml.ws.transport.ht
tp.servlet.JAXRPCContextListener contextDestroyed
INFO: JAXRPCSERVLET13: JAX-RPC context listener destroyed
11:33:06,700 INFO [TomcatDeployer] deploy, ctxPath=/com.intuit.efe-web_services
, warUrl=file:/C:/efe/local/jboss-4.0.2/server/efe/tmp/deploy/tmp62865com.intuit
.efe-web_services-exp.war/
11:33:06,794 INFO [STDOUT] Jul 19, 2005 11:33:06 AM com.sun.xml.ws.transport.ht
tp.servlet.JAXRPCContextListener contextInitialized
INFO: JAXRPCSERVLET12: JAX-RPC context listener initializing
11:33:06,903 INFO [STDOUT] java.lang.NullPointerException
11:33:06,903 INFO [STDOUT] at com.sun.tools.jxc.XmlSchemaGenerator$Namespac
e.writeTo(XmlSchemaGenerator.java:382)

11:33:06,918 INFO [STDOUT] at com.sun.tools.jxc.XmlSchemaGenerator$Namespac
e.access$800(XmlSchemaGenerator.java:270)
11:33:06,918 INFO [STDOUT] at com.sun.tools.jxc.XmlSchemaGenerator.write(Xm
lSchemaGenerator.java:260)
11:33:06,918 INFO [STDOUT] at com.sun.xml.bind.v2.runtime.JAXBContextImpl.g
-------------------------------------

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
hr_stoyanov
Offline
Joined: 2004-04-01
Points: 0

Doug-,
On the off-line WSDL generation option in apt (or wsgen): Please, keep this thing possible. Some people would like to do automatic builds without the presence of a web container. Besides, during the tunning process, when one experiments with different customizations, it is much easier/faster to get a quick WSDL and schema files genearted, without the deployment step.

Thanks,
Hristo

kohlert
Offline
Joined: 2003-06-16
Points: 0

Thanks for the feedback. Is it sufficient to just have this option on wsgen. That means you would compile with apt but would then run wsgen on the compiled classed to get the WSDL. I know that some would prefer this option to be on apt as well, however, we want to avoid people bundling the WSDL in the WAR file. This way they have to make a concious decision to generate the WSDL.

Thanks again

kohlert
Offline
Joined: 2003-06-16
Points: 0

What version of JAX-WS are you using? It looks like Early access. You should try EA 2.

hr_stoyanov
Offline
Joined: 2004-04-01
Points: 0

Doug-,
Although the download site is confusing, I am pretty sure I got the latest JAX-WS EA2. If you look at the the 'samples/fromjava' example, the 'etc/web.xml' has stuff like this:
------------------------------------

fromjava
fromjava

com.sun.xml.ws.transport.http.servlet.JAXRPCContextListener
fromjava
fromjava
JAX-WS endpoint - fromjava
com.sun.xml.ws.transport.http.servlet.JAXRPCServlet
1

------------------------------------
Apparently, the servlet has not been renamed in JAX-WS and it can be found in the JAX-WS source tree?

I gues my pain is comming from JAX-B though. I got the following warnings compilation warnings from APT:
------------------------------------
[apt] warning: Annotation types without processors: [javax.xml.bind.annotation.XmlRootElement, java.lang.Override, java.lang.SuppressWarnings]
[apt] 1 warning
[apt] warning: Annotation types without processors: [javax.xml.bind.annotation.XmlRootElement, javax.xml.bind.annotation.XmlAccessorType, javax.xml.bind.annotation.XmlType, javax.xml.bind.annotation.XmlElement]
[apt] 1 warning
------------------------------------

Something changed in the bundled JAX-B betwen JAX-RPC EA1 and JAX-WS EA2? I guess this is why I do not egt WSDl generated from apt and the NPE at deployment time ...

kohlert
Offline
Joined: 2003-06-16
Points: 0

Yes, we still need to rename the servlet class as well as a number of other classes.

JAXB is not your problem, we just don't register annotation processors for JAXB annotations anymore so these warnings can be ignored.

Also, as of EA2, the WSDL is no longer generated by the apt task or the wsgen task. The WSDL is now generated at deployment time and you do not need to specify it in your sun-jaxws.xml file. I am not sure what the NPE is coming from. What does your sun-jaxws.xml file look like?

hr_stoyanov
Offline
Joined: 2004-04-01
Points: 0

Doug-,
I guess the EA2 docs have a serious problem then - both apt and wsgen specify they support WSDL generation!

I will send you the code and the sun-jaxws.xml stuff, but I tried to follow the sampl in the '/fromjava' folder.

Thanks,
Hristo

kohlert
Offline
Joined: 2003-06-16
Points: 0

Hristo,
The documentation for APT did have a little mistake in that the -A option specified that the developer could specify the output directory for WSDL and schema. I have removed this.

The wsgen documentation is however, currently correct. I did modify the -wsdl option to make it clear that it is not normally used.

wsgen by default does not generate a WSDL file. You can specify the -wsdl flag to cause it to generate one. The intended use of this flag is to allow the developer to see what the WSDL will be without having to deploy the endpoint. This option should not be used to generate a WSDL to package in the WAR file.

Please let me know if there are any other areas in the docs that need to be cleaned up.

Thanks for your help and patience.

hr_stoyanov
Offline
Joined: 2004-04-01
Points: 0

Thanks Doug,
I think I found the problem and it is indeed a JAXB one - when I comment the first line (@XmlSchema) in my package-info.java, the war deploys without the NPE:
------------------------------------------------------
//@XmlSchema(elementFormDefault=XmlNsForm.UNSET, attributeFormDefault=XmlNsForm.UNSET)
@XmlAccessorType(AccessType.FIELD)

package com.blabla;

import javax.xml.bind.annotation.AccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlSchema;
-------------------------------------------------------

I need to check the JAXB 2.0 specs, but I think Kohsuke adviced me some while ago to do the schema namespace setting in order to get rid of some pesky auto-generated nsX prefix.(Having tight and concise WSDL/schema files is important when you publish official interface documents, but I agree, tools like MS Visual Studio should not care)

Hristo