#include <stdio.h>

#import "msxml3.dll" 
using namespace MSXML2; 

#import "C:\Program Files\Common Files\MSSoap\Binaries\MSSOAP1.dll"//\
//        exclude("IStream", "ISequentialStream", "_LARGE_INTEGER",\ 
    //            "_ULARGE_INTEGER", "tagSTATSTG", "_FILETIME") 

using namespace MSSOAPLib; 

void main() 

    CoInitialize(NULL); 

    ISoapSerializerPtr Serializer; 
    ISoapReaderPtr Reader; 
    ISoapConnectorPtr Connector; 

    // 与Web服务连接
    Connector.CreateInstance(__uuidof(HttpConnector)); 
    Connector->Property["EndPointURL"] = "http://localhost:2501/WEbserviceDemo/Service.asmx?wsdl"; 
    Connector->Connect(); 

    // 开始消息
//    const char*strTemp = "http://tempuri.org/Add";
    Connector->Property["SoapAction"] = "http://tempuri.org/Add"; 
    Connector->BeginMessage(); 

    // 创建SoapSerializer对象
    Serializer.CreateInstance(__uuidof(SoapSerializer)); 

    // 将serializer连接到connector的输入字符串
    Serializer->Init(_variant_t((IUnknown*)Connector->InputStream)); 

    // 创建SOAP消息
    Serializer->startEnvelope("","",""); 
    Serializer->startBody(""); 
    Serializer->startElement("Add","http://tempuri.org","",""); 
    Serializer->startElement("a","http://tempuri.org", "","");
    Serializer->writeString("5");
    Serializer->endElement();
    Serializer->startElement("b","http://tempuri.org","","");
    Serializer->writeString("10");
    Serializer->endElement();
    Serializer->endElement();
    Serializer->endBody();
    Serializer->endEnvelope();


    // 将该消息发送给web服务
    Connector->EndMessage(); 

    // 读取响应
    Reader.CreateInstance(__uuidof(SoapReader)); 

    // 将reader联接到connector的输出字符串
    Reader->Load(_variant_t((IUnknown*)Connector->OutputStream), ""); 

    // 显示结果
    printf("Answer: %s\n", (const char *)Reader->RPCResult->text); 
    CoUninitialize();



为什么结果老是  answer:0