天天看点

最详细的使用 soapui 消费 SAP Cloud for Customer Web service 的教程

本文就以SAP Cloud for Customer的web service消费这个需求为例,来讲解soapui这个工具的使用步骤。

使用soapui消费web service,最简单的方式是在soapui里直接导入web service的WSDL文件。

为此,我们需要先拿到SAP C4C标准web service的WSDL文件。

Go to workcenter Administrator, then Input and Output management->Service Explorer, you can get a list of all standard inbound services here.

在administator工作中心的input and output management里找到想消费的web service:

最详细的使用 soapui 消费 SAP Cloud for Customer Web service 的教程

点击超链接,把它的WSDL文件下载下来。

If you are working in 1605, you can find a list of all standard web services from SAP help:

最详细的使用 soapui 消费 SAP Cloud for Customer Web service 的教程

The documentation tells me how to fill the request detail in SoapUI.

Download and install SoapUI. Create a new SOAP project by loading the WSDL downloaded from previous step.

下载安装soapui,此处导入第一步下载的WSDL文件。

最详细的使用 soapui 消费 SAP Cloud for Customer Web service 的教程

Of source this example might not make much sense from business perspective as in real world we tend to use other criteria like customer name to query Opportunity.

Paste the following xml source code in request view to query on Opportunity 15360.

把下列的XML字符串复制到soapui面板里:

最详细的使用 soapui 消费 SAP Cloud for Customer Web service 的教程

复制结束之后是这样的:这段字符串是我给soapui发起的web service的请求负载:

最详细的使用 soapui 消费 SAP Cloud for Customer Web service 的教程

Execute this request, I meet with error message: 401 Unauthorized.

执行soapui请求,遇到了401 错误,原来我忘记维护用户名和密码了。

最详细的使用 soapui 消费 SAP Cloud for Customer Web service 的教程
最详细的使用 soapui 消费 SAP Cloud for Customer Web service 的教程

You might also need to maintain proxy setting for SoapUI according to your network landscape.

如果在企业内网的防火墙里使用soapui,还需要在此处设置代理服务器:

最详细的使用 soapui 消费 SAP Cloud for Customer Web service 的教程

Once you have finished all such settings, execute request again and now you can see response as expected:

一切就绪之后,使用soapui能看到web service执行的响应内容了:

最详细的使用 soapui 消费 SAP Cloud for Customer Web service 的教程

继续阅读