0

Scratchbox を使用して ARM (Nokia 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();

}

そして、この特定の getVersion リクエストに対して axis2c WSDL2CPP によって生成されたコードは次のとおりです。

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;

    }

あなたが提供できるどんな助けも大歓迎です。私はしばらくの間、この問題に頭を悩ませてきました。

WSDL または XSD のいずれかで C++ XML データバインディング オブジェクトを生成しようとしているだけなので、各リクエストを手作業で作成する必要はありません。

4

1 に答える 1

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 ヘッダーを設定するだけで完了です。

于 2012-07-17T22:01:44.643 に答える