Reputation: 135
We have a cgi, that i have to migrate to gsoap 2.8.14 from an older gsoap version. Unfortunately the response isn't the same. I added //gsoap ns schema form: unqualified to the header, but that wasn't enough to get rid of all ns prefix. Second and probably the main issue is the response naming. The further LoginResult is now called result and packet in a loginResponse.
response from old cgi:
<LoginResult>
<successful>true</successful>
<token>example</token>
</LoginResult>
response from new cgi
<ns:loginResponse>
<result>
<successful>true</successful>
<token>example</token>
</result>
</ns:loginResponse>
i build the stub with soapcpp2 -e -S auth.h
the auth.h looks like this:
//gsoap ns service name: auth
//gsoap ns service style: rpc
//gsoap ns service encoding: encoded
//gsoap ns service port: http://domain.xy/cgi-bin/auth.cgi
//gsoap ns service namespace: urn:auth
//gsoap ns schema form: unqualified
typedef std::string xsd__string;
// array of strings containing all tags allowed for a specific user
class TagsArray
{
public:
xsd__string *__ptr;
int __size;
TagsArray();
};
// getTags.... result struct
class TagsResult
{
public:
bool successful;
xsd__string errorMessage;
TagsArray tags;
TagsResult();
};
// login result struct
class LoginResult
{
public:
bool successful;
xsd__string token; // also used as error message if successful == false
LoginResult();
};
// verify result struct
class VerifyResult
{
public:
bool successful;
xsd__string newToken; // also used as error message if successful == false
VerifyResult();
};
// contains a valid auth method for a specific realm
class ns__AuthMethod
{
public:
int id;
xsd__string description;
};
// array of all allowed authmethods for a specific realm
class AuthMethodArray
{
public:
ns__AuthMethod *__ptr;
int __size;
};
// a login parameter, usually username, pin, token
class ns__LoginParameter
{
xsd__string param;
xsd__string value;
};
// array of all submitted login parameters, depending on the authmethod that is used
class LoginParameterArray
{
public:
ns__LoginParameter *__ptr;
int __size;
};
// retrieve all possible authmethods for a specific realm
int ns__getAuthMethods(xsd__string realm, xsd__string user, AuthMethodArray &result);
// login and retrieve a valid token if succeeded
int ns__login(xsd__string realm, int authmethod, LoginParameterArray params, LoginResult &result);
// verify a existing token
int ns__verifyToken(xsd__string realm, xsd__string token, VerifyResult &result);
Any Idea? Thanks.
----------------- 05.04.2013 --------------- Thank you Dave!
Changes done:
set bool default value to false
// login result struct class ns_LoginResult { public: bool successful = false; xsd_string token; // also used as error message if successful == false
};
Result looks now like this:
<ns:LoginResult>
<successful>true</successful>
<token>example</token>
</ns:LoginResult>
int ns__login(xsd__string realm, int authmethod, LoginParameterArray params, ns__LoginResult &result);
the ns: prefix was handled by all clients (php, .net, c++(qt)) without problem.
Upvotes: 1
Views: 452
Reputation: 1016
You need to change LoginResult in auth.h as follows:
// login result struct
class ns__LoginResult
{
public:
bool successful;
xsd__string token; // also used as error message if successful == false
LoginResult();
};
Also change ns_login( ) method as follows:
int ns__login(xsd__string realm, int authmethod, LoginParameterArray params, ns__LoginResult &result);
The resulting response will look like this:
<ns:LoginResult>
<successful>false</successful>
<token></token>
</ns:LoginResult>
Hopefully LoginResult moving into the "ns" namespace will not pose too much of a problem for you.
Upvotes: 0