WebService中多个WebMethod使用了SoapHeader,非托管VC客户端自动生成的代理类中包含多个SoapHeader的实例
huhe 2006-07-26 11:48:48 为了实现用户身份验证,在WebService中多个WebMethod使用了SoapHeader,托管代码客户端自动生成的代理类很正常,但非托管VC客户端自动生成的代理类中却包含多个SoapHeader的实例,导致客户端调用WebMethod时,不知道该用哪个SoapHeader。
请高手答疑解惑!
开发环境:Visual Studio 2003
WebService服务器端语言:C#
非托管客户端语言:VC++ 7.1
WebService部分代码:
public class Credential : SoapHeader { // 身份证书
public string User; // 用户名
public string Password; // 密码
}
public class AALWebService : System.Web.Services.WebService {
public Credential credential;
[WebMethod]
[SoapHeader("credential", Direction=SoapHeaderDirection.In)]
public string Hello(){
if(credential.User == "tom" && credential.Password == "12345")
return "Hello, Tom";
else
return "No Credential Error";
}
……
部分非托管VC++代理类代码:
template <typename TClient = CSoapSocketClientT<> >
class CAALWebServiceT :
public TClient,
public CSoapRootHandler
{
public:
//
// SOAP headers
//
Credential Credential21;
Credential Credential18;
Credential Credential50;
Credential Credential20;
……