天天看點

如何在SAP C4C裡使用ABSL消費第三方Restful API

首先我們得有一個可以正常工作的Restful API:

如何在SAP C4C裡使用ABSL消費第三方Restful API
然後在Cloud for Customer的Cloud Application Studio裡建立Restful API的模型,把第一步可以正常工作的Restful API url填進模型裡去:
如何在SAP C4C裡使用ABSL消費第三方Restful API
如何在SAP C4C裡使用ABSL消費第三方Restful API
如何在SAP C4C裡使用ABSL消費第三方Restful API
然後在ABSL裡使用如下代碼進行消費:
如何在SAP C4C裡使用ABSL消費第三方Restful API

import ABSL;

if( this.OutboundDeliveryID.IsInitial() == false){
    raise already_delivered.Create("E");
    return;
}

var HttpMethod = "GET";
var HttpResource = "";                            // not required
var ContentType = "";                             // not required
var Body = "";                                    // not required
var HeaderParameter : collectionof NameAndValue;  // not required

var URLParameter    : collectionof NameAndValue;

var URLParameterEntry : NameAndValue;

URLParameterEntry.Name  = "SoID";
URLParameterEntry.Value = this.ID.content;

URLParameter.Add(URLParameterEntry);

var response = WebServiceUtilities.ExecuteRESTService("JerryExternalService", "JerryExternal", HttpMethod, HttpResource,
URLParameter, HeaderParameter,ContentType, Body);

this.OutboundDeliveryID = response.Content;
raise delivery_message.Create("S", this.OutboundDeliveryID);           

繼續閱讀