Header Ads

Consuming an External Web Service in SAP CRM, Part One


Over the last several versions, SAP has been pushing more and more of its functionality to a service-oriented architecture (SOA). A “Web Service” is defined by the W3C as “a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically Web Services Description Language, known by the acronym WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.”


In this series of articles, we examine using both inbound and outbound web services in SAP CRM. In Part One, we create a consumer proxy to consume an external web service to display weather data.
In CRM, a consumer proxy is needed to call an external web service. The proxy provides an ABAP “wrapper” to execute the remote call. The proxy can be created using the Object Navigator (transaction se80).
As an organizational principle, I like creating a main package for services development with sub-packages for each individual service. In this case, I create a sub-package called ZZSRVWEATHER under a main package called ZZSERVICE.
Right-click on your package to pull up the context menu and chooseCreate→Enterprise Service.In the wizard, select Service Consumer.The proxy is generated by the wizard from a WSDL. The WSDL can be provided either as a document (formatted as XML) or via a URL.
Input the source of your WSDL and complete the wizard.  Dictionary objects will be created from the signature of the web service as defined in the WSDL. Remember to activate the generated proxy object!The proxy that we generated is the ABAP layer of the service call. In order to use the proxy we also need to create an endpoint. An endpoint is simply the destination of the service call. The endpoint (SAP also refers to this as a logical port) is created using the same service definition (WSDL) that you used to create the proxy. This must be done in each client from which the proxy will be used.
Using the SOA Manager (transaction soamanager), choose theApplication and Scenario Communication tab. Select Single Service Administration. Search for your created proxy object.The Configurations tab of the proxy object allows you to add a new logical port (or endpoint).Select Create Logical Port. By choosing “WSDL Based Configuration” as the Configuration Type, the endpoint will be created automatically from the WSDL.In some cases the automatic creation of the endpoint will fail; this is typically because the specified WSDL is using a version of the SOAP standard that SAP does not support. When this happens, you will need to create the endpoint using “Manual Configuration” as the Configuration Type. In addition, if the web service requires authentication, you must create the endpoint manually in order to supply the authentication details.
If the web service does not require authentication, set the Message ID to the value “Suppress ID Transfer.”If the web service does require authentication, the authentication details are entered on the Consumer Security tab.Using the information from the WSDL, configure the web service server details on the Transport Settings tab.On the Operation Specific tab, the SOAP Action value must be entered. This information can also be found in the WSDL. You can search the WSDL for the “soapAction” tag(s). This value must be set for each operation defined in the web service.Once the endpoint is defined, you can use the Object Navigator (transaction se80) to test the consumer proxy.Now that we have a functioning consumer proxy for our web service, in Part Two of the article series, we will use the proxy object in the CRM Web UI.
Powered by Blogger.