0

I need to send XML data to a URL. The XML data is contained in a stringbuffer. I need to post it and get the response code.

Can anyone tell me how to do it?

I have a piece of code, but eclipse says its deprecated

PostMethod postMethod = new PostMethod(URL);
InputStream stream = new StringBufferInputStream(command);
                postMethod.setRequestBody(stream);
2
  • 1
    Please, be more specific on what you are using. Most probably you are using Apache HTTP Client, but it may not be clear to everyone. Otherwise, javadoc is worth reading before posting anything. Commented Apr 6, 2012 at 19:56
  • Sorry abt it. I am using the following:import org.apache.commons.httpclient.HttpClient; Commented Apr 6, 2012 at 20:31

1 Answer 1

1

Javadoc says to use setRequestEntity(RequestEntity) instead.

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.