Skip to Content
0
Former Member
Sep 09, 2007 at 05:06 PM

cannot send an attachment -- set/get attachments in ABAP proxies

227 Views

Hello experts,

I have a problem while sending an attachment from a client to a server ( ABAP proxy <--> XI -<-> ABAP proxy ). I did the following:

Client (set attachment):

 DATA: interface TYPE REF TO co_hrrcf_resumeparse_qr,
            attachment_protocol TYPE REF TO if_wsprotocol_attachments,
            attachment          TYPE REF TO if_ai_attachment,
            attachments         TYPE prx_attach.

      CREATE OBJECT  interface.
      attachment_protocol ?=  interface->get_protocol( if_wsprotocol=>attachments ).
      attachment = attachment_protocol->get_attachment_from_text(
              data = 'Hello World'
              type = if_ai_attachment=>c_mimetype_text_plain
              name = 'TEXT_ATTACH' ).
      APPEND attachment TO attachments.
      attachment_protocol->set_attachments( attachments ).

      CALL METHOD interface->execute_synchronous
        EXPORTING
          output = ls_proxy_data_out
        IMPORTING
          input  = ls_proxy_data_in.

Server (get attachment sent by the client):

 
  DATA server_context TYPE REF TO if_ws_server_context.
  DATA attachment_prot TYPE REF TO if_wsprotocol_attachments.
  data attachments         TYPE prx_attach.

      server_context = cl_proxy_access=>get_server_context( ).
      attachment_prot ?= server_context->get_protocol( if_wsprotocol=>attachments ).

      attachments = attachment_prot->get_attachments( ).

The problem is the server did not get the attachments sent by the client.

Any suggestions on what might cause the problem?

The coding above I copied from CL_SXIVERIATTACH_SYNC_IN and CO_SXIVERIATTACH_SYNC_OUT delivered by SAP.

Thank you and regards,

-Michelle