• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

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="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body xmlns:ns1="http://docs.oasis-open.org/wsn/bw-2"><SubscribeResponse xmlns="http://docs.oasis-open.org/wsn/b-2"><SubscriptionReference xmlns="http://docs.oasis-open.org/wsn/b-2"><Address xmlns="http://www.w3.org/2005/08/addressing">https://w02777/orion/soap?ServiceName=NotificationProducer</Address><ReferenceParameters xsi:type="ns:FooReferenceParametersType" xmlns:ns="http://www.foo.com/ws/integration/notification/2008/10" xmlns="http://www.w3.org/2005/08/addressing"><SubscriptionId xmlns="http://www.foo.com/ws/integration/notification/2008/10">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
Boost this thread!