void Add()
{
MSSOAPLib30::ISoapConnectorPtr Connector;
MSSOAPLib30::ISoapSerializerPtr Serializer;
MSSOAPLib30::ISoapReaderPtr Reader;
// Connect to the service.
Connector.CreateInstance(__uuidof(MSSOAPLib30::HttpConnector30)); Connector->Property["EndPointURL"] = "http://localhost/nusoap/nusoap_server1.php?wsdl";
Connector->Connect();
Connector->Property["SoapAction"] = "http://localhost/nusoap/nusoap_server1.php/getBooks";
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","","","m");
Serializer->WriteString("nobelb");
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);
/**/
}reader->load返回-1 这是一个异常错误
想知道什么问题。
{
MSSOAPLib30::ISoapConnectorPtr Connector;
MSSOAPLib30::ISoapSerializerPtr Serializer;
MSSOAPLib30::ISoapReaderPtr Reader;
// Connect to the service.
Connector.CreateInstance(__uuidof(MSSOAPLib30::HttpConnector30)); Connector->Property["EndPointURL"] = "http://localhost/nusoap/nusoap_server1.php?wsdl";
Connector->Connect();
Connector->Property["SoapAction"] = "http://localhost/nusoap/nusoap_server1.php/getBooks";
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","","","m");
Serializer->WriteString("nobelb");
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);
/**/
}reader->load返回-1 这是一个异常错误
想知道什么问题。
<definitions targetNamespace="http://192.168.6.60">
−
<types>
−
<xsd:schema 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="Book">
−
<xsd:all>
<xsd:element name="author" type="xsd:string"/>
<xsd:element name="title" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
−
<xsd:complexType name="BookArray">
−
<xsd:complexContent>
−
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:Book[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
</types>
−
<message name="getBookRequest">
<part name="title" type="xsd:string"/>
</message>
−
<message name="getBookResponse">
<part name="return" type="tns:Book"/>
</message>
−
<message name="getBooksRequest">
<part name="author" type="xsd:string"/>
</message>
−
<message name="getBooksResponse">
<part name="return" type="tns:BookArray"/>
</message>
−
<message name="helloRequest">
<part name="sayhi" type="xsd:string"/>
</message>
−
<message name="helloResponse">
<part name="return" type="xsd:string"/>
</message>
−
<portType name="myWsPortType">
−
<operation name="getBook">
<input message="tns:getBookRequest"/>
<output message="tns:getBookResponse"/>
</operation>
−
<operation name="getBooks">
<input message="tns:getBooksRequest"/>
<output message="tns:getBooksResponse"/>
</operation>
−
<operation name="hello">
<input message="tns:helloRequest"/>
<output message="tns:helloResponse"/>
</operation>
</portType>
−
<binding name="myWsBinding" type="tns:myWsPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
−
<operation name="getBook">
<soap:operation soapAction="http://localhost/nusoap/nusoap_server1.php/getBook" style="rpc"/>
−
<input>
<soap:body use="encoded" namespace="" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
−
<output>
<soap:body use="encoded" namespace="" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
−
<operation name="getBooks">
<soap:operation soapAction="http://localhost/nusoap/nusoap_server1.php/getBooks" style="rpc"/>
−
<input>
<soap:body use="encoded" namespace="" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
−
<output>
<soap:body use="encoded" namespace="" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
−
<operation name="hello">
<soap:operation soapAction="http://localhost/nusoap/nusoap_server1.php/hello" style="rpc"/>
−
<input>
<soap:body use="encoded" namespace="" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
−
<output>
<soap:body use="encoded" namespace="" 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>
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Add xmlns="http://tempuri.org/">
<n1>int</n1>
<n2>int</n2>
</Add>
</soap:Body>
</soap:Envelope>
别人例子里面都这样样子的,我的就完全不同了。。难道PHP做 WEBSERVICE就是不一样吗
-----------------------------------------------
http://www.wantsoft.com
隐形者软件代码交流博客
-----------------------------------------------
http://xshinfo.blogspot.com/
你的链接 打不开
这里多了个?wsdl
因此返回了wsdl的页面信息,
如果去掉就可以得到需要的返回信息了.