VS 2003 SOAP 升级到 VS2008 (未验证 )

原文地址 :

https://blogs.msdn.microsoft.com/jpsanders/2008/01/17/building-with-atlserver-based-soap-project-with-visual-studio-2008/

 

Building with ATLServer based SOAP project with Visual Studio 2008

★★★★★

★★★★

★★★

★★

avatar of jpsandersJeff SandersJanuary 17, 20080

 


 

UPDATE: Replace ATLServer with WWSAPI! Windows Web Services API Client code walkthrough 

 

 

 

 

 

When I tried to build an old ATLServer WebClient SOAP project I got these errors:

 

 

 

fatal error C1083: Cannot open include file: 'atlsrvres.h': No such file or directory

 

fatal error RC1015: cannot open include file 'atlsrvres.h'

 

 

 

Download the latest ATLServer code from http://www.codeplex.com/AtlServer and unzip it on the build machine.

 

 

 

Set the resource and C++ include paths of your project to point to the include folder location from the unzipped codeplex code.

 

 

 

  1.   I then got this error:

 

 

 

error C2337: 'request_handler' : attribute not found

 

error C2337: 'soap_handler' : attribute not found

 

 

 

I found this thread (Orcas is Visual Studio 2008 now):

 

http://www.codeplex.com/AtlServer/Thread/View.aspx?ThreadId=12010

 

 

 

ATL Server attributes are not supported by Orcas compiler. You have to remove attributes from your code and get non-attributed ATL Server code that used to be injected by the compiler. To do this, recompile your code with /FX with the current version of compiler you are using. Here is more information about what /FX does - http://msdn2.microsoft.com/en-us/library/d8ex062w(VS.80).aspx. After compiler generated .mrg files, make a backup copy of your old source files and replace them with .mrg. files generated by /FX build. Rebuild your app with the current version of Visual Studio and make sure everything works as expected. Then port the code to Orcas and version of ATL Server from this project. You can comment out attributes now and Orcas compiler should build new source just fine.

 

 

 

 

 

 

 

I did this and then had one more hurdle!

 

 

 

error C2065: 's_szAtlsWSDLSrf' : undeclared identifier                    

 

 

 

Add this to stdafx.h before the <atlsoap.h> include

 

 

 

#include <atlspriv.h>

 

_ATLSOAP_DECLARE_WSDL_SRF();

 

 

 

Everything builds fine now.

 

Tags AtlServer SOAP


Comments (0)

 

You must be logged in to post a comment.

 

关联信息 

https://archive.codeplex.com/?p=atlserver

ATL SOAP Server in VS2008?

I have a SOAP Service with nearly 100 SOAP methods, implemented with ATL Server in VS2005. In trying to port this to VS2008, which does not support attributes, I found the discussion on this site at http://www.codeplex.com/AtlServer/Thread/View.aspx?ThreadId=12010. After following the instructions there to use the /Fx switch to inject the code that the attributes would inject, I end up with nearly 13,000 lines of injected, unmaintainable spaghetti code.

Surely this is not the way to write SOAP Services with ATL Server in VS2008. Surely there are some convenient macros that replace the soap_handler and soap_method attributes of VS2003/2005; something like DECLARE_SOAP_METHOD(...) that allow writing SOAP Services without attributes. Right?? The documentation at http://msdn2.microsoft.com/en-us/library/d73hf29a(VS.80).aspx does not mention any such macros. Where is ATL Server documentation now that it is not part of VS2008?


 

Thread #22054 | Message #73549 | 2008-02-13

I was able to build a couple of ATLServer projects successfully. It was a little painful but ultimately I succeeded. I blogged my experiences here:
(http://blogs.msdn.com/jpsanders/archive/2008/01/17/building-with-atlserver-based-soap-project-with-visual-studio-2008.aspx)

Alternatively, use the Managed classes and wizards in Visual Studio 2008 to access Web Services. You may use COM Interop to use this managed code inside your unmanaged C++ code. COM Interop is discussed here: http://msdn2.microsoft.com/en-us/library/zsfww439.aspx

Thread #22054 | Message #75195 | 2008-02-20

jpsanders,
Thanks for your reply. Unfortunately, this is the "solution" I already found as indicated in my original post. I can get it to build in VS2008, that was not the problem. The problem is that this solution is not workable.

When you replace the attributes with the code that they inject, you get lots of unmaintainable machine generated spaghetti code defining the SOAP map, data types, the interface, etc (over 13,000 lines in my case.) Look at this generated code for a non-trivial web service and imagine trying to add new SOAP data types (e.g., structs and enums) and/or methods to your interface, or modifying an existing data type or method. Imagine trying to write a brand new SOAP web service in C++ with ATLServer. It's theoretically possible, but certainly not practical.

Also, sure, I could use managed code with or without interop to access a webservice. But I am talking about implementing a web service, not accessing one. Sure, I could expend valuable time and effort rewriting the entire web service in managed code, but that is not my first choice either.

My conclusion is that VS2008+ATLServer no longer support native C++ web services and I will not be upgrading to VS2008 at this time. Perhaps someone will add some kind of support for this to ATLServer in the future. But it is unfortunate that MS did not do anything to preserve backward compatibility in this area.


 

Thread #22054 | Message #75246 | 2008-02-20

I hope also that a solution for "ATL Server attributes" for VS2008 will be found by someone in a near future (Microsoft ?) ! The /FX option produce unreadable code !

We have a very large project (over 2000 sources files.) with more than 30 web service functions and very complex data structure being used by these functions.

So, in the mean time, we isolated attributes reference in only two files (a .cpp an a .h) These two files are compiled with the /FX option with VS 2005, and the mrg files produces are used instead in our VS2008 project.

Since the definition of web services does not change often, we will not have to recompile with VS2005 too often.

Thread #22054 | Message #78190 | 2008-03-04

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值