Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Call http get method from abap

Former Member
0 Likes
1,583

This is our first web services connection. I'm trying to figure out how to use the soap 1.2 or http get info the vendor provided to work in SAP. I was able to make a small demo program that connects with the method cl_http_client=>create_by_url but it's limited to 255 characters and the http get method exceeds that length. Any pointers or help would be great.

SOAP 1.2

The following is a sample SOAP 1.2 request and response. The placeholders shown need to be replaced with actual values.

POST /cirus/clientapi010.asmx HTTP/1.1 Host: svcdemo.r2ss.net Content-Type: application/soap+xml; charset=utf-8 Content-Length: length  <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <Search xmlns="http://r2ss.com/webservices/"> <companyCode>int</companyCode> <userName>string</userName> <userPassword>string</userPassword> <firstName>string</firstName> <lastName>string</lastName> <streetAddress>string</streetAddress> <stateName>string</stateName> <city>string</city> <zipCode>string</zipCode> <identifierType>string</identifierType> <identifier>string</identifier> <identifierState>string</identifierState> <MasterRecordType>string</MasterRecordType> <ProfessionalType>string</ProfessionalType> <Specialty>string</Specialty> </Search> </soap12:Body> </soap12:Envelope>
HTTP/1.1 200 OK Content-Type: application/soap+xml; charset=utf-8 Content-Length: length  <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <SearchResponse xmlns="http://r2ss.com/webservices/"> <SearchResult>xml</SearchResult> </SearchResponse> </soap12:Body> </soap12:Envelope>

HTTP GET

The following is a sample HTTP GET request and response. The placeholders shown need to be replaced with actual values.

GET /cirus/clientapi010.asmx/Search?companyCode=string&userName=string&userPassword=string&firstName=string&lastName=string&streetAddress=string&stateName=string&city=string&zipCode=string&identifierType=string&identifier=string&identifierState=string&MasterRecordType=string&ProfessionalType=string&Specialty=string HTTP/1.1 Host: svcdemo.r2ss.net 
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length  <?xml version="1.0"?> xml


1 ACCEPTED SOLUTION
Read only

former_member219762
Contributor
0 Likes
572

Hi,

   If you send request by get method the url should not exceed 255.That is http protocol restriction. So use Post method instead  of get method.

call method cl_http_client=>create_by_url

exporting host  = host_str

   service       = service_str

   proxy_host    = proxy_host

   proxy_service = proxy_service

   scheme        = scheme

importing client  = client

exceptions

         argument_not_found = 1

         internal_error     = 2

         plugin_not_active  = 3

call method client->request->set_method(

if_http_request=>co_request_method_post ).


Regards,

Sreenivas

1 REPLY 1
Read only

former_member219762
Contributor
0 Likes
573

Hi,

   If you send request by get method the url should not exceed 255.That is http protocol restriction. So use Post method instead  of get method.

call method cl_http_client=>create_by_url

exporting host  = host_str

   service       = service_str

   proxy_host    = proxy_host

   proxy_service = proxy_service

   scheme        = scheme

importing client  = client

exceptions

         argument_not_found = 1

         internal_error     = 2

         plugin_not_active  = 3

call method client->request->set_method(

if_http_request=>co_request_method_post ).


Regards,

Sreenivas