Leonardo Palacio
Leonardo Palacio

Reputation: 11

Call AFIP MTXCA web-service properly from SAP ECC

I am trying to call the AFIP WebService MTXCA directly from SAP ECC. There is no problem with that. The thing is when I try to get the TOKEN and SIGN from the first WS

https://wsaahomo.afip.gov.ar/ws/services/LoginCms?WSDL

I can not sign the XML to build the right CMS to get the proper answer from AFIP.

Upvotes: 0

Views: 325

Answers (1)

Leonardo Palacio
Leonardo Palacio

Reputation: 11

  cl_secxml_helper=>upload_file( EXPORTING filename = p_xml
                             IMPORTING bindata  = DATA(lv_xml) ).

  DATA(lo_object) = cl_sec_sxml_dsignature=>create_reader_instance( if_input = lv_xml ).

  lo_object->m_ssf_hash_algorithm  = 'SHA1'.
  lo_object->m_dsig_hash_algorithm = 'SHA1'.
  lo_object->m_dsig_method         = 'RSA'.
  lo_object->m_signature_ns_prefix = ''.

  lo_object->sign_xml( EXPORTING if_ssf_app        = 'OAUTH'
                             if_add_keyinfo    = abap_true
                             if_add_keyinfo_ex = abap_true
                   IMPORTING ef_signature_xml  = DATA(lf_result)
                             es_signer         = DATA(ls_signer) ).

  lo_object->embed_signature( EXPORTING if_xml            = lv_xml
                                    if_signature      = lf_result
                                    if_embed_as_child = abap_true
                                    if_embed_at_end   = abap_true
                                    is_signer         = ls_signer
                          IMPORTING ef_result         = lf_result ).

  cl_soap_xml_helper=>xml_show( xdoc = lf_result ).

  ls_request-in0 = lf_result.

Upvotes: 1

Related Questions