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

4
  • 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. Commented May 8, 2013 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 ... Commented May 8, 2013 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. Commented May 8, 2013 at 19:50
  • It wouldn't be very good at HTTP if you couldn't specify an URL ... Commented May 8, 2013 at 20:19

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.