如何在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.

  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:
  2. 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:

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

原创声明,本文系作者授权云+社区发表,未经许可,不得转载。

如有侵权,请联系 yunjia_community@tencent.com 删除。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏debugeeker的专栏

sedna进行xquery查询

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xuzhina/article/detai...

861
来自专栏机器学习从入门到成神

Spring与MyBatis的整合

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sinat_35512245/articl...

2.1K2
来自专栏高性能服务器开发

(三) 服务器端的程序架构介绍2

下面我们以pc端登录为例来具体看一个数据包在服务器端各个服务之间走过的流程: 步骤1:login_server初始化侦听socket,设置新连接到来的回调函数。...

4215
来自专栏游戏杂谈

cocos2d-x 2.x版本接入bugly的总结

最开始项目使用的是自己DIY的很简陋的上报系统,后来改成google breakpad来上报,发现其实都做的不太理想,游戏引擎因为版本历史问题存在一些崩溃问题。...

1810
来自专栏Petrichor的专栏

tree指令

1912
来自专栏智能计算时代

Microservices Ecosystem Transit Map

…we assembled a map of the ecosystem to help guide practitioners, vendors, inves...

3994
来自专栏Golang语言社区

Go中的依赖注入

I have written a small utility package to handle dependency injection in Go (it'...

2634
来自专栏Golang语言社区

在Go中使用服务对象模式

NOTE: Most of the code and ideas in this post are things I have been experimenti...

1102
来自专栏WindCoder

Best Programming Editors? A Never Ending Battle With No Clear Winner

原文:Best Programming Editors? A Never Ending Battle With No Clear Winner

761
来自专栏xingoo, 一个梦想做发明家的程序员

MFC 随机矩形

问题描述:   简单地使用随即的尺寸和颜色不停的绘制一系列的图像。 一种古老的方式:   设置一个向窗口函数发送WM_TIMER消息的windows计时器。  ...

2145

扫码关注云+社区

领取腾讯云代金券