Context
CRM systems are a comprehensive hat for many features and services that organizations make available to their agents, employees and partners. All businesses will have their own requirements and needs. Business needs define the objectives, and implementation materializes the execution of processes to be as quickly and efficient as possible.
With these objectives in mind the integration of systems is often key and the use of web services a usual technical solution.
In the example stated on this article the client wants to attach a client-side (local) UI-generated PDF document to the Siebel contact (server).
Solution
In the example in question, we chose as a technical solution by invoking a client-side Web Service that would allows agents to send that same file to the server, as an attachment.
In the developed application the user generates the document and saves it locally. After the integration solution is implemented, whenever the document is generated, it is automatically sent in the background to the server. To this end, the button method now invokes the Web Service that sends the document to the server and attaches it to the contact.
Below is the schema statement of how to invoke web service in OpenUI.
The development was carried out in the Applet Open UI, that allowed the generation of the document: in the Physical Renderer associated with the Applet, the click event associated with the button is called, and within this method is executed the specific Web Service.
In order to be able to execute a Web Service from a Physical Renderer, we need to create some objects/functions. Here are the necessary steps:
- Create an XMLHttpRequest object:
- For the created object open an XMLHttpRequest instance order to pass the following information:
- Indicate the method to use: GET or POST. In this case the POST method was used.
- Indicate the Web Service endpoint.
- Indicate whether the endpoint has credentials.
- Set header content.
- Define the XML that will happen when you make the request to send information.
- Execute the request to the Data Web Service.
- Retrieve the Web Service response.
The code to execute the Web Service must be placed in the ShowUI function of Physical Render.
Below is a small example of code:
//try to call WebService
var objXMLHttpRequest = CreateXMLHttpRequest();
//Getting the SystemPreference with url/username/pwd
var sysPrefUrl = "MM_SIEBEL_ENVIRONMENT";
var sysPrefUrlRes = GetSystemPreference(sysPrefUrl);
let sysPrefUser = "MM_PORTLET_USERNAME";
let sysPrefUserRes = GetSystemPreference(sysPrefUser);
let sysPrefPwd = "MM_PORTLET_PASSWORD";
let sysPrefPwdRes = GetSystemPreference(sysPrefPwd);
var urlEndpoint = sysPrefUrlRes + "eai_anon_enu/start.swe?SWEExtSource=SecureWebService&SWEExtCmd=Execute";
objXMLHttpRequest.open("POST", urlEndpoint, false);
objXMLHttpRequest.withCredentials = false;
objXMLHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
//XML Code from Soap Calling WebService
var soapXML = '<?xml version="1.0" encoding="utf-8" ?>'
+'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://siebel.com/CustomUI" xmlns:mm="http://www.siebel.com/xml/MM%20ANS%20Entity%20Attachment%20Request">'
+'<soapenv:Header>'
+'<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext">'
+'<wsse:UsernameToken xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility">'
+'<wsse:Username>'+sysPrefUserRes+'</wsse:Username>'
+'<wsse:Password Type="wsse:PasswordText">'+sysPrefPwdRes+'</wsse:Password>'
+'</wsse:UsernameToken>'
+'</wsse:Security>'
+'</soapenv:Header>'
+'<soapenv:Body>'
+'<cus:MM_spcANS_spcAdd_spcAttachment_spcTC_spcWF>'
+'<Input_spcMessage>'
+'<mm:ListOfMmAnsEntityAttachmentRequest>'
+'<mm:MmAnsEntityAttachmentRequest>'
+'<mm:Comments></mm:Comments>'
+'<mm:EntityId>'+IdTCond+'</mm:EntityId>'
+'<mm:FileExtension>PDF</mm:FileExtension>'
+'<mm:FileName>'+filename+'</mm:FileName>'
+'<mm:AttachmentId>'+base64+'</mm:AttachmentId>'
+'</mm:MmAnsEntityAttachmentRequest>'
+'</mm:ListOfMmAnsEntityAttachmentRequest>'
+'</Input_spcMessage>'
+'</cus:MM_spcANS_spcAdd_spcAttachment_spcTC_spcWF>'
+'</soapenv:Body>'
+'</soapenv:Envelope>';
objXMLHttpRequest.send(soapXML);
response = objXMLHttpRequest.responseXML;
…
}
Conclusion
The Open UI framework enables more sophistication in the use of local resources and integration with Web Services is a possible solution available to developers and analysts.
Note: In the example presented, the security component has been implemented but is not covered within the scope of this article.