Previously I have written two documents about how to create document template with Word or Adobe PDF format which support web service created by Web service tool available in CRM Web client UI:
(1) Create Webservice enabled word document in attachment assignment block (2) Create Webservice enabled Adobe PDF attachment in CRM Application
Besides that you could still use external web service from third party or created from a remote function module via tcode SOAMANAGER in ABAP system.
However when you paste the URL of your WSDL as below and press enter key, you meet with the error message “Unauthorized”.
Before we start to trouble shooting, we’d better quickly go through this document how to create and consume web service in ABAP system to have a basic idea about web service creation and consumption in ABAP system.
Why we will see this Unauthorized error message
The position of this error message could easily be found via the tip described in my blog How to quickly locate the source code where raises a given message in webclient UI:
The WSDL URL we input is used to initialize one instance of cl_http_client and then cl_http_client~send and cl_http_client~receive are called to get the content of this WSDL.
Then we get expected 401 Unauthorized error, since we didn’t specify any credentials in this generic code.
go to tcode SICF and find the ICF node /default_host/sap/bc/ ( which is the parent node of the ICF service generated for our web service), the logon procedure for it is set as “Standard”.
According to SAP help, Standard logon procedure means the framework will do authentication check based on the following orders until one avalid credential found. In our case, none of the seven attempts succeed, so finally we see 401 Unauthorized error.
How to resolve the error
According to SAP help, after I add the following code to enable HTTP Basic Authentication, the error is gone.
Of course this could not be used in productive code, we need to find a more generic solution. Go outer callstack of 401 error, I find there is another way to initialize http client instance by RFC destination instead ( line 49 ). Doing a where used list on class attribute mv_destination and soon I found there is a BAdI definition which could allow us to specify a HTTP destination for the external web service being used:
So the solution would be:
(1) Create a HTTP destination in tcode SM59 Maintain “Target Host”, “Service No.”( that is port number ) and paste the left part of WSDL URL to “Path Prefix”.
Maintain user and password:
(2) Create a BAdI implementation on BAdI definition CRM_OI_WEBSERVICE_BADI
Implement the method GET_SERVICE_DESTINATION. fill the changing parameter cv_destination. You could do filtering based on the importing WSDL URL and Operation, in this example I just hard code the name of RFC destination created in step one.
Now this destination will be used to create http client instance and the 401 error message is then resolved.
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
相关推荐
【SAP ABAP调用Java生成的Web Service手册】 在SAP系统中,与外部服务进行交互时,经常需要调用由Java等其他语言编写的Web Service。本手册详细介绍了如何在MyEclipse环境中生成Web Service,并在SAP ABAP环境中...
SAP ABAP Web dynpro 跟踪调试工具的讲解。
SAP NetWeaver是SAP企业应用软件的基础平台,Web Dynpro ABAP作为其组成部分之一,依赖于NetWeaver提供的服务和基础设施,包括服务器管理、安全控制、事务处理等功能。在NetWeaver平台上,Web Dynpro ABAP可以无缝...
SAP ABAP webdynpro实例
资源名称:sap abap开发从入门到精通 内容简介: 《SAP ABAP开发从入门到精通》以应用实例的形式,讲解了SAPABAP开发的相关知识点,详细介绍了SAPABAP开发者必须掌握的包与变更传输系统(CTS)、数据类型、数据库...
在SAP ABAP环境中,调用外部Web服务是常见的任务,尤其在系统间集成和数据交换时。本案例将详细讲解如何配置SAP ABAP来调用外部接口Web服务。 首先,我们需要创建一个企业服务(Enterprise Service)的消费者代理。...
2. ABAP程序设计:掌握程序结构、流程控制、错误处理和模块化编程。 3. ABAP与数据库:熟练运用ABAP SQL进行数据库操作,了解Open SQL和Native SQL的区别。 4. ABAP面向对象编程:理解类、接口、继承、多态等概念,...
《SAP ABAP开发详解与高端应用》这本书深入探讨了SAP ABAP(Advanced Business Application Programming)编程语言,这是SAP系统中用于开发业务应用程序的关键技术。ABAP是SAP平台上的核心编程语言,用于创建自定义...
11. **WebDynpro和UI5**:现代SAP应用开发中,Web Dynpro和UI5是重要的前端技术。学习如何结合ABAP与这些技术构建现代化用户界面是必要的。 12. **RFC(Remote Function Call)和BAPI(Business Application ...
在实际项目中,ABAP开发者还需要了解SAP的其他组件,如ABAP对象服务(ABAP Objects)、Web Dynpro(用于创建Web应用程序)和ABAP工作流。此外,还有ABAP测试和调试技巧,以及如何使用ABAP Development Tools(ADT)...
SAP ABAP WEBDYNPRO HELLO WORLD
此外,SAP ABAP也与其他技术如Web Dynpro、ABAP Objects、OpenSQL、Web Services等紧密集成,用于构建复杂的业务应用程序。1.4.4版本可能会增强这些技术的互操作性,提供更好的开发框架和模板,简化开发过程。 在...
在本课程“SAP ABAP开发学习——第19课:实战讲解”中,我们将深入探讨SAP ABAP(Advanced Business Application Programming)编程语言在实际项目中的应用。ABAP是SAP系统的核心开发语言,用于构建企业级业务应用...
7. **Web Dynpro ABAP**:这是SAP提供的一种用于构建Web应用程序的技术,教程可能会讲解如何创建Web Dynpro组件和应用,以及与ABAP程序的集成。 8. **ABAP工作流**:这部分可能涉及如何设计和实施工作流逻辑,包括...
《SAP ABAP开发从入门到精通》以应用实例的形式,讲解了SAP ABAP开发的相关知识点,详细介绍了SAP ABAP开发者必须掌握的包与变更传输系统(CTS)、数据类型、数据库、模块化程序、内表、调试、ABAP数据字典、锁对象...
《SAP ABAP实用程序开发攻略》这篇文档主要向初学者介绍了SAP ABAP语言以及其在SAP系统开发中的应用,涵盖从基础知识到数据类型和开发工具的详细解释。 首先,文档开篇提到SAP技术架构及发展历程,这为读者提供了一...
10. **Web服务和ABAP**:了解如何在ABAP环境中集成Web服务,如使用HTTP请求和响应,以及调用Web Service Consumer。 通过这些实例,读者不仅可以熟悉ABAP的基本语法,还能理解在实际SAP项目中如何运用这些技能解决...
此外,可能还介绍了工作流、事件处理以及Web Dynpro ABAP,这是一种用于开发富客户端应用程序的技术。 总的来说,这个SAP ABAP入门教程旨在帮助初学者理解ABAP的基本概念和技术,为他们进入SAP系统开发领域打下坚实...
在SAP系统中,有时需要实现自定义的邮件发送功能以满足特定的业务需求,例如在用户操作SAP采购订单报表时,直接通过Outlook发送邮件到供应商。针对这种需求,我们可以利用SAP的ABAP编程环境,通过OLE(Object ...