Skip to Content

In previous blog we have finished the creation for web service PROD_WS, and ABAP consumer proxy class ZZCO_PROD_WS. Before it can be used in ABAP program to consume the web service we created, a logical port is needed.

Create a new Logical Port in SOAMANAGER

1. Go back to SOAMANAGER and search PROD_WS again, this time the ABAP consumer proxy ZZCO_PROD_WS is also visible in search result list.

/wp-content/uploads/2014/02/clipboard1_377763.png

2. Click consumer proxy class and click button Create->WSDL Based Configuration:

/wp-content/uploads/2014/02/clipboard2_377768.png

3. Specify Logical Port name:

/wp-content/uploads/2014/02/clipboard3_377769.png

Specify the WSDL link of new binding for service definition created in previous step. Specify a valid user and password for WSDL access.

/wp-content/uploads/2014/02/clipboard4_377770.png

/wp-content/uploads/2014/02/clipboard5_377771.png

/wp-content/uploads/2014/02/clipboard6_377772.png

Click finish button to finish logical port creation. Click Ping button and ensure it works successfully.

/wp-content/uploads/2014/02/clipboard7_377773.png

Consume the web service in ABAP program

Use the following source code to consume the query and read service operation. Pass the logical port name LP__TEST1 in constructor of consumer class. The data type and method signature could be easily found in class builder for consumer proxy class ZZCO_PROD_WS.

DATA: lo     TYPE REF TO zzco_prod_ws,           input  TYPE zzcrmost__pro001prodadvsea01,
output TYPE zzcrmost__pro001prodadvsea00.

CREATE OBJECT lo
 EXPORTING
    logical_port_name = 'LP_TEST1'.

input-input-searchforproducts-created_by-sign = 'I'.
input-input-searchforproducts-created_by-option = 'EQ'.
input-input-searchforproducts-created_by-low = 'WANGJER'.

TRY.
  lo->crmost__pro001prodadvsea001d(
     EXPORTING
        input                   = input
     IMPORTING
        output                  =  output ).
CATCH cx_root INTO DATA(lv_text).
   DATA(ls) = lv_text->get_text( ).
   WRITE:/ ls.
ENDTRY.

DATA: ls_read_input  TYPE zzcrmost__prod_ws_read,
ls_read_result TYPE zzcrmost__prod_ws_read_respo.

TRY.
   ls_read_input-input-prod_ws-product_id = 'ARNO_TEST004'.
   lo->crmost__prod_ws_read(
     EXPORTING
        input  = ls_read_input
     IMPORTING
        output = ls_read_result ).
CATCH cx_root INTO lv_text.
  ls = lv_text->get_text( ).
  WRITE:/ ls.
ENDTRY.

 

program execution result: 100 results found with CREATED_BY = WANGJER:

/wp-content/uploads/2014/02/clipboard8_377774.png

The result is exactly the same as when we manually run the advanced search in GENIL_BOL_BROWSER:

/wp-content/uploads/2014/02/clipboard9_377775.png

And the result for read operation consumption:

/wp-content/uploads/2014/02/clipboard10_377776.png

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply