Tuesday 31 July 2012

Invoking web service from Siebel with EAI HTTP Transport Business Service

 

Some recent task I did was to invoke a web-service from Siebel to send SMS message.

I have to admit that I never did such a thing before. So I started to read Siebel “bookshelf”  documentation (you can throw this crap to the garbage . It is worthless), search Google. Found plenty bad written tutorials about invoking workflow process that can invoke web service or call http URL.

        Half of the staff I didn’t understand, the  other half didn’t like, but I understood one thing: at the end Siebel works with a Business Service (BC) called “EAI HTTP Transport “.

As I mentioned I am not to good with clicking on buttons in Siebel Tools, but pretty good with writing code. So if I know that Siebel uses a BC, why not to use it directly?

  The result is this simple function that defines XML message and uses POST method to submit data to remote web-service


function SendSms(Inputs, Outputs)
{
//get Business Service
var bs = TheApplication().GetService("EAI HTTP Transport");
var inp = TheApplication().NewPropertySet();
var outputs1 = TheApplication().NewPropertySet();
// it is web-service, so use POST method
inp.SetProperty("HTTPRequestMethod","POST");
//Content type as in all HTTP request
inp.SetProperty("HTTPContentType", "text/xml; charset=UTF-8");
//web-service end point
inp.SetProperty("HTTPRequestURLTemplate","https://**********/imsc/interfaces/largeaccount/la3.sms");
//define the data to be send
var reqVal = '<?xml version="1.0" encoding="utf-8" ?> '+
'<request> '+
' <head> '+
' <auth> '+
' <account>CompanyName</account> '+
' <user>userName</user> '+
' <pass>Pass</pass> '+
'</auth> '+
' <action>sendsms</action> '+
' </head> '+
' <body> '+
' <addr> '+
' <from>039535640</from> '+
' <to> '+
' <cli>97254545450</cli> '+
' </to> '+
'</addr> '+
'<data> '+
' <msgtype>text</msgtype> '+
' <text>This is SMS message text</text> '+
' </data> '+
' <billing> '+
' <port>0</port> '+
' </billing> '+
' </body> '+
'</request>';
//set the data
inp.SetProperty("HTTPRequestBodyTemplate",reqVal);
//invoke. The result can be found in "Outputs"
bs.InvokeMethod("SendReceive",inp,Outputs);
}

Sunday 8 July 2012

Google Chrome Application Cache 5MB limit. No More!!!!


There is a grate feature in HTML5 that allows you to cache the content of the web-site locally and use it even if the server is down and there is no internet connection. All you need to do is to defined your manifest file and use the following syntax in HTML code

<html manifest="example.appcache">
...
</html>
Here example.appcache is the name of your manifest. I am not going to explain how do define the manifest or how to use it. There is plenty of blogs, articles about it. Just Google!! (e.g Good Post about caching with HTML5) I am going to explain how to solve a huge problem with this engine on Google Chrome.  Don’t know what guys from Google thought (actually I do Smile ), but they limit the size of the cache to 5MB only. Men!!! If I have 3 pictures on my site, I probably already use at least 1MB on the cache. And any way  - if you use offline manifest at some point you will realize that you need more space. Specially if you are developing mobile application 
    But Google doesn’t provide any configuration or setting to change this limit. Or at least not officially. This is how you can do it not-officially
First of all download some sqlite database client. I usually use Sqlite Administrator
Go to “YOUR USER DOCUEMENTS DIRECTORY”\AppData\Local\Google\Chrome\User Data\Default\Application Cache. For example on my Windows 7 (and yes , it is Legal Smile)
It is C:\Users\mshapira\AppData\Local\Google\Chrome\User Data\Default\Application Cache\index
Open the file “index”
clip_image001
 
It is a database file. You need to update QUOTE table
clip_image001[4]
 
By default it has no values. You need to insert 2 values. First one is the web-server that serves the page you want to cache and the second one is the size of the cache. Fill free to set it to some large value
 insert into quota values("http://localhost:80/", 100000000);
You can always view what is the size of your cache by simply typing in Chrome address bar :chrome://appcache-internal