2012-07-17 30 views
0

我使用scratchbox交叉編譯WSO2 for ARM(諾基亞N9),即使我可以做到這一點也很容易。我現在有需要部署到我的設備上的庫。無法使用WSO2執行簡單的SOAP操作(Axis2c)

我已經然後生成的C++數據使用WSO2 CPP結合和加入它們作爲源文件(僅供參考 - 我使用的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(); 

} 

,這裏是由WSDL2CPP AXIS2C這個特殊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

對於那些堅持這一點的人 - 問題是我需要使用--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頭,我就完成了。