tvomalley wrote:
> I have this code to post a SOAP message:
Have you taken a look at the PostSOAP example?
http://svn.apache.org/repos/asf/jakarta/httpcomponents/oac.hc3x/trunk/src/examples/PostSOAP.java
> PostMethod post = new PostMethod(myurl);
> post.setRequestHeader(HttpFields.__Accept, "application/soap+xml");
> post.setRequestHeader(HttpFields.__UserAgent, "MyClient");
> post.setRequestHeader(HttpFields.__ContentType, "text/xml; charset=utf-8");
> post.setRequestHeader("SOAPAction", "\"\"");
> post.setRequestEntity(new InputStreamRequestEntity(new
> ByteArrayInputStream(message),
> InputStreamRequestEntity.CONTENT_LENGTH_AUTO));
> post.setContentChunked(true);
>
> Is that all I have to do?
I don't see anything missing.
Why do you wrap a ByteArrayInputStream around the
message? We have a ByteArrayRequestEntity.
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/ByteArrayRequestEntity.html
Passing the content type to the constructor will
make the setRequestHeader for the content type
above superfluous.
> How do I set the size?
You don't. It is determined from the entity.
hope that helps,
Roland
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]