如何使用ABSL代碼調用Web service

需求:在C4C UI裏建立web service(maintain ticket),而後經過ABSL代碼消費。 1. 建立一個新的Communication Arrangement web

基於Manage Tickets這個標準的Communication Scenario建立一個Communication Arrangement:this

由於我是在當前C4C系統上的ABSL裏調用當前C4C系統提供的Web Service,因此Communication System選擇Local:3d

固然這個Local的communication system也是須要在這個地方本身建立一個的:code

Authentication method能夠維護成"User ID and Password", 給該建立的arrangement維護communication user的password:blog

將該Arrangement的WSDL下載到本地。ip

2. 在Cloud Studio裏建立一個新的External Web Service Integration:it

將第一步下載的WSDL文件夾加載進去:io

點擊finish,在Studio裏能看到自動生成了兩個文件。class

雙擊.csd(communication scenario definition), 將Communication Type改成A2X改成:import

切換到Services tab, 選擇Custom Outbound Services->JerryTicket2->MaintainBundle

激活以後,在Communication Scenario的列表裏也能看到JerryTicket2這個communication scenario了。

3. 基於前一步建立的communication scenario JerryTicket2建立一個Communication arrangement。至此C4C配置完成。

ABSL代碼以下:

import ABSL;

import AP.CRM.Global;

import AP.Common.GDT;

var ticketReq: JerryTicket2.MaintainBundle.Request;

var SerReq : JerryTicket2.MaintainBundle.Request.ServiceRequestBundleMaintainRequest2_sync.ServiceRequest ;

var SrvReqItem : JerryTicket2.MaintainBundle.Request.ServiceRequestBundleMaintainRequest2_sync.ServiceRequest.Item;

SerReq.actionCode = "06";

SerReq.ID = this.ID;

var counter = 0;

while(counter < 500)

{

SrvReqItem.actionCode = "01"; //Create Item

SrvReqItem.Description.content = "Add item from WS" ;

SrvReqItem.ProductID.content = "P120100";

SrvReqItem.RequestedQuantity.content = 1.0;

SrvReqItem.RequestedQuantity.unitCode = "EA";

SrvReqItem.UserServiceTransactionProcessingTypeCode = "SRP0";

SerReq.Item.Add(SrvReqItem);

counter = counter + 1;

}

ticketReq.ServiceRequestBundleMaintainRequest2_sync.ServiceRequest.Add(SerReq);

var response = Library::JerryTicket2.MaintainBundle(ticketReq,"","JerryTicket2");

要獲取更多Jerry的原創技術文章,請關注公衆號"汪子熙"或者掃描下面二維碼:

相關文章
相關標籤/搜索