You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Monica Ferrero <mf...@accelrys.com> on 2007/11/06 11:40:10 UTC

xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified"


Hi!

The wsdl generated from cxf has in the schema definition:
attributeFormDefault="unqualified" elementFormDefault="unqualified"
I need these to be generated as "qualified".
What do I need to do  for these to be generated as qualified? Is there any
annotation for this? Or any specific way of defining the service?
Bellow the wsdl:types from wsdl exposed at
http://localhost:8080/lmqs/ws/ListService?wsdl and my ws interface.

Thanks for your help,

Monica


<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap
="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ls.lmqs.acc.com/
" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="LM" targetNamespace="
http://ls.lmqs.acc.com/">
      <wsdl:types>
            <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="unqualified"
targetNamespace="http://ls.lmqs.acc.com/" xmlns:tns="
http://ls.lmqs.acc.com/">
                  <xs:complexType name="stringArray">
                        <xs:sequence>
                              <xs:element form="qualified" maxOccurs="
unbounded" name="item" nillable="true" type="xs:string"/>
                        </xs:sequence>
                  </xs:complexType>
                  <xs:complexType name="info">
                        <xs:sequence>
                              <xs:element form="qualified" minOccurs="0"
name="date" type="xs:dateTime"/>
                              <xs:element form="qualified" name="id" type="
xs:int"/>
                              <xs:element form="qualified" minOccurs="0"
name="name" type="xs:string"/>
                              <xs:element form="qualified" minOccurs="0"
name="owner" type="xs:string"/>
                              <xs:element form="qualified" minOccurs="0"
name="query" type="xs:string"/>
                              <xs:element form="qualified" name="size" type
="xs:int"/>
                              <xs:element form="qualified" name="status"
type="xs:int"/>
                        </xs:sequence>
                  </xs:complexType>
                  <xs:complexType name="infoArray">
                        <xs:sequence>
                              <xs:element form="qualified" maxOccurs="
unbounded" name="item" nillable="true" type="tns:info"/>
                        </xs:sequence>
                  </xs:complexType>
                  <xs:complexType name="data">
                        <xs:complexContent>
                              <xs:extension base="tns:info">
                                    <xs:sequence>
                                          <xs:element form="qualified"
maxOccurs="unbounded" name="data" nillable="true" type="xs:int"/>
                                    </xs:sequence>
                              </xs:extension>
                        </xs:complexContent>
                  </xs:complexType>
                  <xs:element name="id" nillable="true" type="xs:int"/>
                  <xs:element name="data" nillable="true" type="tns:data"/>
                  <xs:element name="infos" nillable="true" type="
tns:infoArray"/>
                  <xs:element name="dsId" nillable="true" type="xs:int"/>
                  <xs:element name="name" nillable="true" type="xs:string
"/>
                  <xs:element name="def" nillable="true" type="xs:string"/>
                  <xs:element name="newId" nillable="true" type="xs:int"/>
                  <xs:element name="dss" nillable="true" type="
tns:stringArray"/>
                  <xs:element name="info" nillable="true" type="tns:info"/>
            </xs:schema>
      </wsdl:types>
[....]

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

package com.acc.lmqs.ls;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;

@WebService(targetNamespace="http://ls.lmqs.acc.com/", name = "LM")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface LM {

    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
    @WebMethod
    @WebResult(targetNamespace = "http://ls.lmqs.acc.com/", partName=
"newId", name="newId")
    public int newL(
        @WebParam(targetNamespace = "http://ls.lmqs.acc.com/", partName=
"dsId", name="dsId")
        int ds,
        @WebParam(targetNamespace = "http://ls.lmqs.acc.com/", partName=
"name", name="name")
        String name,
        @WebParam(targetNamespace = "http://ls.lmqs.acc.com/", partName=
"query", name="query")
        String query
    );

    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
    @WebResult(targetNamespace = "http://ls.lmqs.acc.com/", partName="info"
, name="info"  )
    @WebMethod
    public Info getInfo(
        @WebParam(targetNamespace = "http://ls.lmqs.acc.com/", partName=
"id", name="id")
        int id
    );

    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
    @WebResult(targetNamespace = "http://ls.lmqs.acc.com/",partName="data",
name="data")
    @WebMethod
    public Data getData(
      @WebParam(targetNamespace = "http://ls.lmqs.acc.com/", partName="id",
name="id")
        int id
    );

    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
    @WebResult(targetNamespace = "http://ls.lmqs.acc.com/", partName=
"infos", name="infos")
    @WebMethod
    public InfoArray getLists();

    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
    @WebResult(targetNamespace = "http://ls.lmqs.acc.com/", partName =
"dss", name = "dss")
    @WebMethod
    public StringArray getDsNames();

}Accelrys Limited (http://www.accelrys.com) 
Registered office: 334 Cambridge Science Park, Cambridge, CB4 0WN, UK 
Registered in England: 2326316   

Re: xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified"

Posted by Jim Ma <em...@iona.com>.
Hi ,
You can annotate the package-info.java  with " XmlNsForm.QUALIFIED" like 
this :

@javax.xml.bind.annotation.XmlSchema(namespace = "http://example.org",
                                                              
attributeFormDefault=javax.xml.bind.annotation.XmlNsForm.QUALIFIED,
                                                              
elementFormDefault=javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package org.example;

Regards

Jim

Monica Ferrero wrote:
> Hi!
>
> The wsdl generated from cxf has in the schema definition:
> attributeFormDefault="unqualified" elementFormDefault="unqualified"
> I need these to be generated as "qualified".
> What do I need to do  for these to be generated as qualified? Is there any
> annotation for this? Or any specific way of defining the service?
> Bellow the wsdl:types from wsdl exposed at
> http://localhost:8080/lmqs/ws/ListService?wsdl and my ws interface.
>
> Thanks for your help,
>
> Monica
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap
> ="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ls.lmqs.acc.com/
> " xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="LM" targetNamespace="
> http://ls.lmqs.acc.com/">
>       <wsdl:types>
>             <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> attributeFormDefault="unqualified" elementFormDefault="unqualified"
> targetNamespace="http://ls.lmqs.acc.com/" xmlns:tns="
> http://ls.lmqs.acc.com/">
>                   <xs:complexType name="stringArray">
>                         <xs:sequence>
>                               <xs:element form="qualified" maxOccurs="
> unbounded" name="item" nillable="true" type="xs:string"/>
>                         </xs:sequence>
>                   </xs:complexType>
>                   <xs:complexType name="info">
>                         <xs:sequence>
>                               <xs:element form="qualified" minOccurs="0"
> name="date" type="xs:dateTime"/>
>                               <xs:element form="qualified" name="id" type="
> xs:int"/>
>                               <xs:element form="qualified" minOccurs="0"
> name="name" type="xs:string"/>
>                               <xs:element form="qualified" minOccurs="0"
> name="owner" type="xs:string"/>
>                               <xs:element form="qualified" minOccurs="0"
> name="query" type="xs:string"/>
>                               <xs:element form="qualified" name="size" type
> ="xs:int"/>
>                               <xs:element form="qualified" name="status"
> type="xs:int"/>
>                         </xs:sequence>
>                   </xs:complexType>
>                   <xs:complexType name="infoArray">
>                         <xs:sequence>
>                               <xs:element form="qualified" maxOccurs="
> unbounded" name="item" nillable="true" type="tns:info"/>
>                         </xs:sequence>
>                   </xs:complexType>
>                   <xs:complexType name="data">
>                         <xs:complexContent>
>                               <xs:extension base="tns:info">
>                                     <xs:sequence>
>                                           <xs:element form="qualified"
> maxOccurs="unbounded" name="data" nillable="true" type="xs:int"/>
>                                     </xs:sequence>
>                               </xs:extension>
>                         </xs:complexContent>
>                   </xs:complexType>
>                   <xs:element name="id" nillable="true" type="xs:int"/>
>                   <xs:element name="data" nillable="true" type="tns:data"/>
>                   <xs:element name="infos" nillable="true" type="
> tns:infoArray"/>
>                   <xs:element name="dsId" nillable="true" type="xs:int"/>
>                   <xs:element name="name" nillable="true" type="xs:string
> "/>
>                   <xs:element name="def" nillable="true" type="xs:string"/>
>                   <xs:element name="newId" nillable="true" type="xs:int"/>
>                   <xs:element name="dss" nillable="true" type="
> tns:stringArray"/>
>                   <xs:element name="info" nillable="true" type="tns:info"/>
>             </xs:schema>
>       </wsdl:types>
> [....]
>
> ----------------------------------------------------------------------------------------
>
> package com.acc.lmqs.ls;
>
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
>
> @WebService(targetNamespace="http://ls.lmqs.acc.com/", name = "LM")
> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> public interface LM {
>
>     @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>     @WebMethod
>     @WebResult(targetNamespace = "http://ls.lmqs.acc.com/", partName=
> "newId", name="newId")
>     public int newL(
>         @WebParam(targetNamespace = "http://ls.lmqs.acc.com/", partName=
> "dsId", name="dsId")
>         int ds,
>         @WebParam(targetNamespace = "http://ls.lmqs.acc.com/", partName=
> "name", name="name")
>         String name,
>         @WebParam(targetNamespace = "http://ls.lmqs.acc.com/", partName=
> "query", name="query")
>         String query
>     );
>
>     @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>     @WebResult(targetNamespace = "http://ls.lmqs.acc.com/", partName="info"
> , name="info"  )
>     @WebMethod
>     public Info getInfo(
>         @WebParam(targetNamespace = "http://ls.lmqs.acc.com/", partName=
> "id", name="id")
>         int id
>     );
>
>     @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>     @WebResult(targetNamespace = "http://ls.lmqs.acc.com/",partName="data",
> name="data")
>     @WebMethod
>     public Data getData(
>       @WebParam(targetNamespace = "http://ls.lmqs.acc.com/", partName="id",
> name="id")
>         int id
>     );
>
>     @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>     @WebResult(targetNamespace = "http://ls.lmqs.acc.com/", partName=
> "infos", name="infos")
>     @WebMethod
>     public InfoArray getLists();
>
>     @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>     @WebResult(targetNamespace = "http://ls.lmqs.acc.com/", partName =
> "dss", name = "dss")
>     @WebMethod
>     public StringArray getDsNames();
>
> }Accelrys Limited (http://www.accelrys.com) 
> Registered office: 334 Cambridge Science Park, Cambridge, CB4 0WN, UK 
> Registered in England: 2326316   
>