Cabeçalho SOAP HEADER.
DATA: lr_header_protocol TYPE REF TO 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_xstring TYPE xstring.
DATA l_string TYPE string.
DATA: name TYPE string,
namespace TYPE string.
CONCATENATE
'<soapenv:Header>'
'<n2:gnreCabecMsg xmlns:n2="http://www.gnre.pe.gov.br/webservice/GnreLoteRecepcao">'
'<n2:versaoDados>1.00</n2:versaoDados>'
'</n2:gnreCabecMsg>'
'</soapenv:Header>'
INTO l_string.
lr_header_protocol ?= go_proxy->get_protocol( if_wsprotocol=>ws_header ).
* convert to xstring
l_xstring = cl_proxy_service=>cstring2xstring( l_string ).
IF l_string IS NOT 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 xml_document IS NOT INITIAL.
xml_root = xml_document->get_root_element( ).
xml_element ?= xml_root->get_first_child( ).
* add header element by element to soap header
WHILE xml_element IS NOT INITIAL.
name = xml_element->get_name( ).
namespace = xml_element->get_namespace_uri( ).
lr_header_protocol->set_request_header( name = name namespace = namespace dom = xml_element ).
xml_element ?= xml_element->get_next( ).
ENDWHILE.
ENDIF.
ENDIF.
====================================================
Na configuração do certificado digital STRUST adicionar na identidade o certificado do SEFAZ do PE também.
======================================================
Na configuração do SOAMANAGER deixar como texto HTML.
Nenhum comentário:
Postar um comentário