wsdl validation doesn't handle extension

Having trouble installing Oxygen? Got a bug to report? Post it all here.
calvin
Posts: 2
Joined: Thu Jan 27, 2005 1:03 am

wsdl validation doesn't handle extension

Post by calvin »

I'm trying to validate a simple wsdl document:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions
targetNamespace="http://loans.org/wsdl/loan-approval"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:lns="http://loans.org/wsdl/loan-approval"
xmlns:asns="http://tempuri.org/services/loanassessor"
xmlns:apns="http://tempuri.org/services/loanapprover"
xmlns:loandef="http://tempuri.org/services/loandefinitions">


<wsdl:import namespace="http://tempuri.org/services/loanassessor"
location="project:/wsdl/loanassessor.wsdl"/>
<wsdl:import namespace="http://tempuri.org/services/loanapprover"
location="project:/wsdl/loanapprover.wsdl"/>
<wsdl:import namespace="http://tempuri.org/services/loandefinitions"
location="project:/wsdl/loandefinitions.wsdl"/>

<!-- The service name and the TNS represent my service ID QName -->
<wsdl:service name="loanapprovalServiceBP"/>


<plnk:partnerLinkType name="loanApprovalLinkType">
<plnk:role name="approver">
<plnk:portType name="apns:loanApprovalPT"/>
</plnk:role>
</plnk:partnerLinkType>

<plnk:partnerLinkType name="riskAssessmentLinkType">
<plnk:role name="assessor">
<plnk:portType name="asns:riskAssessmentPT"/>
</plnk:role>
</plnk:partnerLinkType>


</wsdl:definitions>
And Oxygen is complaining about the plink:partnerLinkType element, saying that it expects a wsdl element there.

However, the content model for the wsdl:definitions element is as follows:

Code: Select all

<complexType name="definitionsType">
<complexContent>
<extension base="wsdl:documented">
<sequence>
<element ref="wsdl:import" minOccurs="0" maxOccurs="unbounded"/>
<element ref="wsdl:types" minOccurs="0"/>
<element ref="wsdl:message" minOccurs="0" maxOccurs="unbounded"/>
<element ref="wsdl:portType" minOccurs="0" maxOccurs="unbounded"/>
<element ref="wsdl:binding" minOccurs="0" maxOccurs="unbounded"/>
<element ref="wsdl:service" minOccurs="0" maxOccurs="unbounded"/>
<any namespace="##other" minOccurs="0" maxOccurs="unbounded">
<annotation>
<documentation>to support extensibility elements </documentation>
</annotation>
</any>
</sequence>
<attribute name="targetNamespace" type="uriReference" use="optional"/>
<attribute name="name" type="NMTOKEN" use="optional"/>
</extension>
</complexContent>
</complexType>
Why does Oxygen not allow the non-wsdl extension element to fill the xsd:any slot after the wsdl elements? The exact validation error message is:

Code: Select all

cvc-complex-type.2.4.a: Invalid content was found starting with element 'plnk:partnerLinkType'. One of '{"http://schemas.xmlsoap.org/wsdl/":import, "http://schemas.xmlsoap.org/wsdl/":types, "http://schemas.xmlsoap.org/wsdl/":message, "http://schemas.xmlsoap.org/wsdl/":portType, "http://schemas.xmlsoap.org/wsdl/":binding, "http://schemas.xmlsoap.org/wsdl/":service}' is expected.
@see: http://www.w3.org/TR/xmlschema-1/#cvc-complex-type
I don't see anything wrong with the instance. Is this a bug, or am I missing something?
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Calvin,

oXygen uses the wsdl schema from
http://schemas.xmlsoap.org/wsdl/

That defines the content model for the wsdl:definitions element as you can see in the oXygen Model view as:

Model : (((wsdl:documentation{0-1}), (WC[##other:"http://schemas.xmlsoap.org/wsdl/"])), ((wsdl:import | wsdl:types | wsdl:message | wsdl:portType | wsdl:binding | wsdl:service){0-UNBOUNDED}))

which means that the extension elements are expected to be immediattely after wsdl documentation or at beggining if no wsdl:documentation is present.

If you move your extension elements before the first wsdl:import then oXygen will report that as valid.

If you are not happy with that you can replace the wsdl.xsd from oxygen.jar/builtin/wdsl.xsd with your own schema that allows the extension elements at the end.

Best Regards,
George
calvin
Posts: 2
Joined: Thu Jan 27, 2005 1:03 am

Post by calvin »

Hi George,

Thanks for the reply. That XSD snippet that I posted was from the schema included at the end of the wsdl 1.1 spec (http://www.w3.org/TR/wsdl#A4.1), which one would expect to be the standard, yet the one you're using is what one gets by dereferencing the URI in the WSDL target namespace, which one would also expect to be the standard--and yet they are semantically different. Do you know why they are different?

thanks,

calvin
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Calvin,

Hmm.. I cannot say why they are different, anyway here there are some remarks.

The http://www.w3.org/TR/wsdl is a W3C Note and in the document it is specified that it is for discussion only:
***
This document is a NOTE made available by the W3C for discussion only.
***

The http://www.w3.org/TR/wsdl document is from 2001 while the http://schemas.xmlsoap.org/wsdl/ has the copyright set to 2001-2003 which means that it was last modified at least in 2003 so it is at least 2 years newer than the W3C Note.

Best Regards,
George
paulrbrown
Posts: 4
Joined: Wed Jul 23, 2003 5:41 am

W3C WSDL schema is not definitive.

Post by paulrbrown »

As non-intuitive as it seems, the W3C WSDL schema is non-definitive at this point, at least *in my opinion*.

See R2028 at http://www.ws-i.org/Profiles/BasicProfile-1.1.html:
A DESCRIPTION using the WSDL namespace (prefixed "wsdl" in this Profile) MUST be valid according to the XML Schema found at "http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd".
This schema is more lax with the location in which extension elements must be placed.

It is probably a worthwhile feature to allow the schema for WSDL to be entered as a configuration parameter; it would also be good to be able to register additional schemas for additional namespaces, e.g., for the BPEL-related items that the original poster was asking about.
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Paul,

Thanks for your input.
Unfortunatelly trying to access http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd gives an error:
HTTP Error 404 - File or directory not found.

Best Regards,
George
paulrbrown
Posts: 4
Joined: Wed Jul 23, 2003 5:41 am

Post by paulrbrown »

george wrote:Unfortunatelly trying to access http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd gives an error:
HTTP Error 404 - File or directory not found.
That's not good... I'll talk to some people and get it back up.
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Paul,

Thanks for your intervention to have that schema back. However it is the same schema that is used by oXygen 5.1 and that has the model of definitions:

Model : (((documentation{0-1}), (WC[##other:"http://schemas.xmlsoap.org/wsdl/"])), ((import | types | message | portType | binding | service){0-UNBOUNDED}))

that is it accepts extensions only before (import | types | message | portType | binding | service).

Best Regards,
George
Post Reply