on 02-15-2008 4:50 PM
Hi,
Is there any Sample code or Guide to Access the .Net Webservice From ABAP Program.
My Coding is Throwing Error.The data is Transfered into xml.
CALL TRANSFORMATION ('ZDOWNPAYMENTCREDITCARD') " Convert into Xml
SOURCE root = wa_creditcard
RESULT XML out_xml.
Request aufbereiten
CLEAR: i_request_len, str_request_len.
i_request_len = XSTRLEN( out_xml ).
MOVE: i_request_len TO str_request_len.
CALL METHOD cl_http_client=>create_by_destination
EXPORTING
destination = 'IHOMECOMPUTOP'
IMPORTING
client = http_client
EXCEPTIONS
argument_not_found = 1
destination_not_found = 2
destination_no_authority = 3
plugin_not_active = 4
internal_error = 5
OTHERS = 6.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = '/WebService.asmx/DownpaymentCreditCard'
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 = 'Content-Type'
value = 'text/xml; charset=utf-8'.
CALL METHOD http_client->request->set_header_field
EXPORTING
name = 'SOAPAction'
value = '"http://Testservice/DownpaymentCreditCard.asmx'.
CALL METHOD http_client->request->set_data
EXPORTING
data = out_xml
offset = 0
length = i_request_len.
CALL FUNCTION 'CRM_IC_XML_XSTRING2STRING'
EXPORTING
inxstring = out_xml
IMPORTING
outstring = r_str.
CALL METHOD http_client->send
EXPORTING
timeout = 0
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
http_invalid_timeout = 4
OTHERS = 5.
CALL METHOD http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4.
output_xml = http_client->response->get_data( ).
Check HTTP Status
CALL METHOD http_client->response->get_status
IMPORTING
code = status_code
reason = status_reason.
Error Is
<?xml version="1.0"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http
://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</fau
ltcode><faultstring>System.Web.Services.Protocols.SoapException: Server was unab
le to process request. ---> System.NullReferenceException: Object reference n
ot set to an instance of an object.
Please Comment on this and Advice.
Regards
Bala.M
Hi Bala,
check out this presentation, here they talk about consuming Web Services from ABAP: https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a4433436-0301-0010-f2a9-9281ad57.... Have you tested the .NET Web Service from a .NET application, the error looks like the Web Service throws an error which is not properly catched, in case you have access to the .NET code I would recommend doing some tracing.
- Juergen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.