3,055
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="UTF-8" ?>
- <definitions xmlns:tns="http://www.chnet.com/servers/com/chnet/gate/webservice" xmlns:wsr="http://www.openuri.org/2002/10/soap/reliability/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap12enc="http://www.w3.org/2003/05/soap-encoding" xmlns:conv="http://www.openuri.org/2002/04/wsdl/conversation/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.chnet.com/servers/com/chnet/gate/webservice">
- <message name="setUnsealInfo">
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:string" name="tagID" />
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:string" name="machineID" />
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:string" name="userID" />
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:string" name="password" />
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:string" name="zoneName" />
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:string" name="time" />
</message>
- <message name="setUnsealInfoResponse">
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:boolean" name="result" />
</message>
- <message name="validUserInfo">
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:string" name="machineID" />
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:string" name="userID" />
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:string" name="password" />
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:string" name="zoneName" />
</message>
- <message name="validUserInfoResponse">
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:boolean" name="result" />
</message>
- <message name="getSealKeyID">
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:string" name="tagID" />
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:string" name="machineID" />
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:string" name="userID" />
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:string" name="password" />
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:string" name="zoneName" />
</message>
- <message name="getSealKeyIDResponse">
<part xmlns:partns="http://www.w3.org/2001/XMLSchema" type="partns:string" name="result" />
</message>
- <portType name="SealServicePort">
- <operation name="setUnsealInfo">
<input message="tns:setUnsealInfo" />
<output message="tns:setUnsealInfoResponse" />
</operation>
- <operation name="validUserInfo">
<input message="tns:validUserInfo" />
<output message="tns:validUserInfoResponse" />
</operation>
- <operation name="getSealKeyID">
<input message="tns:getSealKeyID" />
<output message="tns:getSealKeyIDResponse" />
</operation>
</portType>
- <binding type="tns:SealServicePort" name="SealServicePort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
- <operation name="setUnsealInfo">
<soap:operation style="rpc" soapAction="" />
- <input>
<soap:body namespace="http://www.chnet.com/servers/com/chnet/gate/webservice" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" />
</input>
- <output>
<soap:body namespace="http://www.chnet.com/servers/com/chnet/gate/webservice" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" />
</output>
</operation>
- <operation name="validUserInfo">
<soap:operation style="rpc" soapAction="" />
- <input>
<soap:body namespace="http://www.chnet.com/servers/com/chnet/gate/webservice" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" />
</input>
- <output>
<soap:body namespace="http://www.chnet.com/servers/com/chnet/gate/webservice" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" />
</output>
</operation>
- <operation name="getSealKeyID">
<soap:operation style="rpc" soapAction="" />
- <input>
<soap:body namespace="http://www.chnet.com/servers/com/chnet/gate/webservice" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" />
</input>
- <output>
<soap:body namespace="http://www.chnet.com/servers/com/chnet/gate/webservice" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" />
</output>
</operation>
</binding>
- <service name="SealService">
- <port name="SealServicePort" binding="tns:SealServicePort">
<soap:address location="http://192.168.70.80:7001/seal_service/SealService" />
</port>
</service>
</definitions>
try
{
ISoapSerializerPtr Serializer;
ISoapReaderPtr Reader;
ISoapConnectorPtr Connector;
// Connect to the service.
Connector.CreateInstance(__uuidof(HttpConnector30));
Connector->PutProperty("EndPointURL", COleVariant("http://192.168.70.80:7001/seal_service/SealService"));
Connector->Connect();
Connector->Property["SoapAction"] = "";
Connector->BeginMessage();
// Create the SoapSerializer object.
Serializer.CreateInstance(__uuidof(SoapSerializer30));
// Connect the serializer object to the input stream of the connector object.
Serializer->Init(_variant_t((IUnknown*)Connector->InputStream));
// Build the SOAP Message.
// Serializer->StartEnvelope("","STANDARD","");
Serializer->StartEnvelope("","","");
Serializer->StartBody("");
Serializer->StartElement("validUserInfo","http://www.chnet.com/servers/com/chnet/gate/webservice","",""); //这是本地的Web Services,实际中要指定命名空间HomeTradeStatusRequest:reqDoc
Serializer->StartElement("machineID","","STANDARD","");
Serializer->WriteString("00-18-8B-1E-BC-03");
Serializer->EndElement();
Serializer->StartElement("userID","","STANDARD","");
Serializer->WriteString(_bstr_t(m_userID));
Serializer->EndElement();
Serializer->StartElement("password","","STANDARD","");
Serializer->WriteString(_bstr_t(m_password));
Serializer->EndElement();
Serializer->StartElement("zoneName","","STANDARD","");
Serializer->WriteString("CIChg");
Serializer->EndElement();
Serializer->EndElement();
Serializer->EndBody();
Serializer->EndEnvelope();
// Send the message to the XML Web service.
Connector->EndMessage();
// Read the response.
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 msg;
msg.Format("Answer: %s\n", (const char*)Reader->RpcResult->text);
// msg.Format("Answer: %s\n", (const char*)Reader->Body->text);
AfxMessageBox(msg);
CString strResponse;
strResponse.Format("%s", (const char*)Reader->GetRpcParameter("result","validUserInfoResponse")->text);
AfxMessageBox(strResponse);
// _bstr_t varRet;
// Reader->Load(_variant_t((IUnknown*)Connector->OutputStream), varRet);
}
catch(_com_error &e)
{
AfxMessageBox(e.ErrorMessage());
}