xml - Eclipse WSDL Validation Error with Imported Namespaces -
i received non inline wsdl file services team in organization, , after adding of xsd's xml catalog in eclipse finding main wsdl file not validate. doesn't seem find <wsdl:message> element defined in <wsdl:import>. validation error such:
the fault element referencing undefined message 'servicefault'. check message name , namespace correct , message has been defined.
all file paths relative in same folder. here small test example recreates validation error:
test.xsd
<?xml version="1.0" encoding="utf-8"?> <xsd:schema targetnamespace="http://www.example.org/test" xmlns="http://www.example.org/test" elementformdefault="qualified" attributeformdefault="unqualified" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:ibmschextn="http://www.ibm.com/schema/extensions"> <xsd:complextype name="servicefaulttype"> <xsd:sequence> <xsd:element name="code" type="xsd:string" /> <xsd:element name="message" type="xsd:string" /> <xsd:element minoccurs="0" name="detail" type="xsd:string" /> </xsd:sequence> </xsd:complextype> <xsd:element ibmschextn:docroot="true" name="servicefault" type="servicefaulttype" /> </xsd:schema> common.wsdl
<?xml version="1.0" encoding="utf-8" standalone="no"?> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetnamespace="http://www.example.org/test" xmlns="http://www.example.org/test" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <wsdl:documentation> <wsdl:appinfo source="wmqi_appinfo"> <mrwsdlappinfo xmlns="urn:xxx.xxx.xxxbank.com/common/service" imported="true" /> </wsdl:appinfo> </wsdl:documentation> <wsdl:types> <xs:schema elementformdefault="qualified"> <xs:import namespace="http://www.example.org/test" schemalocation="test.xsd" /> </xs:schema> </wsdl:types> <wsdl:message name="servicefault"> <wsdl:part element="servicefault" name="fault" /> </wsdl:message> </wsdl:definitions> test.wsdl
<?xml version="1.0" encoding="utf-8" standalone="no"?> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetnamespace="urn:testservice" xmlns="urn:testservice" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns="http://www.example.org/test" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <wsdl:import namespace="http://www.example.org/test" location="common.wsdl"></wsdl:import> <wsdl:types> <xsd:schema targetnamespace="urn:testservice"> <xsd:element name="newoperation"> <xsd:complextype> <xsd:sequence> <xsd:element name="in" type="xsd:string" /> </xsd:sequence> </xsd:complextype> </xsd:element> <xsd:element name="newoperationresponse"> <xsd:complextype> <xsd:sequence> <xsd:element name="out" type="xsd:string" /> </xsd:sequence> </xsd:complextype> </xsd:element> </xsd:schema> </wsdl:types> <wsdl:message name="newoperationrequest"> <wsdl:part element="newoperation" name="parameters" /> </wsdl:message> <wsdl:message name="newoperationresponse"> <wsdl:part element="newoperationresponse" name="parameters" /> </wsdl:message> <wsdl:porttype name="test"> <wsdl:operation name="newoperation"> <wsdl:input message="newoperationrequest" /> <wsdl:output message="newoperationresponse" /> <wsdl:fault message="ns:servicefault" name="fault" /> </wsdl:operation> </wsdl:porttype> <wsdl:binding name="testsoap" type="test"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="newoperation"> <soap:operation soapaction="http://www.example.org/test/newoperation" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="test"> <wsdl:port binding="testsoap" name="testsoap"> <soap:address location="http://www.example.org/" /> </wsdl:port> </wsdl:service> </wsdl:definitions> if add test.xsd xml catalog in eclipse demonstrates validation error. insist there nothing wrong wsdls or schemas , jax-ws seems generate proxies fine wsimport. furthermore seems marshal , unmarshall requests , responses fine when talking endpoints.
could bug in eclipse's wsdl validation?
edit: thought though still haven't solved problem. think might going on eclipse validating namespace test.xsd in namespace common.wsdl declares own elements. when eclipse looks common ns:servicefault in ns namespace isnt going find in test.xsd. makes me feel eclipse wsdl validation should little more intelligent here , identify wsdl import , include in there plus schema declared in xml catalog. if on mark here, still not sure how solve it. there feature of eclipse can validate type of wsdl situation properly?
i created files on side , tested eclipse luna 4.4.0 , web developer tools 3.2.5. put 2 .wsdl files in same generic project, imported .xsd in xml catalog via wizard.
when validated each 1 of files , eclipse didn't find errors/warnings whatsoever. did error message cite when removed common.wsdl file project, expected since imported in test.wsdl. tried creating new soapui project test.wsdl (from eclipse directory) in soapui 5.0.0 , didn't complain.
since cannot reproduce error think may bug of specific eclipse version you're using or wrong web developer tools. or may local nonsense doesn't pop right away @ first sight. make sure once again eclipse put files physically in same directory on filesystem.
see screenshot of configuration of eclipse compare, should decide change versions. 
i'd glad able further, @ least gave confirmation issue local. luck!
update 1 after comment 1
initially, imported test.xsd via import->xml->xml catalog. moved .xsd filesystem location , removed project (because otherwise works). then, did proposed (window->preferences->xml->xml catalog->user specified entries->catalog entry->from filesystem: key type = tried both namespace name , schema location , key = http://www.example.org/test). after doing warning error reading .xsd file (pointing local directory of project instead of new location) , multiple errors, 1 of yours.
if remove schemalocation="test.xsd" attribute in common.wsdl , keytype set namespace, common.wsdl works , doesn't have errors, test.wsdl says:
the fault element referencing undefined message 'servicefault'. check message name , namespace correct , message has been defined.
i see common.wsdl has 2 namespaces same namespace name: xs , xsd ("http://www.w3.org/2001/xmlschema"). causing error?
update 2
i investigated further , found this wiki page, explaining working xml catalog , schemas. according behavior expected:
note : if xml document specificed relative schema locations (e.g. 'foo.xsd' show below) xml schema can not registered using "foo.xsd" schema location key. todo: reference section below describes why case , how xml catalog v1.1 provides way partially solve this.
<xyz:foo xmln:xyz="http://www.example.org/foo/" xsi:schemalocation="foo.xsd" ...
so seems know there issue these relative paths.
then tried using full uris in both catalog key , in schemalocation , worked no errors:

i'll continue looking (i found this thread on eclipse forums similar topic has been discussed) , i'll post update if pops up.
Comments
Post a Comment