您的位置:首页 > 编程语言 > C语言/C++

请问VC++6.0能否连接webservice?应该如何设置

2005-09-02 14:37 537 查看
B:
VC6的开发环境没有提供像VS.NET里的Add Web reference的向导程序,如果您在VC6中开发的程序要连接webservice,通常都是使用SOAP Toolkit SDK来手工添加必须的相关代码,关于SOAP协议的详细信息和VC6的示例程序,请您参考下面的链接:

Web Services Interoperability and SOAP
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarxml/html/soapinteropbkgnd.asp

SOAP Client Using Visual C++
http://www.codeguru.com/Cpp/COM-Tech/complus/soap/article.php/c3945/

Soap client for C++
http://www.codeproject.com/webservices/SoapClient_CPP.asp

A:谢谢你的帮助
B:很高兴为你解决问题
A:您好,还有点问题
我将SOAP Toolkit 3.0安装后,并且编译了提供的例子
有如下错误:

e:/develop/cppsoapclient/soapclient.cpp(6) : error C2772:
#import referenced
a type from a missing type library; '__missing_type__'
used as a placeholder
e:/develop/cppsoapclient/debug/mssoap1.tlh(373) : error
C2061: syntax error
: identifier '__missing_type__'
e:/develop/cppsoapclient/debug/mssoap1.tlh(413) : error
C2061: syntax error
: identifier '__missing_type__'
e:/develop/cppsoapclient/debug/mssoap1.tlh(579) : error
C2146: syntax error
: missing ';' before identifier 'DOM'
...

我想和操作系统是否有关?我使用的是WinXp sp2,文档说明中是在
win2000下运行成功的
B:
您好,

编译时错误应该跟您开发所使用的平台无关,由于我推荐给您的示例程序原来用的是老版本的SOAP Toolkit SDK,不知道您有没有参照作者在原文下的注解,里面有在使用SOAP Toolkit SDK下的更新过的程序代码:

Code Update, to use with MSXML4, and, MSSOAP3
http://www.codeguru.com/Cpp/COM-Tech/complus/soap/comments.php/c3945/?thread=48222

您好!
感谢您使用微软合作伙伴新闻组技术支持!很高兴能和您一起讨论问题!

下面这篇文章是关于如何在Native Code(MFC)中调用 Web Service服务,希望对您有所帮助。
Title: Calling webService(managed C# webservice) From MFC(unmanaged) Application by retaining the session using Cookies Conatiner.
URL: http://www.codeproject.com/useritems/CoolWebServiceClient.asp#xxxx

该文章中自带的Sample编译有点问题,我已经帮您修改过了,现在已经能够正常运作,我将在附件中将相关代码发给您。在运行Client(MFC)程序前,首先必须使用IIS建立一个firstwebservice的虚拟目录,在虚拟目录中将用C#开发的WebService导入。Client(MFC)程序将使用http://localhost/firstwebservice/firstwebservice.asmx 去访问WebService服务(服务的调用顺序是:首先通过SetValue设置值,再使用Add方法去计算两数之和)。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: