服务器无法处理请求。 --> 值不能为空。参数名: s
「已注销」 2006-12-12 04:22:37
用vc调用.net写的一个web service,下面是程序,然后是得到的返回信息
CString Test()
{
HRESULT hr;
ISoapSerializerPtr Serializer;
ISoapReaderPtr Reader;
ISoapConnectorPtr Connector;
// Connect to the service.
hr = Connector.CreateInstance(__uuidof(HttpConnector30));
// Connector->Property["EndPointURL"] = L"http://localhost/axis/Test.jws";
Connector->Property["EndPointURL"] = L"http://10.10.0.3/DataServices/DataServices.asmx";
hr = Connector->Connect();
// Begin the message.
Connector->Property["SoapAction"] = L"http://tempuri.org/QueryTable";
hr = Connector->BeginMessage();
// Create the SoapSerializer object.
hr = Serializer.CreateInstance(__uuidof(SoapSerializer30));
// Connect the serializer object to the input stream of the connector object.
hr = Serializer->Init(_variant_t((IUnknown*)Connector->InputStream));
// Build the SOAP Message.
hr = Serializer->StartEnvelope("", "", "");
// Serializer->SoapNamespace(L"xsi", L"http://www.w3.org/2001/XMLSchema-instance");
// Serializer->SoapNamespace(L"xsd",L"http://www.w3.org/2001/XMLSchema");
hr = Serializer->StartBody(L"");
hr = Serializer->StartElement(L"QueryTable","","","");
hr = Serializer->StartElement(L"strXML","","","");
hr = Serializer->WriteString(L"<?xml version='1.0' ?><ROOT>ttt</ROOT>");
hr = Serializer->EndElement();
hr = Serializer->EndElement();
hr = Serializer->EndBody();
hr = Serializer->EndEnvelope();
// Send the message to the XML Web service.
hr = Connector->EndMessage();
// Read the response.
hr = Reader.CreateInstance(__uuidof(SoapReader30));
// Connect the reader to the output stream of the connector object.
Reader->Load(_variant_t((IUnknown*)Connector->OutputStream), "");
// Display the result.
CString strRet = (const char*)Reader->Dom->xml;
_cprintf("Answer: %s\n", strRet);
// CString strRet = (const char*)Reader->RpcResult->text;
// _cprintf("Answer2: %s\n", strRet);
return strRet;
}
// 返回的消息
Answer: <?xml version="1.0"?>
<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/XM
LSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>服务器无法处理请求。 --> 值不能为空。
参数名: s</faultstring>
<detail/>
</soap:Fault>
</soap:Body>
</soap:Envelope>
由于服务器端是其他公司开发的,不知道是我调用方式的问题,还是服务器端自己执行出错了,那个提示究竟是什么意思啊