Hi all,
thanks in advance for your help.
I am trying to post to a Soap 12 service using Http client.
This problem has been hurting my head for a few days. The Web service is
generated using Oracle web services. As part of this, a web page is generated
to test the web services with. Its just a HTML form where you can paste the
SOAP body into.
The test with the pound sign seems to work fine in the web page version.
My problem is related to the British Pound Sign (£) and /or utf-8 encoding. I
know utf-8 supports this character.
There are lots of parts of our system which could be corrupting it, but I think
I have nailed it down to one area. Please find a snippet of code below and the
trace of the HTTP traffic.
Are the bytes [0xc2][0xa3] in the HTTP post a problem?
I have edited the code/logs slightly for clarity and to take out some private
things.
I either get a 500 error (For some reason the server cant find the end
Soap:Env tag) or an HTTP 400 (Bad request) from another implementation
of the web service.
Thanks in Advance
Cheers
Norm
PostMethod post = new PostMethod(endpoint);
post.setRequestHeader("Content-Length", ""+soapString.length());
post.setRequestHeader("SOAPAction", "SOAP ACTION REMOVED");
HttpClient httpclient = new HttpClient();
httpclient.getParams().setParameter("http.connection.timeout", new
Integer(30000));
httpclient.getParams().setParameter("http.protocol.content-charset", "UTF-8");
// Execute request
try {
post.setRequestEntity(new StringRequestEntity(soapString,
"application/soap+xml", "UTF-8"));
int result = httpclient.executeMethod(post);
.....
2009/08/21 16:55:22:329 BST [DEBUG] HttpConnection - Open connection to
sworks03:80
2009/08/21 16:55:22:376 BST [DEBUG] header - >> "POST /xxx
HTTP/1.1[\r][\n]"
2009/08/21 16:55:22:376 BST [DEBUG] HttpMethodBase - Adding Host request header
2009/08/21 16:55:22:392 BST [DEBUG] header - >> "Content-Length: 1199[\r][\n]"
2009/08/21 16:55:22:392 BST [DEBUG] header - >> "SOAPAction: xxx[\r][\n]"
2009/08/21 16:55:22:392 BST [DEBUG] header - >> "User-Agent: Jakarta
Commons-HttpClient/3.1[\r][\n]"
2009/08/21 16:55:22:392 BST [DEBUG] header - >> "Host: xxx[\r][\n]"
2009/08/21 16:55:22:454 BST [DEBUG] header - >> "Content-Type:
application/soap+xml; charset=UTF-8[\r][\n]"
2009/08/21 16:55:22:454 BST [DEBUG] header - >> "[\r][\n]"
2009/08/21 16:55:22:454 BST [DEBUG] content - >> "<?xml version="1.0"
versions="UTF-8"?><soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope">[\n]"
2009/08/21 16:55:22:454 BST [DEBUG] content - >> " <soap:Body ><request
SchemaVersion="5.0" >[\n]"
2009/08/21 16:55:22:454 BST [DEBUG] content - >> "
<AuthorityResponse>[\n]"
2009/08/21 16:55:22:454 BST [DEBUG] content - >> "
<NotificationType>1600</NotificationType>[\n]"
2009/08/21 16:55:22:454 BST [DEBUG] content - >> "
<NotificationSequenceNumber>2</NotificationSequenceNumber>[\n]"
2009/08/21 16:55:22:454 BST [DEBUG] content - >> "
<VersionCreatedDatim>2008-02-08T10:53:52</VersionCreatedDatim>[\n]"
2009/08/21 16:55:22:454 BST [DEBUG] content - >> "
<NotificationComments>Duration change [0xc2][0xa3]
</NotificationComments>[\n]"
2009/08/21 16:55:22:454 BST [DEBUG] content - >> " </request>
</soap:Body>[\n]"
2009/08/21 16:55:22:454 BST [DEBUG] content - >> "</soap:Envelope>"
2009/08/21 16:55:22:454 BST [DEBUG] EntityEnclosingMethod - Request body sent
2009/08/21 16:55:22:532 BST [DEBUG] header - << "HTTP/1.1 500 Internal Server
Error[\r][\n]"
2009/08/21 16:55:22:532 BST [DEBUG] header - << "HTTP/1.1 500 Internal Server
Error[\r][\n]"