从SAP ECC正确调用AFIP MTXCA Web服务

时间:2018-08-31 17:19:05

标签: sap abap

我试图直接从SAP ECC调用AFIP WebService MTXCA。 没问题。问题是,当我尝试从第一个WS获取TOKENSIGN

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

我无法签署XML来构建正确的CMS,以从AFIP获得正确的答案。

1 个答案:

答案 0 :(得分:1)

  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.