Application Development 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: 

ABAP Proxy - trace

jakob_steen-petersen
Contributor
0 Kudos
1,888

Hi

I´m using an ABAP Proxy to consume a webservice. The Webservice does not return the correct data, so i need to send the actual raw XML to the Webservice developer.

But where can i find the actual XML of the call (and the response)?

We are NOT using SAP PI - the Webservice is called directly from AS ABAP.

15 REPLIES 15

former_member189779
Active Contributor
0 Kudos
584

Check transaction SXMB_MONI if you can find your proxy XML messages. Ideally you should be able to find them in processed XML messages. Double click on message and check payload from actual XML message which was transmitted.

0 Kudos
584

Hi

SXMB_MONI is empty. No messages are shown in this transaction on the AS ABAP system.

But i´m sure that i have called the service and got response...

0 Kudos
584

Hi Jakob,

The default trace level in SXMB_MONI for synchronous services is to only display a message in the event of an error (space reasons I assume).  Talk to your BASIS guys about making sure the trace level is extended to all messages - we have done this in our development system for unit testing purposes.

Regards,

Ryan Crosby

0 Kudos
584

Well in this case i am "the basis guy"... But i cannot find anything about that parameter. I have set parameter Runtime/trace_level = 3 in T-code SXMB_ADM - but this did´nt do the trick.

Do you know which parameter to change?

0 Kudos
584

Hi Jakob,

One of the BASIS guys here says it's the parameter LOGGING_SYNC under the RUNTIME category. 

Regards,

Ryan Crosby

0 Kudos
584

Hi

Yes i have tried that parameter - and normally in an PI environment i would expect it to work. But it seems to me that nothing is stored in the SXMB_XXX transactions at all. If i call the statistics overview it´s also empty.

0 Kudos
584

Hi Jakob,

I would check how this ABAP Proxy is executed then because I just checked this in our R/3 development environment where we call an outside web service and I had an entry for both the outbound and inbound message show in SXMB_MONI. 

Regards,

Ryan Crosby

0 Kudos
584

Hi

I could have done it totally wrong, but the way i´m using the proxy is:

1. Generating client proxy in SE80 using wsdl

2. Setting up a logical port using LPCONFIG. The port points to an HTTP destination (defined in SM59)

3. Using the Class in a simpleABAP program.

Its working fine with another service on the same system - but still i cannot see anything in SXMB_MONI. It´s seems to me that the "XI" part of my AS ABAP is not used at all?

0 Kudos
584

Hi Jakob,

I imagine the source code for the ABAP program is rather small?  Can you include it so I can see how you are calling the proxy?

Regards,

Ryan Crosby

0 Kudos
584

REPORT  zjsp_test_alf5.

TYPE-POOLS: sai.

PARAMETERS: p_fna  type char255

           ,p_state type zzalforgfil

           .

DATA:

* Reference variables for proxy and exception class

   lo_clientproxy     TYPE REF TO zalfco_discovery_service_port

  ,lo_sys_exception   TYPE REF TO cx_ai_system_fault

  ,lo_alf_excep   TYPE REF TO zalfcx_cmis_exception

* Structures to set and get message content

  ,ls_request         TYPE ZALFQUERY

  ,ls_response        TYPE ZALFQUERY_RESPONSE

  ,l_pdf_xstring        TYPE xstring

  ,l_pdf_string    TYPE string

  ,l_len               TYPE i

  ,l_error     TYPE string

  .

DATA:

lo_ws_header_protocol TYPE REF TO if_wsprotocol_ws_header

,lo_ws_payload   TYPE REF TO if_wsprotocol_payload

.

DATA: BEGIN OF gs_key

       ,product   TYPE string

       ,synonym   TYPE string

       ,apbnr     TYPE string

       ,casnr     TYPE string

       ,einecsnr  TYPE string

       ,matnr     TYPE string

       ,kampagne  TYPE string

       ,report    TYPE string

       ,workarea  TYPE string

       ,specnr    TYPE string

       ,formula   TYPE string

       ,filename  type string

     ,END OF gs_key

     .

START-OF-SELECTION.

*  PERFORM read_key_file.

  ls_request-repository_id = '500285df-c564-4b39-87e0-92a37af85814'.

*  ls_request-folder_id = 'workspace://SpacesStore/27a8ccc4-182f-40be-bbe8-49b2d63fb03f'.

  data: l_file type string

       ,l_lang type string

       .

  concatenate ''''

              p_fna

*              '%'

              ''''

  into l_file.

  concatenate ''''

              'DA'

              ''''

  into l_lang.

*AND apb:language = 'DA'

  concatenate 'SELECT cmis:objectId, cmis:name FROM apb:document WHERE cmis:name ='

              l_file

*              'AND'

*              'apb:language'

*              '='

*              l_lang

  into

  ls_request-statement separated by space.

  ls_request-statement = 'SELECT cmis:objectId, cmis:name FROM apb:document WHERE apb:workArea LIKE ''RVN_STOR%'' AND apb:specNr = ''000000004323'' AND apb:language = ''DA''' .

*  replace 'XXXXX' with p_fna into ls_request-statement.

  ls_request-INCLUDE_ALLOWABLE_ACTIONS = abap_true.

  ls_request-include_relationships = 'true'.

  TRY.

* create proxy client

      CREATE OBJECT lo_clientproxy.

* do synchronous client proxy call

      lo_ws_header_protocol ?= lo_clientproxy->get_protocol( if_wsprotocol=>ws_header ).

      DATA: ixml TYPE REF TO if_ixml,

            xml_document TYPE REF TO if_ixml_document,

            xml_root TYPE REF TO if_ixml_element,

            xml_element TYPE REF TO if_ixml_element,

            xml_node TYPE REF TO if_ixml_node.

      DATA: l_string TYPE string

           ,l_xstring TYPE xstring

           ,l_name TYPE string

           ,l_namespace TYPE string

           ,l_timeex  TYPE t

           ,l_timestamp  TYPE string

           .

      CONCATENATE

      '<Header>'

      '<wsse:Security mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">'

        '<wsu:Timestamp wsu:Id="Timestamp-14" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">'

          '<wsu:Created>datetimecr</wsu:Created>'

          '<wsu:Expires>datetimeex</wsu:Expires>'

        '</wsu:Timestamp>'

        '<wsse:UsernameToken wsu:Id="UsernameToken-13" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">'

          '<wsse:Username>admin</wsse:Username>'

        '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">xxxxx</wsse:Password>'

        '<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">z19+kYjX6OqD5CCk5Btj7g==</wsse:Nonce>'

        '<wsu:Created>datetimecr</wsu:Created>'

        '</wsse:UsernameToken>'

      '</wsse:Security>'

      '</Header>'

*      CONCATENATE

*        '<SOAP:Header>'

*        '<wsse:Security mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">'

*        '<wsse:UsernameToken>'

*        '<wsse:Username>sap-alfresco-dev</wsse:Username>'

*        '<wsse:Password Type="PasswordText">htas?1234</wsse:Password>'

*

**        '<wsse:Password>htas?1234</wsse:Password>'

*        '</wsse:UsernameToken>'

*        '</wsse:Security>'

*        '</SOAP:Header>'

             INTO l_string.

*

      PERFORM create_timestamp

         USING sy-datum sy-uzeit

                        CHANGING l_timestamp.

      REPLACE 'datetimecr' WITH l_timestamp INTO l_string.

      l_timeex = sy-uzeit + 120.

      PERFORM create_timestamp

      USING sy-datum l_timeex

                        CHANGING l_timestamp.

      REPLACE 'datetimeex' WITH l_timestamp INTO l_string.

* convert to xstring

      l_xstring = cl_proxy_service=>cstring2xstring( l_string ).

      IF NOT l_string IS INITIAL.

* create ixml dom document from xml xstring

        CALL FUNCTION 'SDIXML_XML_TO_DOM'

          EXPORTING

            xml           = l_xstring

          IMPORTING

            document      = xml_document

          EXCEPTIONS

            invalid_input = 1

            OTHERS        = 2.

        IF sy-subrc = 0 AND NOT xml_document IS INITIAL.

          xml_root = xml_document->get_root_element( ).

          xml_element ?= xml_root->get_first_child( ).

* add header element by element to soap header

          WHILE NOT xml_element IS INITIAL.

            l_name = xml_element->get_name( ).

            l_namespace = xml_element->get_namespace_uri( ).

            lo_ws_header_protocol->set_request_header( name = l_name namespace = l_namespace dom = xml_element ).

            xml_element ?= xml_element->get_next( ).

          ENDWHILE.

        ENDIF.

      ENDIF.

      CALL METHOD lo_clientproxy->query

        EXPORTING

          query          = ls_request

        IMPORTING

          query_response = ls_response.

    CATCH cx_ai_system_fault INTO lo_sys_exception.

*   Error handling

      CALL METHOD lo_sys_exception->if_message~get_text

*       EXPORTING

*         preserve_newlines =

        RECEIVING

          result            = l_error

          .

      WRITE: / l_error.

    CATCH zalfcx_cmis_exception INTO lo_alf_excep.

      CALL METHOD lo_alf_excep->if_message~get_text

*       EXPORTING

*         preserve_newlines =

      RECEIVING

        result            = l_error

        .

      WRITE: / l_error.

      write: / LO_ALF_EXCEP->CMIS_EXCEPTION-MESSAGE.

      CALL METHOD lo_alf_excep->if_message~get_longtext

*       EXPORTING

*         preserve_newlines =

      RECEIVING

        result            = l_error

        .

      WRITE: / l_error.

  ENDTRY.

break eg_jsp.

*  write: / ls_response-object_id, 'created'.

*&---------------------------------------------------------------------*

*&      Form  CREATE_TIMESTAMP

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      <--P_L_TIMESTAMP  text

*      -->P_SY_DATUM  text

*      -->P_SY_UZEIT  text

*----------------------------------------------------------------------*

FORM create_timestamp

                       USING    p_d

                                p_t

                       CHANGING p_timestamp.

  p_timestamp = 'yyyy-mm-ddTtt:mm:ssZ'.

  REPLACE:  'yyyy' WITH p_d+00(4) INTO p_timestamp

           ,'mm'   WITH p_d+04(2) INTO p_timestamp

           ,'dd'   WITH p_d+06(2) INTO p_timestamp

           ,'tt'   WITH p_t+00(2) INTO p_timestamp

           ,'mm'   WITH p_t+02(2) INTO p_timestamp

           ,'ss'   WITH p_t+04(2) INTO p_timestamp

           .

ENDFORM.                    " CREATE_TIMESTAMP

0 Kudos
584

Hi,

Now I see the issue... since you are executing it directly without an interface that is defined from a PI or XI system (you'd see the method EXECUTE_SYNCHRONOUS) it's not going to run on the integration engine where you would get the log in SXMB_MONI.

Regards,

Ryan Crosby

0 Kudos
584

Yes exactly  - as i wrote in the first post: "We are NOT using SAP PI - the Webservice is called directly from AS ABAP"

There is no integration engine involved at all...

0 Kudos
584

I skimmed the overall gist and saw reference to SXMB_MONI so I missed some of the particulars for your problem

former_member189779
Active Contributor
0 Kudos
584

Try testing it through SE80 by entering your class name and method name.

0 Kudos
584

Hi

Yes could be an idea - but i have one simple problem: the Testtool cannot start up because i´m on an Citrix enviroment who currently cannot start the New ABAP editor..

Silly problem  - but a fact

Also i´m not sure if i can pass the Security header in the Testtool of SE80?