1.通过VS2005创建了一个ATL Web Service项目,名称为trs:
2.编辑trs.h文件,新增接口test,其内容如下:// trs.h : 定义 ATL Server 请求处理程序类
//
#pragma once
#include <vector>
#include <iostream>
using namespace std;
namespace trsService
{
// webservice 的所有 struct、enum 和 typedef 应进入命名空间// ItrsService - Web 服务接口声明
//
[
uuid("7F1783C1-CEE6-432E-BC14-79EF82D7C24D"), 
object
]
__interface ItrsService
{
// HelloWorld 是一个示例 ATL Server Web 服务方法。它显示如何
// 声明 Web 服务方法及其 in 参数和 out 参数
[id(1)] HRESULT HelloWorld([in] BSTR bstrInput, [out, retval] BSTR *bstrOutput);
[id(2)] HRESULT test([in] int a, [out, retval] vector<int> *bstrOutput);
// TODO: 在此添加其他 Web 服务方法
};
// trsService - Web 服务实现
//
[
request_handler(name="Default", sdl="GentrsWSDL"),
soap_handler(
name="trsService", 
namespace="urn:trsService",
protocol="soap"
)
]
class CtrsService :
public ItrsService
{
public:
// 这是一个示例 Web 服务方法,它显示如何使用 
// soap_method 属性将方法公开为 Web 方法
[ soap_method ]
HRESULT HelloWorld(/*[in]*/ BSTR bstrInput, /*[out, retval]*/ BSTR *bstrOutput)
{
CComBSTR bstrOut(L"Hello ");
bstrOut += bstrInput;
bstrOut += L"!";
*bstrOutput = bstrOut.Detach();

return S_OK;
} [ soap_method ]
HRESULT test(/*[in]*/ int a, /*[out, retval]*/ vector<int> *bstrOutput)
{
vector<int> vta;
for(int i=0;i<10;i++)
{
vta.push_back(i)
}
*bstrOutput = vta;
return S_OK;
}
// TODO: 在此添加其他 Web 服务方法
}; // 类 CtrsService} // 命名空间 trsService
编译后返回一大堆错误,看起来好像不支持用vector<int> 作为参数,有人知道该如何操作吗,为这个问题困惑很久了。错误 1 error C2760: 语法错误 : 应输入“标识符”而不是“<” d:\visual studio 2005\trs\trs\trs.h 32
错误 2 error C2760: 语法错误 : 应输入“{”而不是“int” d:\visual studio 2005\trs\trs\trs.h 32
错误 3 error C2059: 语法错误 : “,” d:\visual studio 2005\trs\trs\trs.h 32
错误 4 error C2059: 语法错误 : “)” d:\visual studio 2005\trs\trs\trs.h 32
错误 5 error C2143: 语法错误 : 缺少“;”(在“{”的前面) d:\visual studio 2005\trs\trs\trs.h 32
错误 6 error C2447: “{”: 缺少函数标题(是否是老式的形式表?) d:\visual studio 2005\trs\trs\trs.h 32
错误 7 error C2065: “___std_vector”: 未声明的标识符 d:\visual studio 2005\trs\trs\trs.h 32
错误 8 error C2062: 意外的类型“int”  d:\visual studio 2005\trs\trs\trs.h 32
错误 9 error C2143: 语法错误 : 缺少“;”(在“}”的前面) d:\visual studio 2005\trs\trs\trs.h 32
错误 10 error C2059: 语法错误 : “}” d:\visual studio 2005\trs\trs\trs.h 32
错误 11 error C2143: 语法错误 : 缺少“;”(在“{”的前面) d:\visual studio 2005\trs\trs\trs.h 32
错误 12 error C2447: “{”: 缺少函数标题(是否是老式的形式表?) d:\visual studio 2005\trs\trs\trs.h 32
错误 13 error C2059: 语法错误 : “,” d:\visual studio 2005\trs\trs\trs.h 32
错误 14 error C2143: 语法错误 : 缺少“;”(在“{”的前面) d:\visual studio 2005\trs\trs\trs.h 32
错误 15 error C2447: “{”: 缺少函数标题(是否是老式的形式表?) d:\visual studio 2005\trs\trs\trs.h 32
错误 16 error C2059: 语法错误 : “}” d:\visual studio 2005\trs\trs\trs.h 32
错误 17 error C2143: 语法错误 : 缺少“;”(在“}”的前面) d:\visual studio 2005\trs\trs\trs.h 32
错误 18 error C2059: 语法错误 : “}” d:\visual studio 2005\trs\trs\trs.h 32
错误 19 fatal error C1075: 与左侧的 大括号“{”(位于“d:\visual studio 2005\trs\trs\trs.h(9)”)匹配之前遇到文件结束 d:\visual studio 2005\trs\trs\trs.h 32 还有如果自定义了一个数据类型,如何对其进行序列化呢????