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 Andrew Clegg <an...@gmail.com> on 2008/06/25 21:01:47 UTC

XSD inheritance (via extension) in WSDLs (top-down)

Here's a question for the schema design gurus.

I have a document/literal wrapped WSDL which defines an operation
called SubmitBLAST. The corresponding element for the input message
looks like this:

	<xsd:element name="SubmitBlast">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="query_data" type="AminoAcidSeqData" />
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

AminoAcidSeqData is, in turn, an abstract type:

	<xsd:complexType abstract="true" name="AminoAcidSeqData" />

which various concrete types extend, e.g.:

	<xsd:complexType name="FastaRecord">
		<xsd:complexContent>
			<xsd:extension base="AminoAcidSeqData">
				<xsd:sequence>
					<xsd:element name="header" type="xsd:string" />
					<xsd:element name="sequence" type="AminoAcidSeq" />
				</xsd:sequence>
			</xsd:extension>
		</xsd:complexContent>
	</xsd:complexType>

This passes WS-I compliance, and I've generated my service with
wsdl2java (using XMLBeans) with no problems. However, I've hit upon a
snag in testing the WSDL with SoapUI. It autogenerates messages from
the WSDL that look like this:

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:typ="http://ws.cathdb.info/Types">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:SubmitBlast>
         <typ:query_data/>
      </typ:SubmitBlast>
   </soapenv:Body>
</soapenv:Envelope>

So there's no skeleton generated for any of the possible
instantiations of the abstractly-typed element query_data. And
anything I put in there fails XML Beans validation on the server side,
even if I know it matches the structure, with this error:

Document invalid: [error: cvc-elt.2: Element
'T=AminoAcidSeqData@http://grid.cathdb.info/Types' is abstract and
cannot be used in an instance]

Am I barking up the wrong tree here, and expecting too much
'cleverness' from the code generators (in Axis2 or SoapUI)?

Ideally I'd like to be able to send different messages for each of the
concrete implementations of AminoAcidSeqData that are reconstructed on
the server side into the appropriate objects. Is there a better way to
do this?

Many thanks,

Andrew.

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: XSD inheritance (via extension) in WSDLs (top-down)

Posted by Andrew Clegg <an...@gmail.com>.
2008/6/26 Amila Suriarachchi <am...@gmail.com>:

>> By the way, in the process, I hit upon a case under XMLBeans where the
>> response documents failed validation against the original WSDL. Should
>> I post a test case that demonstrates this? Or is Axis2 with XMLBeans
>> not guaranteed to produce conformant responses?
>
> Please put a jira.

Sorry, I take it back, I was doing something wrong. False alarm :-)

Andrew.

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: XSD inheritance (via extension) in WSDLs (top-down)

Posted by Amila Suriarachchi <am...@gmail.com>.
On Thu, Jun 26, 2008 at 3:35 PM, Andrew Clegg <an...@gmail.com>
wrote:

> 2008/6/26 Amila Suriarachchi <am...@gmail.com>:
>
> > Here your request should be something like this
> >
> > <soapenv:Envelope
> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:typ="http://ws.cathdb.info/Types">
> >   <soapenv:Header/>
> >   <soapenv:Body>
> >      <typ:SubmitBlast>
> >         <typ:query_data xsi:type="FastaRecord" >
> >                <header>tess</header>
> >                <Sequence></Sequence>
> >        </typ:query_data>
> >      </typ:SubmitBlast>
> >   </soapenv:Body>
> > </soapenv:Envelope>
>
> Yep, that's what I was hoping for...
>
> > Try to invoke this service ether using an XMLBean client or an ADB
> client.
> > Then you can get a proper request.
>
> Unfortunately we're developing publically available services so can't
> really mandate a particular client. Also we're part of a consortium
> that requires SoapUI test suites, so our schema needs to be able to
> generate healthy requests in SoapUI.
>
> I've gone for a solution involving xsd:choice elements rather than
> inheritance, which seems to work fine in SoapUI and to sit more
> happily with ADB than the inheritance structure did. XMLBeans just
> seems unnecessarily complicated...
>
> By the way, in the process, I hit upon a case under XMLBeans where the
> response documents failed validation against the original WSDL. Should
> I post a test case that demonstrates this? Or is Axis2 with XMLBeans
> not guaranteed to produce conformant responses?


Please put a jira.

>
>
> Andrew.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.

Re: XSD inheritance (via extension) in WSDLs (top-down)

Posted by Andrew Clegg <an...@gmail.com>.
2008/6/26 Amila Suriarachchi <am...@gmail.com>:

> Here your request should be something like this
>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:typ="http://ws.cathdb.info/Types">
>   <soapenv:Header/>
>   <soapenv:Body>
>      <typ:SubmitBlast>
>         <typ:query_data xsi:type="FastaRecord" >
>                <header>tess</header>
>                <Sequence></Sequence>
>        </typ:query_data>
>      </typ:SubmitBlast>
>   </soapenv:Body>
> </soapenv:Envelope>

Yep, that's what I was hoping for...

> Try to invoke this service ether using an XMLBean client or an ADB client.
> Then you can get a proper request.

Unfortunately we're developing publically available services so can't
really mandate a particular client. Also we're part of a consortium
that requires SoapUI test suites, so our schema needs to be able to
generate healthy requests in SoapUI.

I've gone for a solution involving xsd:choice elements rather than
inheritance, which seems to work fine in SoapUI and to sit more
happily with ADB than the inheritance structure did. XMLBeans just
seems unnecessarily complicated...

By the way, in the process, I hit upon a case under XMLBeans where the
response documents failed validation against the original WSDL. Should
I post a test case that demonstrates this? Or is Axis2 with XMLBeans
not guaranteed to produce conformant responses?

Andrew.

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: XSD inheritance (via extension) in WSDLs (top-down)

Posted by Amila Suriarachchi <am...@gmail.com>.
On Thu, Jun 26, 2008 at 12:31 AM, Andrew Clegg <an...@gmail.com>
wrote:

> Here's a question for the schema design gurus.
>
> I have a document/literal wrapped WSDL which defines an operation
> called SubmitBLAST. The corresponding element for the input message
> looks like this:
>
>        <xsd:element name="SubmitBlast">
>                <xsd:complexType>
>                        <xsd:sequence>
>                                <xsd:element name="query_data"
> type="AminoAcidSeqData" />
>                        </xsd:sequence>
>                </xsd:complexType>
>        </xsd:element>
>
> AminoAcidSeqData is, in turn, an abstract type:
>
>        <xsd:complexType abstract="true" name="AminoAcidSeqData" />
>
> which various concrete types extend, e.g.:
>
>        <xsd:complexType name="FastaRecord">
>                <xsd:complexContent>
>                        <xsd:extension base="AminoAcidSeqData">
>                                <xsd:sequence>
>                                        <xsd:element name="header"
> type="xsd:string" />
>                                        <xsd:element name="sequence"
> type="AminoAcidSeq" />
>                                </xsd:sequence>
>                        </xsd:extension>
>                </xsd:complexContent>
>        </xsd:complexType>
>
> This passes WS-I compliance, and I've generated my service with
> wsdl2java (using XMLBeans) with no problems. However, I've hit upon a
> snag in testing the WSDL with SoapUI. It autogenerates messages from
> the WSDL that look like this:
>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:typ="http://ws.cathdb.info/Types">
>   <soapenv:Header/>
>   <soapenv:Body>
>      <typ:SubmitBlast>
>         <typ:query_data/>
>      </typ:SubmitBlast>
>   </soapenv:Body>
> </soapenv:Envelope>
>
> So there's no skeleton generated for any of the possible
> instantiations of the abstractly-typed element query_data. And
> anything I put in there fails XML Beans validation on the server side,
> even if I know it matches the structure, with this error:
>
> Document invalid: [error: cvc-elt.2: Element
> 'T=AminoAcidSeqData@http://grid.cathdb.info/Types' is abstract and
> cannot be used in an instance]
>
> Am I barking up the wrong tree here, and expecting too much
> 'cleverness' from the code generators (in Axis2 or SoapUI)?
>
> Ideally I'd like to be able to send different messages for each of the
> concrete implementations of AminoAcidSeqData that are reconstructed on
> the server side into the appropriate objects. Is there a better way to
> do this?


Here your request should be something like this

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:typ="http://ws.cathdb.info/Types">
  <soapenv:Header/>
  <soapenv:Body>
     <typ:SubmitBlast>
        <typ:query_data xsi:type="FastaRecord" >
               <header>tess</header>
               <Sequence></Sequence>
       </typ:query_data>
     </typ:SubmitBlast>
  </soapenv:Body>
</soapenv:Envelope>

Try to invoke this service ether using an XMLBean client or an ADB client.
Then you can get a proper request.

thanks,
Amila.


>
> Many thanks,
>
> Andrew.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.