如何使用ABSL程式碼呼叫Web service

i042416發表於2018-03-26

需求:在C4C UI裡建立web service(maintain ticket),然後通過ABSL程式碼消費。
1. 建立一個新的Communication Arrangement

如何使用ABSL程式碼呼叫Web service

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

如何使用ABSL程式碼呼叫Web service

因為我是在當前C4C系統上的ABSL裡呼叫當前C4C系統提供的Web Service,所以Communication System選擇Local:

如何使用ABSL程式碼呼叫Web service

當然這個Local的communication system也是需要在這個地方自己建立一個的:

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

如何使用ABSL程式碼呼叫Web service
如何使用ABSL程式碼呼叫Web service

將該Arrangement的WSDL下載到本地。

如何使用ABSL程式碼呼叫Web service

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

如何使用ABSL程式碼呼叫Web service

將第一步下載的WSDL資料夾載入進去:

如何使用ABSL程式碼呼叫Web service

點選finish,在Studio裡能看到自動生成了兩個檔案。

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

如何使用ABSL程式碼呼叫Web service

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

如何使用ABSL程式碼呼叫Web service

啟用之後,在Communication Scenario的列表裡也能看到JerryTicket2這個communication scenario了。

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

如何使用ABSL程式碼呼叫Web service
如何使用ABSL程式碼呼叫Web service

ABSL程式碼如下:

如何使用ABSL程式碼呼叫Web service
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的原創技術文章,請關注公眾號"汪子熙"或者掃描下面二維碼:

如何使用ABSL程式碼呼叫Web service
如何使用ABSL程式碼呼叫Web service

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2152244/,如需轉載,請註明出處,否則將追究法律責任。

相關文章