Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Integration Bus View modes: 
User avatar
Member
Member
robert-pulldigital - 6/21/2013 6:28:46 AM
   
Integration Bus
For my ProcessInternalObject method we are passing an XMLDocument containing the data I want to map to a Kentico Product.

If I use this line

BaseInfo info = null;
info = CMSObjectHelper.GetObject("cms.product");

I am looking for the correct string to use to specify an object type, or is it the codename of the object and so is it just the codename?

Also how might you access Custom Fields added to a product type registered in Kentico.

The holy grail is for us to keep products in a 3rd party system in sync with products registered in Kentico.

We have exposed a web service the 3rd party app can send it's XML to and prepared the methods, i'm looking at the final implementation which is just to set properties on an object from the XML and return it.

Thanks

User avatar
Member
Member
robert-pulldigital - 6/21/2013 8:49:44 AM
   
RE:Integration Bus
Went down a slightly different path and I populate a SKUInfo object and cast it to an ICMSObject later on and return it from the ProcessInternalObject method but unfortunately nothing popped into the integration bus queue and no error in the event log. How can I diagnose what happens after ProcessInternalObjectis fired.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 6/21/2013 9:41:12 AM
   
RE:Integration Bus
I simply set a break point inside my ProcesInternalTaskAsync method and started debugging. When I logged in to the CMSDesk I was able to start stepping though the code. You could also put a try/catch block around your code and write an error to the log in the catch if you don't want to debug. Also a good practice if you want to continue processing your tasks. Your catch would write an error and return the enum ErrorAndSkip.

User avatar
Member
Member
robert-pulldigital - 6/21/2013 10:04:07 AM
   
RE:Integration Bus
The break point in ProcessInternalObject breaks and the code steps through nicely and returns the SKUInfo as a ICMSObject which I personally think is the problem but no error is thrown and if a skuinfo could not be cast to an ICMSObject I would of expected an exception at that point.

It's possibly related to the registration of the bus in the back end as well. Unfortunately all appears to be working

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 6/21/2013 10:06:43 AM
   
RE:Integration Bus
Can you post some of your code?

User avatar
Member
Member
robert-pulldigital - 6/21/2013 10:30:48 AM
   
RE:Integration Bus
The code is changing dramatically but right now it's this

The service itself that is listening for requests

[WebMethod]
public void ProcessProduct(object data, TaskTypeEnum tasktype)
{
if (data != null)
{
IntegrationHelper.ProcessExternalTask("SalesforceProductIntegrator", data, IntegrationProcessTypeEnum.SkipOnError, tasktype, TaskDataTypeEnum.Simple, "EcommerceSite");
}
}

The web service simply calls the method ProcessExternalTask which is in the framework and makes a call to ProcessInternalObject which has been overridden in our customer integrator and looks like

public override ICMSObject PrepareInternalObject(object obj, TaskTypeEnum taskType, TaskDataTypeEnum dataType, string siteName)
{
BaseInfo info;
info = CMSObjectHelper.GetObject("cms.eventattendee");
try
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(obj.ToString());

info.SetValue("name", doc.SelectSingleNode("/Value1").InnerText);


}
catch (Exception ex)
{
EventLogProvider logProvider = new EventLogProvider();
logProvider.LogEvent("E", DateTime.Now, "PrepareInternalObject", ex.GetBaseException().ToString());
}

return info != null ? info : null;
}

That is the latest inception where you see the info object we have previously been using a SKUInfo object but I believe I must use a baseinfo object. Unfortunately I don't yet know the type I need for an ecommerce object so I went with eventattendee from an example I was looking at.

There is still no error and nothing pops up in the queue but I can debug it and step through so i'm happy it's close to working :)

Thanks

User avatar
Member
Member
Swainy - 6/21/2013 10:20:51 AM
   
RE:Integration Bus
Hi Robert,

Do you mean ProcessInternalTask method or PrepareInternalObject?

If you are using ProcessInternalTask then you can do a switch statement on the infoObj.ObjectType and then you can check what the case is e.g.


switch (infoObj.ObjectType)
{
#region ORDER
case PredefinedObjectType.ORDER:
{
switch (taskType)
{

#region CreateOrder
case TaskTypeEnum.CreateObject:
{

WHAT YOU WANT TO CREATE OBJECT HERE


If you are trying to update an object in Kentico from your external system then I would reccommend creating your own web service and then creating a call to ProcessExternalTask method (integrationHelper). Here you can process the XML in your web service and then pass that into a kentico object and just pass the object into the method, kentico will handle the rest.

I created a blog post on the intergration bus which talks through both steps for doing this:

http://swainy2k.wordpress.com/2013/05/10/kentico-system-integration-bus/

Thanks,

Matt

User avatar
Member
Member
robert-pulldigital - 6/21/2013 10:25:01 AM
   
RE:Integration Bus
Integrating a 3rd party system with Kentico so we have created a web service, a class inheriting from BaseIntegrationConnector which the web service uses IntegrationHelper.ProcessExternalTask to call the relevant integrator.

The custom integrator we developed takes the 3rd party data which is XML, populates a SKUInfo product and returns it as an ICMSObject. I believe this is why it's not actually doing anything however there is no error reported and it all seems to run smoothly.

User avatar
Member
Member
Swainy - 6/24/2013 3:39:35 AM
   
RE:Integration Bus
Hi Robert,

The way I have done it is to parse the XML in your web service and then pass in the SKUInfo (product) to the integrator (rather than the XML).

Thanks,

Matt

User avatar
Member
Member
robert-pulldigital - 6/24/2013 5:28:04 AM
   
RE:Integration Bus
So are we saying SKUInfo implements ICMSObject somewhere in the hierarchy so it should work already?

No error occurs but nothing appears in the queue either. I was already having a SKUInfo object which I though might be the problem. I'll look through the blog and any other notes I can find. Is there a way in Kentico to send a test request to a queue just to check it is up and running?

User avatar
Member
Member
robert-pulldigital - 6/24/2013 10:26:05 AM
   
RE:Integration Bus
I think someone should always mention to check that the setting in Kentico to enable the integration bus is ticked!

:) <-- new to Kentico in every way.

User avatar
Member
Member
Swainy - 6/25/2013 5:36:28 AM
   
RE:Integration Bus
Haha genius :)

Glad you got it sorted!

User avatar
Certified Developer XbK
Certified Developer XbK
bmckeiver-bizstream - 6/26/2013 8:04:14 PM
   
RE:Integration Bus
Glad you figured it out. That has bitten me before too! I posted a uservoice request on it:

http://kentico.uservoice.com/forums/33767-features-general/suggestions/3715028-add-an-integration-bus-connector-warning-message

-Mcbeev

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 6/27/2013 7:37:07 AM
   
RE:Integration Bus
Robert, I learned something like this the hard way with a scheduled task that is site specific and created automatically named Content Synchronization. By default it is enabled and runs every hour. If you have Content Stating setup on your site, it will automatically sync changes whether or not you want it to. This one might be good to have disabled by default vs. enabled.

Brenden

User avatar
Member
Member
robert-pulldigital - 6/28/2013 5:58:54 AM
   
RE:Integration Bus
Thanks guys, still plugging through there is a lot to take in, so far we have achieved everything required all be it the wrong way :).