Hi there,
When using a Delphi (6) Soap server and a Java client (using Apache Soap
2.2) I get the following exception when executing an Invoke:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.StringBuffer.charAt(StringBuffer.java:283)
at org.apache.soap.util.net.HTTPUtils.post(HTTPUtils.java:288)
at
org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.ja
va:282)
...
This is caused by Delphi sending the following response:
***** RESPONSE CONTENT:
HTTP/1.1 200 OK
Content-Type: text/xml
Content-Length: 516
Content:
<?xml version="1.0" encoding='UTF-8'?>
...
***** END RESPONSE
Apache Soap throws an exception in HTTPUtils.Post when parsing the
"Content:" line, because it assumes a line will always have a value:
// Remove trailing ; to prevent ContextType from throwing exception
if (valuebuf.charAt(valuebuf.length()-1) == ';') {
valuebuf.deleteCharAt(valuebuf.length()-1);
}
With Delphi's response the valuebuf is empty and this causes the exception.
I guess the problem is with the emtpy "Content:" header (can anybody tell me
if this is allowed at all in HTTP?) but at the same time I think
HTTPUtils.Post should check for empty values.
Any comments?
Michel