09-11-2014 3:11 PM
Hello,
I use the following code to call web service from abap, but in the method "http_client->receive" i see "http_communication_failure = 1" .
this is the code:
DATA: SMS_TEXT TYPE STRING,
SMS_TEXT_UTF TYPE STRING,
SEND_STRING TYPE STRING.
DATA: w_string TYPE string ,
w_result TYPE string ,
r_str TYPE string .
DATA: result_tab TYPE TABLE OF string.
DATA: http_client TYPE REF TO if_http_client.
SEND_STRING = 'http://www.currencyserver.de/webservice/currencyserverwebservice.asmx/getDollarValue?provider=AVERAG...'.
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = SEND_STRING
IMPORTING
client = http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
others = 4.
if sy-subrc = 0.
CALL METHOD http_client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.
CALL METHOD http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3.
if sy-subrc = 0.
w_result = http_client->response->get_cdata( ).
REFRESH result_tab .
SPLIT w_result AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab .
loop at result_tab into w_result.
write :/ w_result.
endloop.
endif.
endif.
Any Idea?
thanks.
Ouail.
09-12-2014 1:58 PM
Hi,
I suggest you create consumer proxy via SE80 and logical port to consume the external web service. The following link might be helpful.
http://wiki.scn.sap.com/wiki/display/ABAPConn/How+to+configure+a+Service+Consumer
Thanks.
Jim
09-11-2014 4:18 PM
Hi
Please check the trace files of icm/icmbnd in transaction SMICM.
Refer to below posts for more information:
http://scn.sap.com/thread/1836067
http://scn.sap.com/thread/1894515
http://scn.sap.com/thread/535031
Thanks
09-11-2014 9:09 PM
*&---------------------------------------------------------------------*
*& Report ZBS_TEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zbs_test.
*Data
DATA: xml_doc TYPE REF TO cl_xml_document,
node TYPE REF TO if_ixml_node,
value TYPE string,
lv_result TYPE string,
lv_service TYPE string,
lo_http_client TYPE REF TO if_http_client.
lv_service = 'http://www.currencyserver.de/webservice/currencyserverwebservice.asmx/getDollarValue?provider=AVERAG...'.
*Call method to invoke web service
cl_http_client=>create_by_url(
EXPORTING
url = lv_service
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 ).
*Create XML parser object using xml returned from web service
CLEAR lv_result.
lv_result = lo_http_client->response->get_cdata( ).
CREATE OBJECT xml_doc.
xml_doc->parse_string( stream = lv_result ).
*Use XML parser to get initial row and then loop through all rows
CALL METHOD xml_doc->get_first_node
RECEIVING
node = node.
*Loop through xml document extracting the data into an internal table
WHILE NOT node IS INITIAL.
CLEAR value.
CALL METHOD node->get_value
RECEIVING
rval = value.
WRITE: / 'Value', value.
CALL METHOD node->get_next
RECEIVING
rval = node.
ENDWHILE.
Try this code it should work to retrieve your values from the webservice.
09-12-2014 8:33 AM
thank u Bradley,
When i use your code, i see " http_communication_failure = 1 " and i receive this output:
Value Application Server Error####body { font-family: arial, sans-serif;}######
Any Idea?
09-12-2014 1:58 PM
Hi,
I suggest you create consumer proxy via SE80 and logical port to consume the external web service. The following link might be helpful.
http://wiki.scn.sap.com/wiki/display/ABAPConn/How+to+configure+a+Service+Consumer
Thanks.
Jim
09-12-2014 2:11 PM
thank u.
i can use tcode "WSCONFIG ", but i don't know the steps.......
the SOAMANAGER transaction code doesn't exist in the System !!!
any help?
09-15-2014 7:34 AM
Hi,
If you are using older release, you can try LPCONFIG as described in the following link:
SAP Library - ABAP Workbench Tools
Thanks.
Jim
09-15-2014 9:19 AM
09-15-2014 9:53 AM
Hi,
As of SAP_BASIS 700 SP14, you can use SOAMANAGER.
If you are on older SP level. You need to use LPCONFIG.
Thanks.
Jim
09-15-2014 10:01 AM