In this blog I will create a web service which is exposed via Genil model PROD in CRM web client UI and consume it via a simple ABAP program.
Create web service in CRM Webclient UI
(1) log on CRM Web UI with business role SERVICEPRO, work center Service Operation, Create a new Web service:
Choose Material as Business Object, choose Product/Individual Product as Component, Product as Root object.
Mark check box Read, Create and Change.
If you select SECURE as security profile in web service creation step, the Authentication Level will be Strong instead of Basic, and the checkbox “User ID/Password” will be disabled, which means in that case, only X.509 SSL Client Certificate or Single Sign On are allowed.
In this blog, since both the creation of web service and service consumption are done in AG3, I mark “Make Local Call” as Local System Call.
In part 2 of this blog, we will discuss how to use this proxy class to consume web service in ABAP program.
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.
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.
ls_read_input-input-prod_ws-product_id = 'ARNO_TEST004'.
lo->crmost__prod_ws_read(
input = ls_read_input
output = ls_read_result ).
CATCH cx_root INTO lv_text.
ls = lv_text->get_text( ).
WRITE:/ ls.