我使用scratchbox交叉编译ARM(诺基亚N9)的WSO2,即使我能做到这一点也很容易。我现在需要将库部署到我的设备上。
然后我使用WSO2 CPP生成了C ++数据绑定并将它们添加为源文件(仅供参考 - 我在这里使用了ebay的FindingService.wsdl:http://developer.ebay.com/webservices/finding/latest/FindingService.wsdl)
我正在尝试执行基本上是getVersion的最简单的操作,但它不能正常工作,不能正确地序列化对象,我不知道为什么。
这是我的main.cpp代码:
int mainGetVersionUsingWSOFCPP() {
Environment::initialize("wsof.log", AXIS2_LOG_LEVEL_DEBUG);
std::string client_home = "/opt/meebay/res/axis2c/axis2.xml";
//ServiceClient sc("http://svcs.ebay.com/services/search/FindingService/v1");
FindingServiceStub *stub = new FindingServiceStub(client_home);
Options * op = stub->getOptions();
op->setSoapVersion(AXIOM_SOAP12);
GetVersionRequest *req = new GetVersionRequest();
GetVersionRequestE8 *reqE8 = new GetVersionRequestE8(req);
GetVersionResponse *res = NULL;
GetVersionResponseE3 *resE3 = NULL;
ServiceClient *sc = stub->getServiceClient();
resE3 = stub->getVersion(reqE8);
res = resE3->getGetVersionResponse();
}
以下是axis2c WSDL2CPP为此特定getVersion请求生成的代码:
com_ebay_www_marketplace_search_v1_services::GetVersionResponseE3* WSF_CALL FindingServiceStub::getVersion(com_ebay_www_marketplace_search_v1_services::GetVersionRequestE8* _getVersionRequest)
{
axis2_svc_client_t *svc_client = NULL;
axis2_options_t *options = NULL;
axiom_node_t *ret_node = NULL;
const axis2_char_t *soap_action = NULL;
axutil_qname_t *op_qname = NULL;
axiom_node_t *payload = NULL;
axis2_bool_t is_soap_act_set = AXIS2_TRUE;
axutil_string_t *soap_act = NULL;
com_ebay_www_marketplace_search_v1_services::GetVersionResponseE3* ret_val;
payload = _getVersionRequest->serialize(NULL, NULL, AXIS2_TRUE, NULL, NULL);
svc_client = serviceClient->getAxis2SvcClient();
options = clientOptions->getAxis2Options();
if (NULL == options)
{
AXIS2_ERROR_SET(Environment::getEnv()->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
AXIS2_LOG_ERROR(Environment::getEnv()->log, AXIS2_LOG_SI, "options is null in stub");
return (com_ebay_www_marketplace_search_v1_services::GetVersionResponseE3*)NULL;
}
soap_act = axis2_options_get_soap_action( options, Environment::getEnv() );
if (NULL == soap_act)
{
is_soap_act_set = AXIS2_FALSE;
soap_action = "http://www.ebay.com/marketplace/search/v1/services/getVersion";
soap_act = axutil_string_create(Environment::getEnv(), "http://www.ebay.com/marketplace/search/v1/services/getVersion");
axis2_options_set_soap_action(options, Environment::getEnv(), soap_act);
}
axis2_options_set_soap_version(options, Environment::getEnv(), AXIOM_SOAP11);
ret_node = axis2_svc_client_send_receive_with_op_qname( svc_client, Environment::getEnv(), op_qname, payload);
if (!is_soap_act_set)
{
axis2_options_set_soap_action(options, Environment::getEnv(), NULL);
axis2_options_set_action( options, Environment::getEnv(), NULL);
}
if(soap_act)
{
axutil_string_free(soap_act, Environment::getEnv());
}
if ( NULL == ret_node )
{
return (com_ebay_www_marketplace_search_v1_services::GetVersionResponseE3*)NULL;
}
ret_val = new com_ebay_www_marketplace_search_v1_services::GetVersionResponseE3();
if(ret_val->deserialize(&ret_node, NULL, AXIS2_FALSE ) == AXIS2_FAILURE)
{
if(ret_val != NULL)
{
delete ret_val;
}
AXIS2_LOG_ERROR( Environment::getEnv()->log, AXIS2_LOG_SI, "NULL returned from the _deserialize: "
"This should be due to an invalid XML");
return (com_ebay_www_marketplace_search_v1_services::GetVersionResponseE3*)NULL;
}
return ret_val;
}
您可以提供的任何帮助都是最受欢迎的,我一直在讨论这个问题已经有一段时间了。
我只是尝试生成C ++ XML数据绑定对象WSDL或XSD,因此我不必手工制作每个请求。
答案 0 :(得分:0)
对于其他任何坚持这一点的人 - 问题是我需要使用--enable-ssl支持来编译wsof / axis2c。
然后按照这里的说明如何抓取ebay .crt文件(它保存为.pem但是脚本的错误,.pem文件包含.crt和.key文件,但这只包含.crt文件):
http://axis.apache.org/axis2/c/core/docs/axis2c_manual.html#ssl_client
我只需要设置SERVER_CERT参数。
原因是URI设置为https(不要在只有http的命名空间之间混淆 - 它与端点不同,不要假装这样做。)
不管怎么说,只需要一点点盐就可以了。而且我从ebay收到SOAP错误消息 - 但我只需要根据文档设置HTTP标头,我已经完成了。