Quantcast
Viewing all articles
Browse latest Browse all 750

Deep Entity structure to and from gateway xml

I am able to go from the deep entity structure to the gateway xml by the following:

 

        lo_med_provider = /iwfnd/cl_med_factory=>get_med_provider( ).

         so_service = lo_med_provider->get_service_group(

           iv_external_name = 'ZXREF_CRUD_SRV'

           iv_namespace     = '' ).


            lo_sodata_mapper = /iwfnd/cl_sodata_mapper=>get_mapper(

                                  io_service           = so_service

                                  iv_service_name      = 'ZXREF_CRUD_SRV'

                                  iv_service_version   = '0001'

                                  iv_service_namespace = '/SAP/'

                                  iv_base_url          = 'http://host:port/sap/opu/odata/sap/ZXREF_CRUD_SRV/'

                                  iv_is_deep_insert    = abap_true ).

 

             lo_entity_set = lo_sodata_mapper->get_edm_entity_set(

                                  iv_entity_set = 'HeaderSet' ).

 

             lt_expand = lo_sodata_mapper->get_expand_clause(

                                  io_entity_set        = lo_entity_set

                                  iv_expand_value      = 'HeadItem' ).

 

             GET REFERENCE OF wa_msg_body INTO lr_data.

             lo_entity_provider = lo_sodata_mapper->get_entity_prov_by_entry_data(

               io_entity_set     = lo_entity_set

               ir_data           = lr_data

               iv_format         = 'xml'

               it_expand         = lt_expand

               it_inline_info    = it_inline_info ).

 

             lo_entity = /iwcor/cl_rest_message_builder=>create_message_entity( /iwcor/if_rest_message=>gc_message_kind_none ).

             lo_entity_provider->write_to( lo_entity ).

 

             lv_xstring = lo_entity->get_binary_data( ).

             lv_string = lo_entity->get_string_data( ).


But I cannot work out how to go the other way, that is from xml into the deep entity structure.

This is what I have:


            lo_logger = /iwbep/cl_cos_logger=>init_logger( iv_userid = sy-uname ).

 

             lo_runtime = /iwbep/cl_mgw_runt_remote_util=>get_mgw_rt_model_impl(

                            iv_service_document_name = ls_request_context-service_doc_name

                            iv_service_namespace     = ls_request_context-namespace

                            iv_entity_name           = ls_request_context-target_entity

                            iv_service_version       = ls_request_context-version ).

 

             CREATE OBJECT lo_mgw_context TYPE /iwbep/cl_mgw_context

               EXPORTING

                 it_context           = ls_request_context-context_params

                 is_system_alias_info = ls_request_context-system_alias_info.

 

             CALL BADI lo_runtime->/iwbep/if_mgw_core_srv_runtime~init

               EXPORTING

                 iv_service_document_name = ls_request_context-service_doc_name

                 iv_namespace             = ls_request_context-namespace

                 iv_version               = ls_request_context-version

                 io_context               = lo_mgw_context.

 

             CALL BADI lo_runtime->/iwbep/if_mgw_core_srv_runtime~changeset_begin

               EXPORTING

                 it_operation_info = mt_changeset_operation_info.

 

             CREATE OBJECT lo_entry_provider_back TYPE /iwbep/cl_mgw_entry_raw_prv

               EXPORTING

                 iv_raw_data = lv_xstring.

 

             CALL BADI lo_runtime->/iwbep/if_mgw_core_srv_runtime~create_entity

               EXPORTING

                 iv_entity_name     = ls_request_context-target_entity

                 iv_source_name     = ls_request_context-source_entity

                 io_data_provider   = lo_entry_provider_back

                 is_request_details = ls_request_context

               CHANGING

                 ct_headers         = et_header

                 cr_entity          = lr_data

                 ct_inline_info     = lt_inline_info.

 

which takes me all the way to the redefined method on the gateway service but fails at:

io_data_provider->read_entry_data( IMPORTING es_data = wa_msg_body ).


specifically

      call transformation id

        source xml mv_raw_data

        result entity = es_data.


it looks like the mv_raw_data is changed somewhere along the trail..... The same data works from the GW_CLIENT.


Any thoughts?





Viewing all articles
Browse latest Browse all 750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>