wood burning stoves 2.0*
The moose likes Web Services and the fly likes  java.net.MalformedURLException: no protocol: <soap:Envelope ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Web Services
Bookmark " java.net.MalformedURLException: no protocol: <soap:Envelope ?" Watch " java.net.MalformedURLException: no protocol: <soap:Envelope ?" New topic
Author

java.net.MalformedURLException: no protocol: <soap:Envelope ?

Max Tomlinson
Ranch Hand

Joined: Jul 17, 2001
Posts: 365
Hi All-

I'm running into an xml validation issue on the return from a ws call.

I am calling the web service using HttpURLConnection in a servlet.

I get a good response, with a soap envelope, and I want to parse the xml.

The problem is that I get the above error,probably due to missing schemas.

my code:

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

}

the response string:
<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>

I've tried setting systemId but I suspect the problem is that I don't have a valid DTD.

All I want to do is parse one field.

any ideas?
thanks
Max
Max Tomlinson
Ranch Hand

Joined: Jul 17, 2001
Posts: 365
This turned out to be due to my setting the input source from a string of xml I had built from reading the input stream.
Once I set the source directly from the input stream directly - which included the protocol, it worked.
 
 
subject: java.net.MalformedURLException: no protocol: <soap:Envelope ?