users@jax-ws.java.net

Re: wsgen issue: not using schema provided

From: Jitendra Kotamraju <Jitendra.Kotamraju_at_Sun.COM>
Date: Mon, 28 Aug 2006 14:04:50 -0700

In this case, jax-ws runtime is generating new WSDL and schema documents
from java classes. If you have started with the WSDL, this would have
been easy. You just need to specify the WSDL in sun-jaxws.xml and
package the WSDL documents in the war. Can you try packaging the schema
at WEB-INF/wsdl/poks.xsd in the war file, and see if the schema is picked.

Jitu

Chua, Jerson (Exchange) wrote:

> Here are steps that I did.
>
>
>
> 1. Created my own schema (poks.xsd)
>
>
>
> <xs:schema targetNamespace="urn:mycompany.com:mc.web.poks:1.0"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:tns="urn:mycompany.com:mc.web.poks:1.0"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
>
> <xs:element name="RrNumber">
>
> <xs:simpleType>
>
> <xs:restriction base="xs:token">
>
> <xs:length value="4"/>
>
> </xs:restriction>
>
> </xs:simpleType>
>
> </xs:element>
>
> <xs:element name="RrName">
>
> <xs:simpleType>
>
> <xs:restriction base="xs:string">
>
> <xs:maxLength value="29"/>
>
> </xs:restriction>
>
> </xs:simpleType>
>
> </xs:element>
>
> <xs:complexType name="RRInfoType">
>
> <xs:sequence>
>
> <xs:element ref="tns:RrNumber"/>
>
> <xs:element ref="tns:RrName"
> minOccurs="0"/>
>
> </xs:sequence>
>
> </xs:complexType>
>
> </xs:schema>
>
>
>
>
>
> 2. Generate JAXB classes with following ant task
>
>
>
> <target name="generate-jaxb-classes">
>
> <echo message="Compiling the schema..." />
>
> <xjc package="com.bear.poks.jaxb" target="${src.dir}">
>
> <schema dir="${schema.dir}" includes="*.xsd"/>
>
> <produces dir="${src.dir}/com/bear/poks/jaxb"
> includes="**/*.java" />
>
> </xjc>
>
> </target>
>
>
>
> 3. Create end point implementation in Netbeans using the generated
> JAXB class as a return type
>
>
>
> package com.bear.poks.webservice;
>
>
>
> import com.bear.poks.jaxb.RRInfoType;
>
> import java.util.ArrayList;
>
> import java.util.List;
>
> import javax.jws.WebService;
>
> import javax.jws.WebMethod;
>
> import javax.jws.WebParam;
>
>
>
> /**
>
> *
>
> * @author jchua
>
> */
>
> @WebService()
>
> public class PoksService {
>
>
>
> /**
>
> * Web service operation
>
> */
>
> @WebMethod
>
> public List<RRInfoType> getRrsForUser(@WebParam(name = "userId")
> String userId, @WebParam(name = "rrNo") String rrNo, @WebParam(name =
> "occd") String occd) throws com.bear.poks.exception.poksException {
>
> List<RRInfoType> list = new ArrayList<RRInfoType>();
>
>
>
> RRInfoType rr1 = new RRInfoType();
>
> rr1.setRrName("Jane Doe");
>
> rr1.setRrNumber("1234");
>
>
>
> RRInfoType rr2 = new RRInfoType();
>
> rr1.setRrName("John Doe");
>
> rr1.setRrNumber("56789");
>
>
>
> return list;
>
> }
>
> }
>
>
>
> 4. Deploy application in Tomcat
>
>
>
>
>
> The problem is that the generated WSDL doesn't use poks.xsd that I
> created. The generated schema (xsd=1) doesn't have the restrictions
> that I've defined in poks.xsd.
>
>
>
> ...
>
> <types>
>
> <xsd:schema>
>
> <xsd:import namespace="urn:mycompany.com:mc.web.poks:1.0"
> schemaLocation="http://localhost:8084/poks_ws/poksService?xsd=1" />
>
> </xsd:schema>
>
> <xsd:schema>
>
> <xsd:import namespace="http://webservice.poks.bear.com/"
> schemaLocation="http://localhost:8084/poks_ws/poksService?xsd=2" />
>
> </xsd:schema>
>
> </types>
>
> ...
>
>
>
> How can I force to wsgen to use the poks.xsd in the WSDL? Please
> advice. Thanks.
>
>------------------------------------------------------------------------
>
>
>
>***********************************************************************
>Bear Stearns is not responsible for any recommendation, solicitation,
>offer or agreement or any information about any transaction, customer
>account or account activity contained in this communication.
>***********************************************************************
>
>
>
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
>For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
>
>