Showing posts with label xml. Show all posts
Showing posts with label xml. Show all posts

Tuesday, September 9, 2008

Setting the Primary through EAI

We have an inbound EAI service based on a business service that processes a complex Contact message. One of the child elements in the Contact message is the personal address. We've observed that the inbound message, in an upsert, will insert a new address but not mark it as primary for the Contact. Siebel provides a property called "IsPrimaryMVG" which can be sent with the Address record as an element or attribute. However, since we cannot ask our integrated app to send this, nor should we, we have to ammend the incoming message on the fly. This was done by traversing the IOHierarchy and setting the property as follows:

/* Below Code is Required to Parse Opportunity Role & Opportunity Id from Given XML */
if (xmlOutputs.GetChildCount() > 0)
{
MessageElement = xmlOutputs.GetChild(0);
if (MessageElement.GetType() == "SiebelMessage")
{
ListElement = MessageElement.GetChild(0);
if (ListElement.GetType() == "ListOfContact")
{
ContactEle = ListElement.GetChild(0);
if (ContactEle.GetType() == "CEB WebV2 Contact Int")
{
OptyRole = ContactEle.GetProperty("Opty Role");
OptyEle = ContactEle.GetChild(0);
if (OptyEle.GetType() == "ListOf WebV2 Contact Int_Opportunity")
{
OptyIdEle = OptyEle.GetChild(0);
OpportunityId = OptyIdEle.GetProperty("Opty Id");
}
//mwd 090908 added to set address as primary
var PrimaryEle;
var AddrEle;
AddrEle = ContactEle.GetChild(1);
if (AddrEle.GetType() == "ListOf WebV2 Contact Int_Personal Address")
{
PrimaryEle = AddrEle.GetChild(0);
PrimaryEle.SetProperty("IsPrimaryMVG", "Y");
}
//end mwd 090908
}
}
}
}

Key lesson here is that the GetChild(0) is used.

Testing business service w/ XML in simulator

Figured it might be useful to write this down and share. You can use the business service simulator (Site Map -> Business Service Admin -> Business Service Simulator) to test inbound integration based on a business service without the need for a harness or html stub. This is especially useful for debugging the scripts line-by-line. Here are the steps:

1. Find the xml message that you want to test and modify the file such that the xml is all in one line (no line feeds or carriage returns!) like this (it will be pasted into a Siebel field)

2. Log into Siebel as administrator and navigate to the bus svc simulator view.

3. In the Service Methods top applet, click New and select the business service and method you want to test. In this example, I am testing the inbound Contact message.

4. In the Input Property Set applet, type “Inputs” into the Type field and paste the xml you modified in step 1 into the Value field.

5. In the top Service Methods applet click “Run”

6. If you’ve put break points in your code, you can now step through the business service!