06-13-2017 3:54 PM
Hi community.
I am creating a program to receiva data from rest link.
I have been following sdn Tutorials but i get error:
Connect to (name my host).com.br:80 failed: NIEHOST_UNKNOWN(-2).
I found some people in sdn with same error and i follow yours instructions but the problem continues.
This is my code and the error ocorred after lo_http_client->receive..
DATA: lv_http_url TYPE string,
lv_result TYPE string,
lo_ixml TYPE REF TO if_ixml,
lo_istream TYPE REF TO if_ixml_istream,
lo_streamfactory TYPE REF TO if_ixml_stream_factory,
lo_document TYPE REF TO if_ixml_document,
lo_parser TYPE REF TO if_ixml_parser,
lo_http_client TYPE REF TO if_http_client.
wa_dest-lat_f = 48451245 * ( -1 ).
wa_dest-lng_f = 22882449 * ( -1 ).
wa_dest-lat_t = 46225189 * ( -1 ).
wa_dest-lng_t = 23538130 * ( -1 ).
CONDENSE:wa_dest-lat_f,
wa_dest-lng_f,
wa_dest-lat_t,
wa_dest-lng_t .
* Prepare the url for the DistanceMatrix API From Address Coordinates and To Address Coordinates
CONCATENATE
'http://kkkkkxxxx.com.br/Roteirizador/RouteService.svc/rest/Solve?origem='
wa_dest-lat_f ';' wa_dest-lng_f ','
'&destino=' wa_dest-lat_t ';' wa_dest-lng_t
INTO lv_http_url .
* Get client from url
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = lv_http_url
IMPORTING
client = lo_http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4.
lo_http_client->send(
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2 ).
lo_http_client->receive(
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3 ).
CLEAR lv_result .
lv_result = lo_http_client->response->get_cdata( ).
lo_ixml = cl_ixml=>create( ).
lo_streamfactory = lo_ixml->create_stream_factory( ).
lo_istream = lo_streamfactory->create_istream_string(
lv_result ).
lo_document = lo_ixml->create_document( ).
lo_parser = lo_ixml->create_parser(
stream_factory = lo_streamfactory
istream = lo_istream
document = lo_document ).
I created sm59 conection with type G conection and the same error ocurred.
In chrome jason view it works.
What is wrong?
Thanks.
06-20-2017 4:43 PM
Hi,
SAP basis needs to install the SSL certificate in the system
06-14-2017 11:26 AM
06-14-2017 6:04 PM
06-14-2017 7:14 PM
Hello Ronaldo,
The error NIEHOST_UNKNOWN means that the hostname your are accessing ("name my host.com.br") is not known to the server where SAP is running.
This is a DNS issue.
You can involve your server / DNS / network team(s), so they fix this.
Regards,
Isaías
06-19-2017 1:48 PM
Thanks for reply Isaias
I talked with basis team and they solved it , now after pass by lo_http_client->receive
the sy-subrc = 0.
and i used this code to get data:
lv_bin TYPE xstring,
lv_bin = lo_http_client->response->get_data( ).
But using this code to transform data:
DATA: lt_data2 TYPE TABLE OF x255,
l_len TYPE i,
ls_string TYPE string.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_bin
IMPORTING
output_length = l_len
TABLES
binary_tab = lt_data2.
CALL FUNCTION 'SCMS_BINARY_TO_STRING'
EXPORTING
input_length = l_len
IMPORTING
text_buffer = ls_string
TABLES
binary_tab = lt_data2.
Is returned it:3C68746D6C3E3C686561643E3C7469746C653E4170706C69636174696F6E20536572766572204572726F723C2F7469746C653E0D0A3C7374796C6520747970653D22746578742F637373223E0D0A626F6479207B20666F6E742D66616D696C793A20617269616C2C2073616E732D73657269663B7D0D0A3C2F7374796C653E0
67696E6865696768743D223022206D617267696E77696474683D2230223E0D0A3C7461626C65206865696768743D223631222077
How can i get it and transform in my jason data to input n a internal table?
06-20-2017 2:14 PM
I converted this receive data and the data converted is :
SSL handshake with marcozerogis.com.br:443 failed: SSSLERR_PEER_CERT_UNTRUSTED (-102)#The peer's X.509 Certificate (chain) is untrusted##SapSSLSessionStartNB()==SSSLERR_PEER_CERT_UNTRUSTED# SSL:SSL_read() failed (536872221/0x2000051d)# => "Failed to ve
somebody knows what hepened?
06-20-2017 6:00 PM
Hello Ronaldo,
This would be a different issue.
It is best to post new questions when you have new issues, so both issues do not get mixed up in the thread.
Anyway, check out this WIKI page.
Regards,
Isaías
06-23-2017 2:23 PM
06-23-2017 4:36 PM
05-16-2019 12:48 PM
11-17-2022 6:09 AM
SSL certificate needs to be installed in STRUST TCODE.
06-20-2017 4:43 PM
Hi,
SAP basis needs to install the SSL certificate in the system
06-23-2017 2:23 PM
10-02-2020 5:42 PM
Estimado,
revisar su conexión de salida a internet con su servidor, por este motivo no resolverá la dirección a la cual quiere llegar.
Saludos