[jdom-interest] Parsing WSDL with JDOM? How?

Frank Cohen fcohen at pushtotest.com
Mon Dec 27 10:38:50 PST 2004


Is anyone parsing WSDL with JDOM? If so, how do you do so?

I am getting a error:
cvc-elt.1: Cannot find the declaration of element 'wsdl:definitions'.

Here is my code (this is Jython but you should get the idea):

xmlFile = File( "../dev/agents/FedWire.wsdl"  )
builder = SAXBuilder( "org.apache.xerces.parsers.SAXParser", 1 )
builder.setFeature( "http://apache.org/xml/features/validation/schema", 
1 )

wsdldefs = "http://www.xmethods.net/sd/eBayWatherService.wsdl " + \
"http://www.w3.org/2001/XMLSchema " + \
"http://schemas.xmlsoap.org/wsdl/soap " +\
"http://schemas.xmlsoap.org/wsdl "

builder.setProperty( 
"http://apache.org/xml/properties/schema/external-schemaLocation", 
wsdldefs )

doc = builder.build( xmlFile )

Here's a snippet of the XML/WSDL document:

<?xml version="1.0" encoding="utf-8"?>
<!-- edited with XMLSpy v2005 U (http://www.xmlspy.com) by Walter 
(WebserviceX.NET) -->
<wsdl:definitions
   xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:s="http://www.w3.org/2001/XMLSchema"
   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
   xmlns:tns="http://www.webservicex.net/"
   xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
   xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
   targetNamespace="http://www.webservicex.net/">
	<wsdl:types>
		<s:schema elementFormDefault="qualified" 
targetNamespace="http://www.webservicex.net/">
			<s:element name="GetParticipantsByRoutingNumber">

The builder.build() command throws this exception:
cvc-elt.1: Cannot find the declaration of element 'wsdl:definitions'.

Any help would be most appreciated. Thanks.

-Frank

---
Frank Cohen, PushToTest, http://www.PushToTest.com, phone: 408 374 7426
Author of "Java Testing and Design: From Unit Tests to Automated Web 
Tests"
from Prentice Hall, details at http://thebook.pushtotest.com



More information about the jdom-interest mailing list