Thus I started working towards removing dependency on JAVA business service and created complete eScript based solution as ver2 of EAI JSON Converter business service.
Generate JSON in Siebel without Java |
This service will have the same methods and arguments, and will outputs similar JSON string and property set as previous version did but without the need of JDK. It is complete plug and play service, just copy paste the code and start using the service.
function CreateJSON(Inputs){Hope the code is self explanatory. Feel free to edit it for your implementation. I have tested the output and validated for RFC4627.
/*********
Created By: Jim
Support: http://howtosiebel.blogspot.com
*********/
var str,j;
var propName = "";
var propVal = "";
str = "{";
propName = Inputs.GetFirstProperty();
//Type and value
if(Inputs.GetValue() != null && Inputs.GetValue() != ""){
str = str + '"' + Inputs.GetType() + '"' + ":" + '"' + Inputs.GetValue() + '"';
if(propName != "") str= str + ",";
}
//Properties
while (propName != "") {
propVal = Inputs.GetProperty(propName);
str = str + '"' + propName + '"' + ":" + '"' +propVal + '"';
propName = Inputs.GetNextProperty();
if(propName != "") str = str + ",";
}
propName = Inputs.GetFirstProperty();
if(propName != "" && Inputs.GetChildCount()> 0)str = str + ",";
//Loop for child
if(Inputs.GetChildCount()> 0){
if(Inputs.GetChildCount()> 1)str = str + '"Object"' + ":" + "{";
for (var i = 0; i < Inputs.GetChildCount(); i++){
j = Inputs.GetChild(i);
str = str + '"' + j.GetType() + i + '"' + ":" + CreateJSON(j);// + ",";
if(i+1<Inputs.GetChildCount()) str =str + ",";
}
if(Inputs.GetChildCount()> 1)str = str + "}";
}
str = str + "}";
return str;
}
Creating JSON string from property set was easy I traversed through the property set using out of the box Siebel methods and created the string. Creating propset from JSON proved difficult, I am still working on solution for interpreting JSON and converting it into property set, I have made some progress will post it as soon as it is working satisfactorily.
If you want to contribute in nobel cause then contact me via comments below and don't forget to plus one this post on Google. All comments are welcome.
Excellent Work Jim!!! Hope this will make a framework to remove so many middleware based integrations & JBS(Java Business Services) in siebel Applications.
ReplyDeleteThanks Singh !
ReplyDeleteHi Jim, which class should be used for the above script in BS
ReplyDeleteHi Sameena, there is no special class required for this service. Import sif file from following URL and start using this service.
Deletehttp://howtosiebel.blogspot.com/2016/06/download-eai-json-converter-v2.html
If I use the Business Service(EAI JSON Converter) in Workflow process any method arguments
ReplyDeleteJSONToPropset and PropsetToJSON I must pass on input and get the output?
Who can help me figure it out?
Maybe someone has already implemented the WF?
Thanks Jim for the update.Currently we are upgraded to Siebel IP 2016 and it will support only Inbound RestAPI Json format. We have a requirement to call the Outbound RESTAPI JSON format. Can I use this BS to Convert the Siebel XML to JSON and Call the Outbound restapi url?
ReplyDeleteHi, Please Helpme, Im siebel tools 8114, and when run WF service EAI HTTP Transport, method SendReceive, show error warning and stop client
ReplyDelete---------------------------
Siebel Web Session
---------------------------
Unable to create the Business Service 'Web Engine Interface'(SBL-DAT-00227)
---------------------------
Aceptar
---------------------------