Hi all OK. I had a look at it. For Pat's file the following is the issue (not sure if the same applies to DM below).
Pat's WSDL contains the following (at the top-level - just inside the
<xsd:schema> element):
<xsd:complexType name="PKnException" />
<xsd:element name="PKnException" type="tns:PKnException" />
And his .xsdconfig file contains the following:
<xb:qname name="pkn:PKnException" javaname="PKnException_exc" />
Now when XmlBeans comes to generate classes for those types/elements we
obey the following rules:
1. Generate a separate .java file for every global type or element
(non-global elements/types are inner interfaces within the global .java
files)
2. By default the name of the class for an element has "Document"
appended to it. By default the name of the class for a type has nothing
appended to it.
3. But in either case if there is an xsdconfig file which applies to
that element or type then use the mapping rule defined within the
.xsdconfig file to decide what name to use for the class (and do not
append anything)
4. However when we generate a potential class name we check to see if it
is already in use - if it is then we add "2" or "3" or ... to the end of
the name to avoid collisions.
So when we go through this process for Pat's schema (inside the WSDL) we
try to map _both_ the global complex type PKnException to a class with
name PKnException_exc _and_ we try to map the element PKnException to a
class with name PKnException_exc. It looks like we try to generate names
for the global elements first - so the global element PKnException gets
mapped to PKnException_exc. Then when we try to generate a class name
for the global type PKnException, we use the mapping which says we
should use name PKnException_exc but find that that is already in use
and so generate PKnException_exc2 instead.
(This is also the reason why you said you only saw 1 class for the
exception when no .xsdconfig file is used - in fact there are 2 but the
one for the element is called PKnExceptionDocument by default).
Now the model of having global elements and global types within schemas
with the same name is a common one - so I think XmlBeans ought to
provide a way of saying (in the .xsdconfig file) that "this mapping only
applies to elements | types". To this end I have raised a JIRA - see
https://issues.apache.org/jira/browse/XMLBEANS-253.
However that may take a bit of time to actually implement. So in the
meantime I would suggest one of the following:
1. change the QName of the complex type - if the QNames don't clash then
we won't have this problem and you can map either or both separately
2. change the complex type so that it is an anonymous inner type (as you
already have for the other 2 elements in your schema) rather than a
global type.
Cheers,
Lawrence
> -----Original Message-----
> From: DM [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 14, 2006 4:10 AM
> To: [email protected]
> Subject: Re: generationg bean from schema with different name
>
> Hi,
>
> Just wondering if this was resolved as I've been having the same
problem
> myself. In the .xsdconfig
> I request an alias of 'AlternativeClassnameThatDefinitelyDoesntClash'
and
> it generates a class
> 'AlternativeClassnameThatDefinitelyDoesntClash2'.
>
> Cheers,
> DM
> --- pat <[EMAIL PROTECTED]> wrote:
>
> > Hi Lawrence,
> >
> > Well, I'm generating the beans from the wsdl file (attached). The
> > original class has one method which throws an exception.
> >
> > Withoud the xsdconfig there's only one exception and when the
xsdconfig
> > is used then there are two :-\
> >
> > Thanks for your help.
> >
> > Pat
> >
> > Lawrence Jones wrote:
> > > Hi Pat
> > >
> > > I would suspect you have some combination of either existing
QNames or
> > > other mappings such that you've ended up mapping 2 QNames to the
same
> > > class name. In that situation I think XmlBeans starts adding
numbers
> to
> > > the end of the class names to avoid collisions.
> > >
> > > If that's not the case if you can attach your schema and
.xsdconfig
> file
> > > and we can take a look and see what the issue is.
> > >
> > > Cheers,
> > >
> > > Lawrence
> > >
> > >
> > >>-----Original Message-----
> > >>From: pat [mailto:[EMAIL PROTECTED]
> > >>Sent: Friday, March 10, 2006 8:04 AM
> > >>To: [email protected]
> > >>Subject: Re: generationg bean from schema with different name
> > >>
> > >>Tahnks, that helps.
> > >>
> > >>I have one more question about it. When I use the
> > >><xb:qname name="pkg:Test" javaname="TestX"/>
> > >>the generator generates more then one class for it; e.g.:
> > >>TestX
> > >>TestX2
> > >>etc.
> > >>
> > >>How can I avoid this generation of the classes with numbers ??? I
want
> > >>only one class TestX.
> > >>
> > >>Thanks a lot.
> > >>
> > >> Pat
> > >>
> > >>Lawrence Jones wrote:
> > >>
> > >>>Hi all
> > >>>
> > >>>
> > >>>
> > >>>Alex is quite right about .xsdconfig, and his example will work
fine
> > >
> > > but
> > >
> > >>>note it will change the _/package name/_ of all generated beans
for
> > >
> > > that
> > >
> > >>>namespace. If you wanted to change the class name of the
generated
> > >
> > > bean
> > >
> > >>>then that too is supported via .xsdconfig but this time using the
> > >>><qname> element:
> > >>>
> > >>>
> > >>>
> > >>><xb:config ...>
> > >>>
> > >>> <xb:qname name="xxx" javaname="package1.package2.MyClass" />
> > >>>
> > >>></xb:config
> > >>>
> > >>>
> > >>>
> > >>>That will map the QName xxx to a class with Java name
> > >>>package1.package2.MyClass. Note xxx is a standard QName and so
needs
> > >
> > > to
> > >
> > >>>be defined as something like "ppp:LocalName" where ppp is a
prefix
> > >
> > > for a
> > >
> > >>>known namespace.
> > >>>
> > >>>
> > >>>
> > >>>Cheers,
> > >>>
> > >>>
> > >>>
> > >>>Lawrence
> > >>>
> > >>>
> > >>>
> > >>>
> > >
> > >
----------------------------------------------------------------------
> --
> > >
> > >>>*From:* Alex Soto [mailto:[EMAIL PROTECTED]
> > >>>*Sent:* Thursday, March 09, 2006 6:33 AM
> > >>>*To:* [email protected]
> > >>>*Subject:* Re: generationg bean from schema with different name
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>yes using a file ended with .xsdconfig. I send you an example:
> > >>>
> > >>><?xml version="1.0" encoding="UTF-8"?>
> > >>><xb:config
> > >>> xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config">
> > >>>
> > >>><xb:namespace uri="http://www.w3.org/2000/09/xmldsig#
> > >>><http://www.w3.org/2000/09/xmldsig>">
> > >>><xb:package>com.example.xmlbeans</xb:package>
> > >>></xb:namespace>
> > >>>
> > >>></xb:config>
> > >>>
> > >>>BE aware because this file must be into classpath. In ant file do
:
> > >>>
> > >>><xmlbean javasource="1.5"
> > >>>srcgendir="${dest.dir}/lib/sources/${output.name.importer}"
> > >>>classpath="${root}/lib/xbean.jar;${root}/lib/jsr173_1.0_api.jar"
> > >>>classgendir="${dest.dir}/classes"
> > >>>destfile="${dest.dir}/${output.name.importer}.jar" debug="true"
> > >>>noupa="true">
> > >>><fileset dir="." includes="*.*"/>
> > >>></xmlbean>
> > >>>
> > >>>Look that fileset . is the directory where i have my xsd file and
> > >>
> > >>.xsdconfig
> > >>
> > >>>El dj 09 de 03 del 2006 a les 15:16 +0100, en/na pat va escriure:
> > >>>
> > >>>
> > >>>
> > >>>Hi all,
> > >>>
> > >>>
> > >>>
> > >>>I want to generate xmlbean from the xml schema but with different
> > >
> > > name
> > >
> > >>than it
> > >>
> > >>>is in the schema (e.g. in schema is Beans and generated will be
> > >
> > > MyBean).
> > >
> > >>>
> > >>>
> > >>>Why I need it is that I need to use AXIS2 with XMLBeans support,
but
> > >
> > > on
> > >
> > >>the
> > >>
> > >>>client side I need different names os on the server - this is
only
> > >
> > > one
> > >
> > >>way
> > >>
> > >>>from server to client.
> > >>>
> > >>>
> > >>>
> > >>>Is there a way how to do it ???
> > >>>
> > >>>
> > >>>
> > >>>Thanks a lot.
> > >>>
> > >>>
> > >>>
> > >>> Pat
> > > <?xml version="1.0" encoding="UTF-8"?>
> > <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:tns="http://pkntest"
> > xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://pkntest">
> > <wsdl:types>
> > <xsd:schema targetNamespace="http://pkntest"
> elementFormDefault="qualified"
> > attributeFormDefault="qualified">
> > <xsd:element name="pknmethod">
> > <xsd:complexType />
> > </xsd:element>
> > <xsd:element name="pknmethodResponse">
> > <xsd:complexType />
> > </xsd:element>
> > <xsd:complexType name="PKnException" />
> > <xsd:element name="PKnException" type="tns:PKnException" />
> > </xsd:schema>
> > </wsdl:types>
> > <wsdl:message name="pknmethodResponse">
> > <wsdl:part element="tns:pknmethodResponse" name="parameters" />
> > </wsdl:message>
> > <wsdl:message name="PKnException">
> > <wsdl:part element="tns:PKnException" name="PKnException" />
> > </wsdl:message>
> > <wsdl:message name="pknmethodRequest">
> > <wsdl:part element="tns:pknmethod" name="parameters" />
> > </wsdl:message>
> > <wsdl:portType name="testPortType">
> > <wsdl:operation name="pknmethod">
> > <wsdl:input message="tns:pknmethodRequest"
name="pknmethodRequest"
> />
> > <wsdl:output message="tns:pknmethodResponse"
> name="pknmethodResponse" />
> > <wsdl:fault message="tns:PKnException" name="PKnException" />
> > </wsdl:operation>
> > </wsdl:portType>
> > <wsdl:binding name="testHttpBinding" type="tns:testPortType">
> > <wsdlsoap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http" />
> > <wsdl:operation name="pknmethod">
> > <wsdlsoap:operation soapAction="" />
> > <wsdl:input name="pknmethodRequest">
> > <wsdlsoap:body use="literal" />
> > </wsdl:input>
> > <wsdl:output name="pknmethodResponse">
> > <wsdlsoap:body use="literal" />
> > </wsdl:output>
> > <wsdl:fault name="PKnException">
> > <wsdlsoap:fault name="PKnException" use="literal" />
> > </wsdl:fault>
> > </wsdl:operation>
> > </wsdl:binding>
> > <wsdl:service name="test">
> > <wsdl:port binding="tns:testHttpBinding" name="testHttpPort">
> > <wsdlsoap:address
location="http://localhost:8080/axis2srv/test"
> />
> > </wsdl:port>
> > </wsdl:service>
> > </wsdl:definitions>
> >
> > > <xb:config
> xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config"
> > xmlns:pkn="http://pkntest">
> > <xb:namespace uri="##any">
> > <!--xb:package>com.cleverbee</xb:package-->
> > <!--xb:prefix>Xml</xb:prefix-->
> > <!--xb:suffix>Bean</xb:suffix-->
> > </xb:namespace>
> >
> > <xb:qname name="pkn:PKnException" javaname="PKnException_exc" />
> >
> > </xb:config>
> >
> > >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
> ___________________________________________________________
> NEW Yahoo! Cars - sell your car and browse thousands of new and used
cars
> online! http://uk.cars.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
test_orig.wsdl
Description: test_orig.wsdl
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

