用delphi建立ISAPI的WebServices出现的问题。
我用delphi写了个ISAPI的WebServices,调用helloworld测试方法,多试几次会出现错误,如下:
Project Project1.exe raised exception class ESOAPHTTPException with message 'Received content of invalid Content-Type setting: text/html - SOAP expects "text/xml " '. Process stopped. Use Step or Run to continue.
我用跟踪程序调试,每次发出soap请求后,返回的内容如下:
HTTP/1.1 100 Continue
Server: Microsoft-IIS/5.1
Date: Tue, 06 Mar 2007 06:20:01 GMT
X-Powered-By: ASP.NET
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Tue, 06 Mar 2007 06:20:01 GMT
X-Powered-By: ASP.NET
Content-Type: text/xml
Content-Length: 527
<?xml version= "1.0 "?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV= "http://schemas.xmlsoap.org/soap/envelope/ " xmlns:xsd= "http://www.w3.org/2001/XMLSchema " xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance " xmlns:SOAP-ENC= "http://schemas.xmlsoap.org/soap/encoding/ "> <SOAP-ENV:Body SOAP-ENC:encodingStyle= "http://schemas.xmlsoap.org/soap/envelope/ "> <NS1:HelloWorldResponse xmlns:NS1= "urn:SmsWebServiceIntf-ISmsWebService "> <return xsi:type= "xsd:string "> Hello World </return> </NS1:HelloWorldResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
HTTP/1.1 500 Server Error
Server: Microsoft-IIS/5.1
Date: Tue, 06 Mar 2007 06:20:01 GMT
Content-Type: text/html
Content-Length: 44
<html> -2147417842 (0x8001010e) </body> </html>
不知道,为什么最后面有
HTTP/1.1 500 Server Error
Server: Microsoft-IIS/5.1
Date: Tue, 06 Mar 2007 06:20:01 GMT
Content-Type: text/html
Content-Length: 44
<html> -2147417842 (0x8001010e) </body> </html> 。
[解决办法]
这个有点怪的事, 我这里只有 xp 上发生这事, 2003 正常, 代码是没有任何问题, 不过查了 newsgroups.borland.com 后上面说, project-> source 里的一个use 顺序有关
...
uses
ISAPIApp,
ISAPIThreadPool,
...
上面这个是正确顺序, 我原来的是倒的, 改过来就不出错了