首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web Service >

请帮忙见见错在哪呢 SOAP TOOLKIT 调用WEBSERVICE

2012-10-16 
请帮忙看看错在哪呢 SOAP TOOLKIT 调用WEBSERVICE我真的找了很多资料,研究过很多关于SOAP 和WSDL的文章了,

请帮忙看看错在哪呢 SOAP TOOLKIT 调用WEBSERVICE
我真的找了很多资料,研究过很多关于SOAP 和WSDL的文章了,可还是返回-1,这个不是什么难题,请帮帮小弟,给些指引也好啊,或者给些论坛Q群之类的

XML code
  <?xml version="1.0" encoding="ISO-8859-1" ?> - <definitions 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/" xmlns:tns="http://192.168.6.60" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://192.168.6.60">- <types>- <xsd:schema elementFormDefault="qualified" targetNamespace="http://192.168.6.60">  <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />   <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" /> - <xsd:complexType name="helloRequestType">- <xsd:all>  <xsd:element name="sayhi" type="xsd:string" />   </xsd:all>  </xsd:complexType>- <xsd:complexType name="helloResponseType">- <xsd:all>  <xsd:element name="return" type="xsd:string" />   </xsd:all>  </xsd:complexType>  <xsd:element name="hello" type="tns:helloRequestType" />   <xsd:element name="helloResponse" type="tns:helloResponseType" />   </xsd:schema>  </types>- <message name="helloRequest">  <part name="parameters" element="tns:hello" />   </message>- <message name="helloResponse">  <part name="parameters" element="tns:helloResponse" />   </message>- <portType name="myWsPortType">- <operation name="hello">  <input message="tns:helloRequest" />   <output message="tns:helloResponse" />   </operation>  </portType>- <binding name="myWsBinding" type="tns:myWsPortType">  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> - <operation name="hello">  <soap:operation soapAction="http://localhost/nusoap/nusoap_server1.php/hello" style="document" /> - <input>  <soap:body use="literal" namespace="http://192.168.6.60" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />   </input>- <output>  <soap:body use="literal" namespace="http://192.168.6.60" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />   </output>  </operation>  </binding>- <service name="myWs">- <port name="myWsPort" binding="tns:myWsBinding">  <soap:address location="http://localhost/nusoap/nusoap_server1.php" />   </port>  </service>  </definitions>


C/C++ code
//soap toolkit3.0#import "C:\WINDOWS\system32\msxml4.dll"//using namespace MSXML2;#import "C:\Program Files\Common Files\MSSoap\Binaries\MSSOAP30.dll" \         exclude("IStream", "ISequentialStream", "_LARGE_INTEGER", \               "_ULARGE_INTEGER", "tagSTATSTG", "_FILETIME","IErrorInfo")//using namespace MSSOAPLib30;//end

C/C++ code
void Add(){        MSSOAPLib30::ISoapConnectorPtr Connector;    MSSOAPLib30::ISoapSerializerPtr Serializer;    MSSOAPLib30::ISoapReaderPtr Reader;    // Connect to the service.    Connector.CreateInstance(__uuidof(MSSOAPLib30::HttpConnector30));    Connector->Property["EndPointURL"] = "http://192.168.6.60/nusoap/nusoap_server1.php?wsdl";        Connector->Connect();    Connector->Property["SoapAction"] = "http://192.168.6.60/nusoap/nusoap_server1.php/hello";    Connector->BeginMessage();    // Create the SoapSerializer object.    Serializer.CreateInstance(__uuidof(MSSOAPLib30::SoapSerializer30));    // Connect the serializer object to the input stream of the connector object.    Serializer->Init(_variant_t((IUnknown*)Connector->InputStream));    //Serializer->startEnvelope("myWs","","");    // Build the SOAP Message.    Serializer->StartEnvelope("","","");    Serializer->StartBody("");    Serializer->StartElement("hello","http://192.168.6.60","NONE","m");    Serializer->StartElement("fuck","","NONE","");    Serializer->WriteString("nobelb");    Serializer->EndElement();    Serializer->EndElement();    Serializer->EndBody();    Serializer->EndEnvelope();    // Send the message to the XML Web service.    Connector->EndMessage();    Reader.CreateInstance(__uuidof(MSSOAPLib30::SoapReader30));    if(Reader->Load(_variant_t((IUnknown*)Connector->OutputStream),"")!=-1 )    {        AfxMessageBox(_T("reader->load ok!"),0,0);        printf("Answer: %s\n", (const char*)(Reader->RpcResult->text));    }    else        AfxMessageBox(_T("reader->load error!"),0,0);    /**/}void CnomanageDlg::OnBnClickedButton1(){        CoInitialize(NULL);    Add();    CoUninitialize();    // TODO: Add your control notification handler code here} 



[解决办法]
帮顶

热点排行