You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Derek <de...@crc-corp.com> on 2006/06/19 21:56:49 UTC
[Axis2] Apparent bug in WSDL2Java re: imports
Hi, folks.
I have been seeing an apparent bug in the Axis2 WSDL2Java code.
Specifically, I have WSDL that looks like this:
<wsdl:definitions
targetNamespace="http://www.example.com/wsdl/router"
xmlns:schema="http://www.example.com/schemas">
<wsdl:import
namespace="http://www.example.com/schemas"
location="MySchema.xsd"/>
<wsdl:message name="routeEmergencyIncidentRequest">
<wsdl:part name="vehicularEmergencyIncident" type="schema:MyElement"/>
</wsdl:message>
which seems to correctly generate Java code for the types mentioned in
MySchema.xsd, and also produces a RouteEmergencyIncidentRequest type as I
would have expected. However, this code is supposedly illegal according to
http://www.xml.com/pub/a/ws/2003/08/05/wsdl.html
because it uses wsdl:import to import something that is not a WSDL document
but is in fact an XML schema.
However, if I replace it with the following, which is supposedly correct:
<wsdl:definitions
targetNamespace="http://www.example.com/wsdl/router"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:schema="http://www.example.com/schemas">
<wsdl:types>
<xsd:schema>
<xsd:import id="Something"
namespace="http://www.example.com/schemas"
schemaLocation="MySchema.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="routeEmergencyIncidentRequest">
<wsdl:part name="vehicularEmergencyIncident"
type="schema:MyElement"/>
</wsdl:message>
then if I run WSDL2Java, it generates Java code as before for the types
mentioned in MySchema.xsd, but it does NOT produce a RouteEmergencyIncident
class, leaving me nothing to use to parse the OMElement that the generated
server skeleton takes as a parameter. (And, for that matter, I have no idea
why a server skeleton method taking an OMElement parameter is produced,
rather than a MyElement parameter. This also seems like a bug.).
It seems to me that which form of import I use shouldn't determine whether
or not Java types are generated for each message.
The biggest problem for me in this respect is that the second form of the
WSDL (the one using xsd:import) is the one actually used by the WSDL that I
have been given by a third party. So just changing it is not an attractive
option.
Is this a bug?
Any advice would be appreciated.
Thanks!
Derek
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
RE: [Axis2] Apparent bug in WSDL2Java re: imports
Posted by Derek <de...@crc-corp.com>.
>From: Anne Thomas Manes [mailto:atmanes@gmail.com]
>
>Can you post the entire WSDL? The types that should be generated will be
different depending on whether it's RPC or Document style.
>
>WSDL2Java is somewhat forgiving of a common error -- using <wsdl:import> to
import a schema. The fact that it does so isn't a
>bug, although it would be useful if it raised a warning.
>
>Anne
Thanks for the reply, Anne.
I just noticed that this schema is using rpc/encoded, which seems like a
problem -- but it still seems odd that the two different methods of
including the schema produce different results (and no warnings about using
rpc/encoded):
Here is my WSDL. I did some cutting and search-and-replaces on it before
posting to remove some proprietary information, so hopefully I didn't break
anything:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace="http://www.example.com/wsdl/v/router"
xmlns:intf="http://www.example.com/wsdl/v/router"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:v="http://www.example.com/2004/v2.0/schemas/v"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<!-- Uncomment this section and comment out the wsdl:types section for a
version that -->
<!-- produces all the necessary classes to compile successfully, and
doesn't take an OMElement
<!-- as a parameter -->
<!--<wsdl:import-->
<!--namespace="http://www.example.com/2004/v2.0/schemas/v"-->
<!--location="BrokenWsdl.xsd"/>-->
<wsdl:types>
<xsd:schema>
<xsd:import id="IDataExchange"
namespace="http://www.example.com/2004/v2.0/schemas/v"
schemaLocation="BrokenWsdl.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="reiRequest">
<wsdl:part name="I"
type="v:IType"/>
</wsdl:message>
<wsdl:message name="reiResponse">
<wsdl:part name="return" type="soapenc:boolean"/>
</wsdl:message>
<wsdl:portType name="V">
<wsdl:operation name="rei"
parameterOrder="I">
<wsdl:documentation>
</wsdl:documentation>
<wsdl:input name="reiRequest"
message="intf:reiRequest"/>
<wsdl:output name="reiResponse"
message="intf:reiResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="VSoapBinding" type="intf:V">
<wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="rei">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="reiRequest">
<wsdlsoap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://www.example.com/wsdl/v/router"/>
</wsdl:input>
<wsdl:output name="reiResponse">
<wsdlsoap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://www.example.com/wsdl/v/router"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="VService">
<wsdl:port name="V" binding="intf:VSoapBinding">
<wsdlsoap:address
location="http://127.0.0.1:8080/axis/services/V"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Here is the referenced BrokenWsdl.xsd schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.example.com/2004/v2.0/schemas/v"
xmlns:v="http://www.example.com/2004/v2.0/schemas/v"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.0" id="VEIRecord">
<xs:element name="I" type="v:IType"/>
<xs:complexType name="IType">
<xs:all>
<!-- various other elements go here -->
</xs:all>
</xs:complexType>
</xs:schema>
-----Original Message-----
From: Anne Thomas Manes [mailto:atmanes@gmail.com]
Sent: Monday, June 19, 2006 5:09 PM
To: axis-user@ws.apache.org; derek-axis@crc-corp.com
Subject: Re: [Axis2] Apparent bug in WSDL2Java re: imports
Can you post the entire WSDL? The types that should be generated will be
different depending on whether it's RPC or Document style.
WSDL2Java is somewhat forgiving of a common error -- using <wsdl:import> to
import a schema. The fact that it does so isn't a bug, although it would be
useful if it raised a warning.
Anne
On 6/19/06, Derek <de...@crc-corp.com> wrote:
Hi, folks.
I have been seeing an apparent bug in the Axis2 WSDL2Java code.
Specifically, I have WSDL that looks like this:
<wsdl:definitions
targetNamespace=" http://www.example.com/wsdl/router"
xmlns:schema="http://www.example.com/schemas">
<wsdl:import
namespace=" http://www.example.com/schemas"
location="MySchema.xsd"/>
<wsdl:message name="routeEmergencyIncidentRequest">
<wsdl:part name="vehicularEmergencyIncident" type="schema:MyElement"/>
</wsdl:message>
which seems to correctly generate Java code for the types mentioned in
MySchema.xsd, and also produces a RouteEmergencyIncidentRequest type as I
would have expected. However, this code is supposedly illegal according to
http://www.xml.com/pub/a/ws/2003/08/05/wsdl.html
because it uses wsdl:import to import something that is not a WSDL document
but is in fact an XML schema.
However, if I replace it with the following, which is supposedly correct:
<wsdl:definitions
targetNamespace="http://www.example.com/wsdl/router "
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:schema="http://www.example.com/schemas">
<wsdl:types>
<xsd:schema>
<xsd:import id="Something"
namespace="http://www.example.com/schemas"
schemaLocation="MySchema.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="routeEmergencyIncidentRequest">
<wsdl:part name="vehicularEmergencyIncident"
type="schema:MyElement"/>
</wsdl:message>
then if I run WSDL2Java, it generates Java code as before for the types
mentioned in MySchema.xsd, but it does NOT produce a RouteEmergencyIncident
class, leaving me nothing to use to parse the OMElement that the generated
server skeleton takes as a parameter. (And, for that matter, I have no idea
why a server skeleton method taking an OMElement parameter is produced,
rather than a MyElement parameter. This also seems like a bug.).
It seems to me that which form of import I use shouldn't determine whether
or not Java types are generated for each message.
The biggest problem for me in this respect is that the second form of the
WSDL (the one using xsd:import) is the one actually used by the WSDL that I
have been given by a third party. So just changing it is not an attractive
option.
Is this a bug?
Any advice would be appreciated.
Thanks!
Derek
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: [Axis2] Apparent bug in WSDL2Java re: imports
Posted by Anne Thomas Manes <at...@gmail.com>.
Can you post the entire WSDL? The types that should be generated will be
different depending on whether it's RPC or Document style.
WSDL2Java is somewhat forgiving of a common error -- using <wsdl:import> to
import a schema. The fact that it does so isn't a bug, although it would be
useful if it raised a warning.
Anne
On 6/19/06, Derek <de...@crc-corp.com> wrote:
>
> Hi, folks.
>
> I have been seeing an apparent bug in the Axis2 WSDL2Java code.
> Specifically, I have WSDL that looks like this:
>
> <wsdl:definitions
> targetNamespace="http://www.example.com/wsdl/router"
> xmlns:schema="http://www.example.com/schemas">
>
> <wsdl:import
> namespace="http://www.example.com/schemas"
> location="MySchema.xsd"/>
>
> <wsdl:message name="routeEmergencyIncidentRequest">
> <wsdl:part name="vehicularEmergencyIncident"
> type="schema:MyElement"/>
> </wsdl:message>
>
> which seems to correctly generate Java code for the types mentioned in
> MySchema.xsd, and also produces a RouteEmergencyIncidentRequest type as I
> would have expected. However, this code is supposedly illegal according to
>
> http://www.xml.com/pub/a/ws/2003/08/05/wsdl.html
>
> because it uses wsdl:import to import something that is not a WSDL
> document
> but is in fact an XML schema.
>
> However, if I replace it with the following, which is supposedly correct:
>
> <wsdl:definitions
> targetNamespace="http://www.example.com/wsdl/router"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:schema="http://www.example.com/schemas">
>
> <wsdl:types>
> <xsd:schema>
> <xsd:import id="Something"
> namespace="http://www.example.com/schemas"
> schemaLocation="MySchema.xsd"/>
> </xsd:schema>
> </wsdl:types>
>
> <wsdl:message name="routeEmergencyIncidentRequest">
> <wsdl:part name="vehicularEmergencyIncident"
> type="schema:MyElement"/>
> </wsdl:message>
>
> then if I run WSDL2Java, it generates Java code as before for the types
> mentioned in MySchema.xsd, but it does NOT produce a
> RouteEmergencyIncident
> class, leaving me nothing to use to parse the OMElement that the generated
> server skeleton takes as a parameter. (And, for that matter, I have no
> idea
> why a server skeleton method taking an OMElement parameter is produced,
> rather than a MyElement parameter. This also seems like a bug.).
>
> It seems to me that which form of import I use shouldn't determine whether
> or not Java types are generated for each message.
>
> The biggest problem for me in this respect is that the second form of the
> WSDL (the one using xsd:import) is the one actually used by the WSDL that
> I
> have been given by a third party. So just changing it is not an attractive
> option.
>
> Is this a bug?
>
> Any advice would be appreciated.
>
> Thanks!
>
> Derek
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>