Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How DO I Set XSDs in a web app for a Sax Parser?

Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All-

I'm running into an xml validation issue calling a web service using HttpURLConnection in a servlet.
I get a good response, with a soap envelope, and I want to parse the xml.

I get a Malformed URL error (no protocol) due to missing schemas.

the response string ( a few field names changed to protect the innocent): the main point is to show the schemas involved

<soap:Envelope xmlns:soap="" xmlns:xsd="" xmlns:xsi=""><soap:Body xmlns:ns1=""><SubscribeResponse xmlns=""><SubscriptionReference xmlns=""><Address xmlns="">https://w02777/orion/soap?ServiceName=NotificationProducer</Address><ReferenceParameters xsi:type="ns:FooReferenceParametersType" xmlns:ns="" xmlns=""><SubscriptionId xmlns="">TCSN_foo_Subscriber_331DAA98-4DC7-11DF-836B-AE4F0AC5625E</SubscriptionId></ReferenceParameters></SubscriptionReference></SubscribeResponse></soap:Body></soap:Envelope>

my code:

String getSubscriptionIdFromResponse(String response) {
InputSource is = new InputSource(response);
try {
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
SaxHandler handler = new SaxHandler();
parser.parse(is, handler);
return handler.subscriptionId;
} catch (Exception e) {
return "error occurred";


The xml is received as a repsonse:
I have the missing XSDs (the "docs oasis" ones and one application XSD).

My question: where do I put them so the parser will resolve them? web-inf doesn't work.
Also, do I have to resolve the xsi mapping with their new location?

any ideas?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic