如何在SAP CRM里创建和消费Web service

简介: Created by Wang, Jerry, last modified on Dec 19, 2014 The following steps demonstrates how to expose a function module as a web service in CRM.

Created by Wang, Jerry, last modified on Dec 19, 2014

The following steps demonstrates how to expose a function module as a web service in CRM.

  1. create a FM to return product description by given product ID.

Just use the following source code:

SELECT SINGLE A~short_text INTO rv_text FROM COMM_PRSHTEXT  AS A
INNER JOIN comm_product AS B ON B~product_id = iv_prod_id AND B~product_guid = A~product_guid.

Make sure the FM is marked as "Remote enabled".

  1. start the web service creation wizard:

Just follow the wizard to finish creation. Choose the appropriate authentication approach according to your use case.

  1. Once creation is finished, you would find your service definition as below:

click tab WSDL, write down your WSDL link:

  1. tcode SOAMANAGER, click Web Service Configuration

you can find your service definition created just now:

click the hyperlink and create a new service:

Make sure you use SSL.

Otherwise, you will meet with the following error code in the runtime. This is simply because web service via HTTP protocal is set as forbidden in Suite landscape and all such communication will be redirected, as set up in SMICM.

click Finish button.

Now your web service is ready for consumer. click this icon:

write down this link for later usage:

How to consume web service in CRM

  1. tcode SE80, create a new service consumer:
  1. Choose external WSDL:

choose the url got from "how to create web service in CRM", step3

activate your consumer proxy and write down the ABAP class name.

  1. go back to SOAMANAGER, find the consumer proxy created in step2:

create a new logical point:

  1. Make sure you specify URL got from web service creation last step. If you just use the URL got from SE80 in tab "WSDL", you will meet with below error.

choose HTTPS:

  1. consume the web service in ABAP report:
data: lr_proxy TYPE REF TO CO_ZPRODUCTDESCRIPTION4,
input TYPE ZGET_PROD_DESCRIPTION,
output TYPE ZGET_PROD_DESCRIPTION_RESPONSE.
input-iv_prod_id = 'ARNO_TEST004'.
CREATE OBJECT lr_proxy
EXPORTING
LOGICAL_PORT_NAME = 'ZLP_JERRY1'.
CALL METHOD lr_proxy->ZGET_PROD_DESCRIPTION
EXPORTING
input      = input
IMPORTING
output     = output.

Now we get the web service execution result:

How to consume public web service in CRM

The steps to consume the public web service is almost exactly the same as consuming SAP internal web service.

Use the public web service http://www.webservicex.com/FinanceService.asmx?WSDL as example.
First it is necessary to verify whether this web service is working correctly for the time being - test it in soapUI:

Just test the consumer proxy class in class builder:

Specify request input just the same as in SoapUI:

Execution result is the same as what we get in SoapUI:

本文来自云栖社区合作伙伴“汪子熙”,了解相关信息可以关注微信公众号"汪子熙"。

相关文章
|
JavaScript
使用nodejs消费SAP Cloud for Customer上的Web service
Jerry在公众号文章C4C和微信集成系列教程里曾经使用nodejs去消费C4C提供的标准webservice。
使用nodejs消费SAP Cloud for Customer上的Web service
如何在 SAP BTP 上创建以及消费 Business Rule Service
如何在 SAP BTP 上创建以及消费 Business Rule Service
127 0
如何在 SAP BTP 上创建以及消费 Business Rule Service
|
监控 Java 区块链
如何在 SAP BTP 平台 ABAP 编程环境里消费基于 SOAP 的 Web Service
如何在 SAP BTP 平台 ABAP 编程环境里消费基于 SOAP 的 Web Service
250 0
如何在 SAP BTP 平台 ABAP 编程环境里消费基于 SOAP 的 Web Service
Hybris commerce里用web service为什么查询不到产品的描述信息
Hybris commerce里用web service为什么查询不到产品的描述信息
87 0
Hybris commerce里用web service为什么查询不到产品的描述信息
如何在SAP CRM里创建和消费Web service
如何在SAP CRM里创建和消费Web service
85 0
如何在SAP CRM里创建和消费Web service
|
SQL 监控 安全
最详细的 SAP ABAP Web Service 创建和消费步骤讲解
最详细的 SAP ABAP Web Service 创建和消费步骤讲解
253 0
最详细的 SAP ABAP Web Service 创建和消费步骤讲解
|
安全 Go 网络安全
如何在SAP ABAP系统里创建和消费Web Service
如何在SAP ABAP系统里创建和消费Web Service
134 0
如何在SAP ABAP系统里创建和消费Web Service
|
API 网络架构
SAP Commerce web service 的扩展
SAP Commerce web service 的扩展
SAP Commerce web service 的扩展
|
XML 网络安全 Go
最详细的使用 soapui 消费 SAP Cloud for Customer Web service 的教程
最详细的使用 soapui 消费 SAP Cloud for Customer Web service 的教程
241 0
最详细的使用 soapui 消费 SAP Cloud for Customer Web service 的教程
|
IDE 开发工具
将S/4HANA的自定义BO功能以Web Service的方式暴露给第三方
将S/4HANA的自定义BO功能以Web Service的方式暴露给第三方
115 0
将S/4HANA的自定义BO功能以Web Service的方式暴露给第三方