| REPORTzpw_webservice.*&---------------------------------------------------------------------**&      Selection Screen*&---------------------------------------------------------------------*PARAMETERS: p_cnt TYPEt005t-landx .*&---------------------------------------------------------------------**&      Types and Data*&---------------------------------------------------------------------*DATA:  http_client    TYPEREFTOif_http_client ,       http_url       TYPEstring                ,       p_content      TYPEstring                .*&---------------------------------------------------------------------**&      Start of Selection*&---------------------------------------------------------------------*START-OF-SELECTION.* Build the url string based on input  '/GetCitiesByCountry?CountryName='  p_cnt  INTOhttp_url .* Creation of new IF_HTTP_Client object  CALLMETHODcl_http_client=>create_by_url    EXPORTING      url                = http_url    IMPORTING      client             = http_client    EXCEPTIONS      argument_not_found = 1      plugin_not_active  = 2      internal_error     = 3      OTHERS             = 4.  http_client->request->set_header_field( name  = '~request_method'  value = 'GET').* Send the request  http_client->send( ).* Reterive the result  CALLMETHODhttp_client->receive    EXCEPTIONS      http_communication_failure = 1      http_invalid_state         = 2      http_processing_failed     = 3      OTHERS                     = 4.  p_content = http_client->response->get_cdata( ).  REPLACEALLOCCURRENCESOF'<'INp_content WITH'<'.  REPLACEALLOCCURRENCESOF'>'INp_content WITH'>'.*&---------------------------------------------------------------------**&      Processing string*&---------------------------------------------------------------------*  DATA: moff  TYPEsyst-tabix ,         moff1 TYPEsyst-tabix ,         len   TYPEsyst-tabix .  DO.    FIND'<City>'INSECTIONOFFSETmoff OFp_content IGNORINGCASEMATCHOFFSETmoff .    IFsy-subrc = 0 .      moff = moff + 6 .      FIND'</City>'INSECTIONOFFSETmoff OFp_content IGNORINGCASEMATCHOFFSETmoff1 .      len = moff1 - moff .      WRITE: / p_content+moff(len) .    ELSE.      EXIT.    ENDIF.  ENDDO. | 
 

 
0 Comments