Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Outbound proxy is not getting triggered

former_member588480
Participant
0 Likes
4,935

I am triggering outbound proxy . It is getting triggered through Delivery output type .

Code related to proxy is getting executed but not sure why I do not see outboud proxy in SXMB_MONI.

I believe I am making some mistake while coding .

Since I am new to Proxy so need some guidance please .

I could not find particular solution in SCN how to debug this kind of proxy issue .

Please find the code below which is used to trigger proxy.

DATA: wa_pdf LIKE LINE OF li_pdf,
        g_output TYPE string,
        g_outputx TYPE xstring,
        g_attach_xstring TYPE xstring,
        attch_protocol TYPE REF TO if_wsprotocol_attachments,
        zco_pi_object TYPE REF TO zco_si_out_descartes_invoice,
        g_attachment     TYPE REF TO if_ai_attachment,
        g_attachments    TYPE prx_attach,
*          *Reference variables exception class
        lo_sys_exception   TYPE REF TO cx_ai_system_fault.       "Internal table for attachment.


*         * creating proxy object
        CREATE OBJECT zco_pi_object.
  IF  li_pdf[] IS NOT INITIAL.

   LOOP AT li_pdf INTO wa_pdf.
          CONCATENATE g_output wa_pdf INTO g_output.
        ENDLOOP.

ENDIF.

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
  EXPORTING
    text           = g_output
*   MIMETYPE       = ' '
*   ENCODING       =
IMPORTING
   buffer         = g_outputx
* EXCEPTIONS
*   FAILED         = 1
*   OTHERS         = 2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


CONCATENATE g_attach_xstring g_outputx INTO  g_attach_xstring IN BYTE MODE.


TRY.
      attch_protocol ?= zco_pi_object->get_protocol( if_wsprotocol=>attachments ).
      g_attachment = attch_protocol->get_attachment_from_binary(
      data = g_attach_xstring
      type = if_ai_attachment=>c_mimetype_pdf
      name = 'PDF Attachment' ).           " Name of PDF to be uploaded


      APPEND g_attachment TO g_attachments.
      attch_protocol->set_attachments( g_attachments ).



          CATCH cx_ai_system_fault INTO lo_sys_exception.
            COMMIT WORK.
        ENDTRY.


1 ACCEPTED SOLUTION
Read only

former_member588480
Participant
0 Likes
4,189

I am able to trigger the outbound proxy by calling the method created by outbound proxy class as there was no method named execute_asynchronous.

I am triggering outbound proxy . It is getting triggered through Delivery output type .

Code related to proxy is getting executed but not sure why I do not see outboud proxy in SXMB_MONI.

I believe I am making some mistake while coding .

Since I am new to Proxy so need some guidance please .

I could not find particular solution in SCN how to debug this kind of proxy issue .

Please find the code below which is used to trigger proxy.

DATA: wa_pdf LIKE LINE OF li_pdf,
        g_output TYPE string,
        g_outputx TYPE xstring,
        g_attach_xstring TYPE xstring,
        attch_protocol TYPE REF TO if_wsprotocol_attachments,
        zco_pi_object TYPE REF TO zco_si_out_descartes_invoice,
        g_attachment     TYPE REF TO if_ai_attachment,
        g_attachments    TYPE prx_attach,
*          *Reference variables exception class
        lo_sys_exception   TYPE REF TO cx_ai_system_fault.       "Internal table for attachment.


*         * creating proxy object
        CREATE OBJECT zco_pi_object.
  IF  li_pdf[] IS NOT INITIAL.

   LOOP AT li_pdf INTO wa_pdf.
          CONCATENATE g_output wa_pdf INTO g_output.
        ENDLOOP.

ENDIF.

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
  EXPORTING
    text           = g_output
*   MIMETYPE       = ' '
*   ENCODING       =
IMPORTING
   buffer         = g_outputx
* EXCEPTIONS
*   FAILED         = 1
*   OTHERS         = 2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


CONCATENATE g_attach_xstring g_outputx INTO  g_attach_xstring IN BYTE MODE.


TRY.
      attch_protocol ?= zco_pi_object->get_protocol( if_wsprotocol=>attachments ).
      g_attachment = attch_protocol->get_attachment_from_binary(
      data = g_attach_xstring
      type = if_ai_attachment=>c_mimetype_pdf
      name = 'PDF Attachment' ).           " Name of PDF to be uploaded


      APPEND g_attachment TO g_attachments.
      attch_protocol->set_attachments( g_attachments ).



          CATCH cx_ai_system_fault INTO lo_sys_exception.
            COMMIT WORK.
        ENDTRY.


9 REPLIES 9
Read only

Sandra_Rossi
Active Contributor
0 Likes
4,189

??

CATCH cx_ai_system_fault INTO lo_sys_exception.
            COMMIT WORK.

Are you sure you have verified that there's no exception at your side?

Read only

former_member588480
Participant
4,189

sandra.rossi During debugging I found that after the statement

attch_protocol->set_attachments( g_attachments )

Program control skips below catch statement

CATCH cx_ai_system_fault INTO lo_sys_exception.

COMMIT WORK.

I believe this is because there is no exception .

Not able to figure out if there is no exception then why proxy is not getting trigger .

Read only

Sandra_Rossi
Active Contributor
0 Likes
4,189

Okay. By the way, you didn't post the call to the Web Service, you posted only the part where you add an attachment.

Read only

former_member588480
Participant
0 Likes
4,189

sandra.rossi actually I have not used any web service to send pdf data throgh proxy .

I have followed below link for the coding . Not sure if I am following the right way of coding for outbound proxy .

outbound proxy ABAP

Kindly let me know if I need to make any correction in my code .

Thanks.

Read only

Sandra_Rossi
Active Contributor
0 Likes
4,189

Where is execute_asynchronous in your code?

Read only

former_member588480
Participant
0 Likes
4,189

sandra.rossi

I thought EXECUTED_ASYNCHRONOUS is only required to send data and since I was only sending PDF file so I did not use this method in my code.

Also while calling method EXECUTED_ASYNCHRONOUS, I am getting error saying "Method EXECUTED_ASYNCHRONOUS is unknown or PROTECTED or PRIVATE" . That means the method is not available in proxy class created by PI .

Is it mandatory to use method EXECUTED_ASYNCHRONOUS , while sending PDF file through proxy ?

Read only

Sandra_Rossi
Active Contributor
0 Likes
4,189

All other methods are used to prepare the request, EXECUTE* is to execute the request.

Read only

former_member588480
Participant
0 Likes
4,189

okay while calling the method I am getting below error so looks like Method EXECUTED_ASYNCHRONOUS is not available in proxy class .

let me know if you want to cross check anything regarding the above issue.

Read only

former_member588480
Participant
0 Likes
4,190

I am able to trigger the outbound proxy by calling the method created by outbound proxy class as there was no method named execute_asynchronous.