当前位置:编程学习 > C#/ASP.NET >>

高手帮帮忙。急!vs2005用MS SOAP Toolkit 3.0访问Amazon.com过程中出现错误

在vs2005中建立一个win32 console application,然后代码如下:
#include "stdafx.h"
#include <stdio.h>
#include <tchar.h>
#include<iostream> 
using namespace std; 

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

using namespace MSXML2;
using namespace MSSOAPLib30;


int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize(NULL); 

ISoapSerializerPtr Serializer; 
ISoapReaderPtr Reader; 
ISoapConnectorPtr Connector; 

// 与Web服务连接
Connector.CreateInstance(__uuidof(HttpConnector30)); 
Connector->Property["EndPointURL"] = "http://webservices.amazon.com/AWSECommerceService/ JP/AWSECommerceService.wsdl"; 
Connector->Property["AuthUser"] = "hanrong";
Connector->Property["AuthPassword"] = "798623415859yy";
//Connector->Property["UseProxy"] = true;
//Connector->Property["ProxyServer"] = "192.168.142.65";
//Connector->Property["ProxyPort"] = "808";
Connector->Connect(); 

// 开始消息
Connector->Property["SoapAction"] = "http://soap.amazon.com/ItemSearch"; 
Connector->BeginMessage(); 

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

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

// 创建SOAP消息
Serializer->StartEnvelope("","",""); 
Serializer->StartBody(""); 
Serializer->StartElement("ItemSearch","http://webservices.amazon.com/AWSECommerceService/ 2007-07-16","",""); 
Serializer->WriteXml("<AWSAccessKeyId>1BE626EEEFWRD1RCFT02</AWSAccessKeyId>" );
Serializer->StartElement("Request","","","");
Serializer->WriteXml("<Keywords>""all rise""</Keywords>" );
Serializer->WriteXml("<SearchIndex>Music</SearchIndex>");
Serializer->WriteXml("<ResponseGroup>Small</ResponseGroup>");
Serializer->EndElement(); 
Serializer->EndElement();
Serializer->EndBody(); 
Serializer->EndEnvelope();  
Serializer->Finished();
cout<<"write SOAP message";

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

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

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

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


return 0;
}

(1)cout<<(const char *)(Reader->RpcResult->text);如果不注释掉,会编译错误
ompiling...
test1.cpp
.\test1.cpp(72) : error C2039: 'text' : is not a member of 'IXMLDOMElement'
        d:\program files\microsoft visual studio 8\vc\platformsdk\include\msxml.h(4567) : see declaration of 'IXMLDOMElement
(2)cout<<(const char *)(Reader->RpcResult->text);这一句注释掉后,在程序的运行中报错。
程序出错:“This application has requested the Runtime to terminate it in an unusual way. Please contact the application's supplrt team for more information.”


请高手帮帮忙,我已经想连Amazon.com网站的接口很长时间了,一直都弄不出来,很着急!非常感谢! --------------------编程问答-------------------- 怎么没有人回呀?很郁闷啊!
--------------------编程问答-------------------- 我也不会,只能帮你顶了! --------------------编程问答-------------------- 有人帮顶挺感激的,现在我又换了一个方式访问Amazon网站的接口了,但是还是不知道上面的程序为什么不好使?
--------------------编程问答-------------------- 高手看看啊! --------------------编程问答-------------------- 这个简单啊,网上搜一下就得到答案了. --------------------编程问答-------------------- 我也想了解,谢谢LZ. --------------------编程问答-------------------- mark 我正要搞这个
--------------------编程问答-------------------- 我也遇到了同样问题,求指教
补充:.NET技术 ,  Web Services
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,