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 Anna Krajewska <a....@wasko.pl> on 2006/01/26 14:18:32 UTC

Problem with XSD schemas of the web-service parameter and response

Hi

I have a problem with schema validation in axis. The thing is that I've
created wsdl file describing my web service interface, the file imports some
other xsd files that describes web-service parameter and reponse. The
problem is that in the parameter element and reponse element I've got the
same names of subelements. For egzample I have main patrameter element
PARAMETER and main response element RESPONSE. In xsd file they reference to
different groups that contain elements with the same names:

<xs:element name="PARAMETER">
<xs:complexType>
<xs:group ref="ns1:group1"/>
</xs:complexType>
</xs:element>
</xs:schema>

<xs:element name="RESPONSE">
<xs:complexType>
<xs:group ref="ns1:group2"/>
</xs:complexType>
</xs:element>
</xs:schema>

Groups look like this:

<xs:group name="group1">
<xs:sequence>
<xs:element name="ELEMENT1" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="RECORD" maxOccurs="unbounded">
<xs:complexType>
<xs:complexContent>
<xs:extension base="some_base1"/>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:group>

<xs:group name="group2">
<xs:sequence>
<xs:element name="ELEMENT1" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="RECORD" maxOccurs="unbounded">
<xs:complexType>
<xs:complexContent>
<xs:extension base="some_base2"/>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:group>

The thing is that when axis validates soap messages it returns errors. I
suspect that it thinks that REPONSE = PARAMETER because they have references
to groups that have the same named elements ELEMENT1. I created my
web-service using Eclipse - I created WSDL file and schemas in xsd and with
this base I generated whole web-service (web-service classes and classes
that represents parameter and response of the web-service.) I think eclipse
identify elements in schema with their names and namespaces - because in
this schema ELEMENT1 from group1 and from group2 have the same names and
namespaces - eclipse generated for both elements one class (which is corrent
for only one of them). I wonder if this is only eclipse bug or also axis. Do
I have to change tool from eclipse or maybe it won't help because axis also
will treat those elements the same way? What should I do to fix that without
schema changing?

If someone had the same problem in the past and knows the answear - please
help! Any comment appreciated!

Regards

ania


Re: Problem with XSD schemas of the web-service parameter and response

Posted by Anne Thomas Manes <at...@gmail.com>.
Make sure that you specify elementFormDefault="unqualified".

On 1/26/06, Anna Krajewska <a....@wasko.pl> wrote:
>
> Hi
>
> I have a problem with schema validation in axis. The thing is that I've
> created wsdl file describing my web service interface, the file imports
> some
> other xsd files that describes web-service parameter and reponse. The
> problem is that in the parameter element and reponse element I've got the
> same names of subelements. For egzample I have main patrameter element
> PARAMETER and main response element RESPONSE. In xsd file they reference
> to
> different groups that contain elements with the same names:
>
> <xs:element name="PARAMETER">
> <xs:complexType>
> <xs:group ref="ns1:group1"/>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> <xs:element name="RESPONSE">
> <xs:complexType>
> <xs:group ref="ns1:group2"/>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> Groups look like this:
>
> <xs:group name="group1">
> <xs:sequence>
> <xs:element name="ELEMENT1" minOccurs="0">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="RECORD" maxOccurs="unbounded">
> <xs:complexType>
> <xs:complexContent>
> <xs:extension base="some_base1"/>
> </xs:complexContent>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:group>
>
> <xs:group name="group2">
> <xs:sequence>
> <xs:element name="ELEMENT1" minOccurs="0">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="RECORD" maxOccurs="unbounded">
> <xs:complexType>
> <xs:complexContent>
> <xs:extension base="some_base2"/>
> </xs:complexContent>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:group>
>
> The thing is that when axis validates soap messages it returns errors. I
> suspect that it thinks that REPONSE = PARAMETER because they have
> references
> to groups that have the same named elements ELEMENT1. I created my
> web-service using Eclipse - I created WSDL file and schemas in xsd and
> with
> this base I generated whole web-service (web-service classes and classes
> that represents parameter and response of the web-service.) I think
> eclipse
> identify elements in schema with their names and namespaces - because in
> this schema ELEMENT1 from group1 and from group2 have the same names and
> namespaces - eclipse generated for both elements one class (which is
> corrent
> for only one of them). I wonder if this is only eclipse bug or also axis.
> Do
> I have to change tool from eclipse or maybe it won't help because axis
> also
> will treat those elements the same way? What should I do to fix that
> without
> schema changing?
>
> If someone had the same problem in the past and knows the answear - please
> help! Any comment appreciated!
>
> Regards
>
> ania
>
>