Showing posts with label Web Services. Show all posts
Showing posts with label Web Services. Show all posts

Wednesday, February 10, 2010

Invoke Outbound Webservice

Almost a year back I posted a simple outbound webservice to invoke a program in .net and get the sum of two numbers. To parse the response XML I created a custom business service and that did work as expected. But I read about Lookup method on EAI Dispatch Service recently and thought it'd parse the XML better. To try this I removed custom business service step and added a new EAI Dispatch Service step. It worked great and can update the field for response value with no scritping. Ain't that neat!!


Here is the link for the workflow..

https://docs.google.com/leaf?id=0B190QnHiknnLYmVhZjVhZjgtMDU3YS00YzhiLWFiYmQtOGViYjQxNDcyODI0&hl=en

Later

Friday, December 25, 2009

Inbound Web service

Integration has always been fun and good that my exposure to integration has improved considerably in the last year. In my current project I had to create couple of inbound web services and was successful in finding a scriptless solution. Here is how I configured it,
1 .Create a workflow process with first step of EAI Integration Object Hierarchy to XML Hier Bus Service .Define a process property of type Integration Object and In (for In/Out)
2. Then use EAI Dispatch web service look up method to parse the XML .

For the EAI Dispatch service to process the XML define the xpath for the xml elements on Administration-Integration -> EAI Dispatch Service view.
The Key point in the workflow process , which I figured after a while, create a process property of type in and data type Integration Object. This would make sure that incoming message is received as Siebel Message and then process XML.

I'm planning to change the configuration I posted for Outbound webservice before with Integration-data-map and then EAI dispatch service. I bet that would be scriptless too and would perform better..Later.



Thursday, January 15, 2009

It's Frost bites time!!!

New year is here and I think it will be already in the books for the lowest temperature recorded in years. Its freezing cold here, temperature in -20 and sucks big time. Well my coffee is not invigorating any more but it helps me keep warm for some time. So I spent most of my time at home and been burning lot of time talking on the phone.

Our man AR rocks the western world now and every Indian should be proud of him. Saw the Slumdog millionaire and loved the screenplay. But I wish that the director has shown atleast one nice shot of Business Capital of India. I heard one of the audience in the theater commenting , “Now I understand why it’s easy to take Indian out of India”. Well some of the scenes were gross than Saw for sure. But screenplay of the movie stands tall. I wish AR wins Oscar for this sound track. I feel some of his scores in the nineties are much better than Slumdog soundtrack but the media was not big in the 90s as it is now.

Other than watching movie and talking to my friends my week has been pretty drab .Guess what spend the rest of time in Siebel trying to invoke .net web service from Siebel.It was interesting and good that it was not a smooth ride..Learnt a lot .So here is how I did it.

1.Wrote a program in C# and exposed it as web service.
Code:

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service () {

//Uncomment the following line if using designed components
//InitializeComponent();
}

/*[WebMethod]
public string HelloWorld() {
return "Hello World";
}*/

[WebMethod]

public decimal AddNumbers(decimal lnNumber1, decimal lnNumber2) {

decimal AddNumbersResult;
AddNumbersResult = lnNumber1 + lnNumber2;
return AddNumbersResult;

}


}

2.Compiled and saved the WSDL. It’s easier to generate WSDL in .net .You just change the published web service from http://localhost:1569/WebSite1/Service.asmx?op=AddNumbers to
http://localhost:1569/WebSite1/Service.asmx?wsdl .

3.Imported the WSDL into Siebel

4.Siebel generates IO and Bus Srvc for the WSDL

5. Created a BusSrvc to build the hierarchy to send the numbers over to .net.Also, note in the program below how you define the variable type as number. This is new in Siebel and helps to improve the performance.

function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{
var svc;
var psInputs;
var psOutputs;
var outputListOfNum;
var getNumbersResponse;
var outputAddNum ;
var num_result;
var Rev_1:Number;
var Rev_2:Number;


try
{
if(MethodName == 'Invoke WS')
{
svc = TheApplication().GetService("ServiceSoap_1");


psInputs = TheApplication().NewPropertySet();
psOutputs = TheApplication().NewPropertySet();


psInputs.SetType("AddNumbersSoapIn:parameters");
psInputs.SetProperty("MessageId","");
psInputs.SetProperty("MessageType","Integration Object");
psInputs.SetProperty("IntObjectName","AddNumbers");
psInputs.SetProperty("IntObjectFormat","Siebel Hierarchical");

var pchild = TheApplication().NewPropertySet();
var pchild1 = TheApplication().NewPropertySet();

Rev_1 =ToNumber(Inputs.GetProperty("Revenue I"));
Rev_2 =ToNumber(Inputs.GetProperty("Revenu II"));

pchild.SetType("ListOfAddNumbers");
pchild1.SetType("AddNumbers");
pchild1.SetProperty("lnNumber1",Rev_1);
pchild1.SetProperty("lnNumber2",Rev_2);

pchild.AddChild(pchild1);
psInputs.AddChild(pchild);


Outputs.AddChild(psInputs);

return(CancelOperation);


}// if(MethodName == 'Invoke WS')

else if (MethodName == 'ParseReturn')
{
if (Inputs.GetChildCount() > 0)
{
getNumbersResponse = Inputs.GetChild(0);
if (getNumbersResponse.GetType() == "AddNumbersSoapOut:parameters")
{
if (getNumbersResponse.GetChildCount() > 0)
{
outputListOfNum = getNumbersResponse.GetChild(0);
if (outputListOfNum.GetType() == "ListOfAddNumbersResponse")
{
if (outputListOfNum.GetChildCount() > 0)
{
outputAddNum = outputListOfNum.GetChild(0);
if (outputAddNum.GetType() == "AddNumbersResponse")
num_result = outputAddNum.GetProperty("AddNumbersResult");
Outputs.SetProperty("AddResponse",num_result);
}
}

}
}
}

return(CancelOperation);

}


else
return (ContinueOperation);

}//try

catch(e)
{
//calling a function to handle the error, with event name and error object as inputs

throw(e);
}
finally
{
}

}

6. Created a workflow to :
• Build Hirerachy
• Invoke Web Service
• Parse return from .net
• Update Siebel for the result from .net




It works perfect.So that’s all it is. I should say it was easy to integrate Siebel with .net than Java. More in next.

Thursday, October 16, 2008

Letz get it started in here!!

Finally Thursday is here and I have quite a few things to check off my list before I go to India for a short vacation.

We are three weeks away from the election and everyone will be looking up to the next President in the tanked economy. I’m eager too but I would be much happier if I get to vote. I don’t think I can vote in India either since I don’t have an ID card.

Well all pages in the news paper have something related to economy. I don’t complain but this is the only thing you hear when you tune to any channel or skim through any page in the news paper..One good news is oil price has plummeted and the big shots in oil industry are meeting next week to talk about this. What might they conclude, let’s reduce the oil supply to increase the price and put an end to one good news that media would report in the crumbling economy. I wish oil was not a commodity at first place.

All ramblings aside, I’m planning to go for the SOA suite training soon. Well this should be good, always I wanted to learn integration in Java and I hope that SOA will be a good start to head in that direction.

More in the next, till then good bye