How to create and consume web service in CRM
The following steps demonstrates how to expose a function module as a web service in CRM.
- 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”.
- start the web service creation wizard:
Just follow the wizard to finish creation. Choose the appropriate authentication approach according to your use case.
- Once creation is finished, you would find your service definition as below:
http://jerry:50056/sap/bc/srt/wsdl/flv_10002P111AD1/sdef_url/ZPRODUCTDESCRIPTION3?sap-client=001
click tab WSDL, write down your WSDL link:
- 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
-
tcode SE80, create a new service consumer:
-
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.
- go back to SOAMANAGER, find the consumer proxy created in step2:
create a new logical point:
- 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:
- 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的原创文章,请关注公众号"汪子熙":
相关文章
- Go Web --- 接收get和post数据
- [Web Pdf] flying-saucer + iText + Freemarker生成pdf 跨页问题
- [Web 前端] SuperAgent中文使用文档
- 解决Cannot change version of project facet Dynamic web module to 2.5
- spring boot:创建一个简单的web(maven web project)
- 解决maven项目Cannot change version of project facet Dynamic web module to 3.0/3.1
- ERROR in index.web.js from UglifyJs
- 1 分钟在 Serverless 上部署现代化 Deno Web 应用
- 轻松搭建基于 Serverless 的 Egg.js Web 应用
- [Web Worker] Introduce to Web Worker
- [Whole Web, Nods.js, PM2] Passing environment variables to node.js using pm2
- [Mobile Web] target / context = result --> px to ems
- 超小Web手势库AlloyFinger原理
- [HTML5] Build Flexible HTML with HTMLTemplates using Slots and Web Components
- [CSS] Useful CSS tool for Web designer and developer
- [Debug] Use Remote Sources to Debug a Web App on an Emulator, Simulator, or Physical Device
- [Web Worker] Introduce to Web Worker
- [PWA] Add web app to your Home Screen
- [Javascript] Intro to the Web Audio API
- [Whole Web, Nods.js, PM2] Passing environment variables to node.js using pm2
- [Whole Web] [AngularJS + Grunt] Using ng-html2js to Convert Templates into JavaScript
- 性能测试:监控web服务器--Tomcat
- SAP UI5 web Component的React组件,如何实现事件响应
- atitit.浏览器web gui操作类库 和 操作chrome浏览器的类库使用总结
- How to check accessibility errors via Web IDE
- use web IDE to commit change to git
- 成功解决OSError: [E050] Can‘t find model ‘en_core_web_sm‘. It doesn‘t seem to be a Python package or a v
- Error:JDK1.8 Cannot change version of project facet Dynamic Web Module to 3.1.
- 【异常】运行SpringBoot程序提示异常,Web server failed to start. Port XXX was already in use.
- 基于JAVA实现的WEB端UI自动化 - WebDriver高级篇 - cookie操作
- HTMLUnit web测试
- web组件库