问题描述
ISoapSerializerPtrSerializer;ISoapReaderPtrReader;ISoapConnectorPtrConnector;//ConnecttotheserviceConnector.CreateInstance(__uuidof(HttpConnector));//WS服务器地址Connector->Property["EndPointURL"]="http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx";//连接Connector->Connect();//动作Connector->Property["SoapAction"]="http://WebXml.com.cn/qqCheckOnline";try{//BeginmessageConnector->BeginMessage();//CreatetheSoapSerializerSerializer.CreateInstance(__uuidof(SoapSerializer));//ConnecttheserializertotheinputstreamoftheconnectorSerializer->Init(_variant_t((IUnknown*)Connector->InputStream));//BuildtheSOAPMessageSerializer->startEnvelope("","","");Serializer->startEnvelope("soap","http://schemas.xmlsoap.org/soap/envelope/","utf-8");Serializer->SoapAttribute("xsi","","http://www.w3.org/2001/XMLSchema-instance","xmlns");Serializer->SoapAttribute("xsd","","http://www.w3.org/2001/XMLSchema","xmlns");Serializer->startBody("");Serializer->startElement("qqCheckOnline","","","");Serializer->SoapAttribute("xmlns","http://www.WebXml.com.cn/","","");Serializer->startElement(_bstr_t("qqCode"),"","","");Serializer->writeString(_bstr_t("251833888"));Serializer->endElement();Serializer->endElement();Serializer->endBody();Serializer->endEnvelope();//SendthemessagetothewebserviceConnector->EndMessage();}catch(_com_errorx)//捕捉异常{char*s=newchar[56];strcpy(s,"99");strcat(s,"向服务器发送信息失败");delete[]s;}//ReadtheresponseReader.CreateInstance(__uuidof(SoapReader));//ConnectthereadertotheoutputstreamoftheconnectorReader->Load(_variant_t((IUnknown*)Connector->OutputStream),"");Reader->Envelope->text;//Displaytheresultif(Reader->Fault!=NULL){MSXML2::IXMLDOMElementPtrs=Reader->faultstring;printf("Fault:%sn",(constchar*)s->text);}else{printf("Answer:%sn",(constchar*)Reader->RPCResult->xml);}运行结果返回错误提示:服务无法处理请求未将对象引用设置到对象的实例应该返回"Y"或"N"才对。请高手赐教!
解决方案
解决方案二:
你看看WebService接口,是不是你少提供了什么信息给ws