Hi Experts,
I am trying to consume WSDL using class CL_HTTP_CLIENT, may be I am missing some thing in below code, could any one please correct what I am missing? , I am not pretty sure how to use methods but written below code for reference written using other codes in SDN
Actually I need to pass multiple parameters to SubmitEx2 method at a time,
is there any best example with WSDL and code for regarding methods to use while calling URL and parameters to pass...,
like any WSDL in http://www.webservicex.net like Currency Convertor
my code for your information :
DATA: http_client TYPE REF TO if_http_client,
host_str TYPE string VALUE 'X.y.z.a,
service_str TYPE string,
path TYPE string VALUE 'itpserver/itpserver.asmx',
errortext TYPE string. "used for error handlingDATA : wf_string1 TYPE string,
lw_input TYPE zcrm_aia_wsdl_cpsubmit_ex2soa1,
lw_output TYPE zcrm_aia_wsdl_cpsubmit_ex2soap,
lw_inputs TYPE string,
lw_outputs TYPE string.
* EXPORTING * host = host_str * service = service_str ** proxy_host = proxy_host ** proxy_service = proxy_service ** scheme = '1'"scheme * IMPORTING * client = http_client * EXCEPTIONS * argument_not_found = 1* internal_error = 2* plugin_not_active = 3* OTHERS = 4. CALL METHOD cl_http_client=>create_by_url * proxy_host = * proxy_service =
*CALL METHOD cl_http_client=>create
EXPORTING
url = 'http://x.y.z.a/itpserver/itpserver.asmx'
* ssl_id =* sap_username =* sap_client =
IMPORTING
client = http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4.IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = '~request_method'
value = 'POST'.CALL METHOD http_client->request->set_header_field
EXPORTING
name = '~server_protocol'
value = 'HTTP/1.1'.CALL METHOD http_client->request->set_header_field
EXPORTING
name = '~request_uri'
value = '/itpserver/itpserver.asmx'.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = 'Content-Type'
value = 'application/soap+xml; charset=utf-8'."'text/xml; charset=utf-8'.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = 'Content-Length'
value = '19000'."txlen.CALL METHOD http_client->request->set_header_field
EXPORTING
name = 'SOAPAction'
value = 'http://www.aia-itp.com/itpserver/wsdl/SubmitEx2'.
C ALL METHOD http_client->receive
CONCATENATE'<?xml version="1.0" encoding="utf-8"?>''<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"''xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'
' <soap:Body>'
'<service xmlns="http://www.aia-itp.com/itpserver/wsdl">generatedocument</service>'
'<parms xmlns="http://www.aia-itp.com/itpserver/wsdl">'
'<string>Quote</string>'
'<string></string>'
'</parms>'
'<inKeyValues xmlns="http://www.aia-itp.com/itpserver/wsdl">'
'<KeyValue>'
'<key></key>'
'<value></value>'
'</KeyValue>'
'<KeyValue>'
'<key></key>'
'<value></value>'
'</KeyValue>'
'</inKeyValues>'
'<inDocuments xmlns="http://www.aia-itp.com/itpserver/wsdl">'
'<Doc>'
'<id>xmldoc</id>'
'<content></content>'
'</Doc>'
'<Doc>'
'<id>xmldoc</id>'
'<content></content>'
'</Doc>'
'</inDocuments>'
'<sessionID xmlns="http://www.aia-itp.com/itpserver/wsdl"></sessionID>'
'<jobID xmlns="http://www.aia-itp.com/itpserver/wsdl"></jobID>''</soap:Body>''</soap:Envelope>'
INTO wf_string1.
CALL METHOD http_client->request->set_cdata
EXPORTING
data = wf_string1* offset = 0
length = '19000'.
CALL METHOD http_client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3.CLEAR wf_string1 .
wf_string1 = http_client->response->get_cdata( ).
Thanks,
VijInd