0

The XML-RPC server I am trying to communicate with requires that each request contains the following in the first line of the HTTP header:

POST /Air HTTP/1.1

however the following code we used,

urlc = (HttpURLConnection)url.openConnection();
urlc.setConnectTimeout(180000);
urlc.addRequestProperty("User-Agent", "AVAYA/3.1/1.0");
urlc.addRequestProperty("Authorization","Basic QXZheWE6QXZheWE=");
urlc.addRequestProperty("Content-type", "text/xml");
urlc.setDoOutput(true);
urlc.setRequestMethod("POST");

which results in....

POST HTTP/1.1
User-Agent: Avaya/3.1/1.0
Authorization: Basic QXZheWE6QXZheWE=
Content-type: text/xml

i.e. without the "/Air" bit.

Please help us in modifying the POST header

  • I'm not all that familiar with what you're trying to do, but I have the feeling that using HTTPURLConnection will not suit your needs. Consider using Apache HTTPClient. Good luck. – Steve P. May 08 '13 at 18:23
  • @SteveP. There is absolutely no reason the standard Java `HttpURLConnection` can not be used for a simple HTTP `POST` operation. All that's required is, you know, an actual URL to post to ... – Brian Roach May 08 '13 at 19:36
  • @BrianRoach I understand that. I wasn't sure if you could modify the POST HTTP/1.1 through Java HttpURLConnection. Apparently, I guess you can. – Steve P. May 08 '13 at 19:50
  • It wouldn't be very good at HTTP if you couldn't specify an URL ... – Brian Roach May 08 '13 at 20:19

1 Answers1

0

Make sure the "/Air" part is included in your url. Currently it's not.

Tom
  • 1,414
  • 12
  • 21