haitao:
刚才用d7做了一个类似的服务,让C#客户端来访问,返回结果好像是对的,但是C#说:出现异常:未将对象引用设置到对象的实例。
[阅读: 562] 2006-07-04 07:24:25
刚才用d7做了一个类似的服务,让C#客户端来访问,返回结果好像是对的,
但是C#说:出现异常:未将对象引用设置到对象的实例。
请求:
POST /cgid/soapapp.dll/soap/IsoapTest HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 1.1.4322.2300)
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://host/dir/WebService/GetCardType"
Content-Length: 402
Expect: 100-continue
Connection: Keep-Alive
Host: 192.128.0.245
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetCardType xmlns="http://host/dir/WebService/"><sProviderCode>0001</sProviderCode><sProviderName /><iRetState>0</iRetState></GetCardType></soap:Body></soap:Envelope>
返回:
HTTP/1.0 200 OK
Content-Type: text/xml
Content-Length: 585
<?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:GetCardTypeResponse xmlns:NS1="urn:UnitSoapTestIntf-IsoapTest"><sProviderName xsi:type="xsd:string">[Name{0001}namE]</sProviderName><iRetState xsi:type="xsd:int">4</iRetState></NS1:GetCardTypeResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
服务的实现:
procedure TsoapTest.GetCardType(sProviderCode: String;
var sProviderName: String; var iRetState: Integer);
begin
sProviderName:='[Name{'+sProviderCode+'}namE]';
iRetState:=length(sProviderCode);
end;