ProtocolException while HTTP POST

Showing 1-4 of 4 messages
ProtocolException while HTTP POST Amit 9/8/10 5:15 AM
Hi All,

I am trying to do HTTP Post through HttpURLConnection. But in the
line

OutputStream output = httpCon.getOutputStream();

I am getting exception-

problem in connection - java.net.ProtocolException: Does not support
output URL - my url

What may be the reason? Kindly help.

Best Regards
Amit
Re: ProtocolException while HTTP POST Indicator Veritatis 9/8/10 11:13 AM
Well, the obvious reason is that the URL you gave it has something
wrong in it. But you didn't tell us the URL, so we can only guess.
Re: ProtocolException while HTTP POST Jason 9/8/10 11:41 PM
Usually this means the protocol portion of the URL is not valid.

So for example in "http://www.google.com", the protocol is HTTP.  As
Veritatis says, your URL is probably invalid.

If it's indeed an HTTP url, make your you prefix it the http:// or https://
as it may barf if you try just www.google.com (dunno about this.. may
still work and just assume http), or if you try a non HTTP url using
an HTTPConnection.
Re: ProtocolException while HTTP POST Amit 9/25/10 7:06 AM
HI All,

Finally the problem got solved. Just needed to call an API on the
HttpConnection object - setDoOutput(true).

Thanks
Amit

On Sep 9, 11:41 am, Jason <jason.poli...@gmail.com> wrote:
> Usually this means the protocol portion of the URL is not valid.
>
> So for example in "http://www.google.com", the protocol is HTTP.  As
> Veritatis says, your URL is probably invalid.
>
> If it's indeed an HTTP url, make your you prefix it the http:// or https://
> as it may barf if you try justwww.google.com(dunno about this.. may