aspose file tools*
The moose likes Web Services and the fly likes wsgen does not generate correct schema bindings and wsdl file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "wsgen does not generate correct schema bindings and wsdl file" Watch "wsgen does not generate correct schema bindings and wsdl file" New topic
Author

wsgen does not generate correct schema bindings and wsdl file

Sky zhere
Greenhorn

Joined: Sep 30, 2009
Posts: 3
Hi All,

I am trying to build a WebSphere JAX-WS web service using the botton up approach.
I have provided all the necessary annotation in the SEI with a targetNameSpace="ws.dm.mycomp.com" as below

@WebService(serviceName="DecisionControllerWS", name="DecisionControllerWS", targetNamespace="ws.dm.mycomp.com")

The helper classes used by the web service use other classes which are in different packages and are bundled in a jar file and available on the classpath.
I use the "com.sun.tools.ws.ant.WsGen" wsgen ant task to generate the WS artifacts. The problem is that the wsgen only generates the schema bindings for the namespace which I provided in the annotations. It does not generate the schema bindings for the other packages and eventually they are not referred at all in the WSDL file.


Below is the snippet for the WSDL generated by the wsgen ant task

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><definitions targetNamespace="http://dm.mycomp.com" name="DecisionControllerWS" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://dm.mycomp.com" xmlns="http://schemas.xmlsoap.org/wsdl/"> <types> <xsd:schema> <xsd:import namespace="ws.dm.mycomp.com" schemaLocation="DecisionControllerWS_schema1.xsd"/> </xsd:schema> <xsd:schema> <xsd:import namespace="http://dm.mycomp.com" schemaLocation="DecisionControllerWS_schema2.xsd"/> </xsd:schema> </types>........

Snippet of "DecisionControllerWS_schema1.xsd"

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><xs:schema version="1.0" targetNamespace="ws.dm.mycomp.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="ws.dm.mycomp.com" xmlns:ns1="http://dm.mycomp.com">
<xs:import namespace="http://dm.mycomp.com" schemaLocation="DecisionControllerWS_schema2.xsd"/>

Snippet of "DecisionControllerWS_schema2.xsd"

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><xs:schema version="1.0" targetNamespace="ws.dm.mycomp.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="ws.dm.mycomp.com" xmlns:ns1="http://dm.mycomp.com"> <xs:import namespace="http://dm.mycomp.com" schemaLocation="DecisionControllerWS_schema2.xsd"/>.......

Question #1. Why The wsgen task has created 2 schema binding files with one namespace as "http://dm.mycomp.com" which I have not specified anywhere?

Question #2. What am I doing wrong with the wsgen task because of which it is not generating the schema bindings for all the required packages?

Some More Information:

This behavior is quite different to what I observe when I run the IBM WSDK Bean2WebService command line tool provided with RAD 7.0. The WSDL generated there has the schema bindings for all the packages and structures.

Below is a snippet of the WSDL generated by Bean2WebService command line tool

<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions targetNamespace="http://ws.dm.mycomp.com" xmlns:impl="http://ws.dm.mycomp.com" xmlns:intf="http://ws.dm.mycomp.com" xmlns:tns2="http://exception.ws.dm.mycomp.com" xmlns:tns3="http://bean.ra.dm.mycomp2.com" xmlns:tns4="http://sds.ra.dm.mycomp2.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <wsdl:types> <schema targetNamespace="http://ws.dm.mycomp.com" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns3="http://bean.ra.dm.mycomp2.com" xmlns:tns4="http://sds.ra.dm.mycomp2.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <import namespace="http://sds.ra.dm.mycomp2.com"/> <import namespace="http://bean.ra.dm.mycomp2.com"/>....

I have also run the weblogic jwsc ant task on the same SEI and it generates huge number of schema binding files and the generated WSDL has references to all the user defined types with the package name as the namespace.

The incorrect WSDL has an impact when I generate the client artifacts using "wsimport" ant task. The client classes are generated in the "com.mycomp.dm" package which is not the same as their actual package.

Please help me if there something wrong that I am doing and how can I get the correct WSDL generated with wsgen ant task.

Thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: wsgen does not generate correct schema bindings and wsdl file