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

Reg:Webservice

Former Member
0 Likes
631

Dear Experts,

I have a requirement that i need to consume a web service to read serial nos for a given

Sale order no and store them in a custom table.

Please find my code snippet.

DATAhttp_client           TYPE REF TO if_http_client ,
           http_url                TYPE        string,
           p_content             TYPE        string,
           p_content1           TYPE        xstring,
           CODE_REASON    TYPE        STRING ,
           HTTP_CODE         TYPE        I.


http_client->send( ).

* Reterive the result
CALL METHOD http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state         = 2
http_processing_failed     = 3
OTHERS                     = 4.
if sy-subrc <> 0.
   call method http_client->get_last_error
     importing
      code    = gv_subrc
      message = gv_errortext.

endif.

CALL METHOD HTTP_CLIENT->RESPONSE->GET_STATUS
     IMPORTING
       CODE = HTTP_CODE
       REASON = CODE_REASON .

p_content = http_client->response->get_cdata( ).

My problem is Web service is getting triggered properly but while reading

data into Destination field using method get_cdata(), I was not able read the

entire data into my destination field(P_CONTENT),As i have more than 10000 records in xml format.

P_CONTENT field is only filled with 255 chars during runtime.

Please help me on this,As it was urgent issue.

Regards

Mahesh.P

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
508

Resolved by myself

Dear Experts,

I have a requirement that i need to consume a web service to read serial nos for a given

Sale order no and store them in a custom table.

Please find my code snippet.

DATAhttp_client           TYPE REF TO if_http_client ,
           http_url                TYPE        string,
           p_content             TYPE        string,
           p_content1           TYPE        xstring,
           CODE_REASON    TYPE        STRING ,
           HTTP_CODE         TYPE        I.


http_client->send( ).

* Reterive the result
CALL METHOD http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state         = 2
http_processing_failed     = 3
OTHERS                     = 4.
if sy-subrc <> 0.
   call method http_client->get_last_error
     importing
      code    = gv_subrc
      message = gv_errortext.

endif.

CALL METHOD HTTP_CLIENT->RESPONSE->GET_STATUS
     IMPORTING
       CODE = HTTP_CODE
       REASON = CODE_REASON .

p_content = http_client->response->get_cdata( ).

My problem is Web service is getting triggered properly but while reading

data into Destination field using method get_cdata(), I was not able read the

entire data into my destination field(P_CONTENT),As i have more than 10000 records in xml format.

P_CONTENT field is only filled with 255 chars during runtime.

Please help me on this,As it was urgent issue.

Regards

Mahesh.P

1 REPLY 1
Read only

Former Member
0 Likes
509

Resolved by myself