0
我已經定義了一個名爲login的函數,它應該返回一個標記。令牌有一個安全ID是一個char *gSoap C++ - C#反序列化問題
SOAP_FMAC5 int SOAP_FMAC6 __afas__login(struct soap* env, afas__Login *afas__login, afas__LoginResponse *afas__loginResponse)
{
int ret = ServiceApp::GetServiceApp()->GetServiceImpl()->login(afas__login->user, afas__login->password);
afas__loginResponse->error = soap_new_afas__Error(env, -1);
afas__loginResponse->af__token = soap_new_af__Token(env, -1);
if (ret == sERROR)
{
afas__loginResponse->error->code = afas__ErrorCode__NOTLOGGEDIN;
}
else
{
afas__loginResponse->error->code = afas__ErrorCode__SUCCESS;
afas__loginResponse->af__token->sessionId = soap_strdup(env, soap_int2s(env, ret));
afas__loginResponse->af__token->securityId = soap_strdup(env, afas__login->password);
afas__loginResponse->af__token->userName = soap_strdup(env, afas__login->user);
}
return SOAP_OK;
}
在客戶端,我需要打個電話本:
AuthenticationServiceClient a = new AuthenticationServiceClient();
Login login = new Login();
login.user = "test";
login.password = "test";
LoginResponse lr = a.login(login);
string securityId = lr.token.sessionId
的問題是,secuirtyId爲空。不知何故,它不會被反序列化。 另一方面,錯誤代碼,這是一個整數正確反序列化。
有什麼建議嗎?