SmartObject execution error.

rated by 0 users
This post has 4 Replies | 4 Followers

Top 150 Contributor
Posts 48
Points 150
sushama Posted: Wed, Jun 17 2009 5:09 AM

While execution of smartobject getting an error ""Exception of type 'SourceCode.SmartObjects.Client.SmartObjectException' was thrown.""

I have done following things:

1) Created Service object from SAP method.

2) Depends upon service object created smartobject.

3) This smartobject trying to execute in the asp.net codebehind but giving an error.

string smartObjectName = "ProjectDetails";

string methodName = "Service1_Z_K2_GEN_PROJ_INFO";

SourceCode.SmartObjects.Client.SmartObject smartObject = smartObjectServer.GetSmartObject(smartObjectName);

int projectNumber = 72;

smartObject.ListMethods[0].InputProperties["p_PROJ_RESP_NUM"].Value = projectNumber.ToString();

smartObject.MethodToExecute = methodName;

SmartObjectList projectList = smartObjectServer.ExecuteList(smartObject); ----------------- At this line getting an error  "Exception of type 'SourceCode.SmartObjects.Client.SmartObjectException' was thrown.""

foreach (SmartObject so in projectList.SmartObjectsList)

{

    string s = so.Properties[1].Value;

}

Is anybody aware of this issue?

 

 

  • | Post Points: 4
Not Ranked
Posts 5
Points 11

I wanted to also add myself to the list of those experiencing this exception (Exception of type 'SourceCode.SmartObjects.Client.SmartObjectException' was thrown.).  I haven't found a solution to it.  In my case, the code snippet below is trying to execute a "List" method that is referenced by the "Broker" smart object.  The implementation of this List method is done via a custom smart object service instance that I successfully configured in the BrokerManagement app on the K2 server.  I also able to successfully reference the service's method from the Broker smart object method wizard in the designer.  No compile time errors.  Any ideas on how to troubleshoot?  Thanks.

 server.CreateConnection();
 server.Connection.Open(connStr.ToString());

 SmartObject smartObject = server.GetSmartObject("Broker");
 smartObject.MethodToExecute = "List";

 SmartObjectList smoBrokers = server.ExecuteList(smartObject);   // throws exception on this line

 foreach (SmartObject smo in smoBrokers.SmartObjectsList)
 {
         Broker b = new Broker();
         b.ID = Convert.ToInt32(smo.Properties["ID"].Value);
         b.Name = smo.Properties["Name"].Value;
         brokers.Add(b);
 }

Top 75 Contributor
Posts 81
Points 302

Do you have any resulotion to this? I am also having the same issue.

VijayKumar Yadavalli

  • | Post Points: 4
Not Ranked
Posts 11
Points 20
SteveB replied on Wed, Jun 8 2011 1:11 AM
Hi Guys So I was having the same problem as you all. I implemented the following catch clause after the executescalar being in the try section of the clause. catch(SmartObjectException soEx) { StringBuilder sb = new StringBuilder(); foreach(SmartObjectExceptionData soExData in soEx.BrokerData) { sb.Append("Service: "); sb.AppendLine(soExData.ServiceName); sb.Append("Service Guid: "); sb.AppendLine(soExData.ServiceGuid); sb.Append("Severity: "); sb.AppendLine(soExData.Severity.ToString()); sb.Append("Error Message: "); sb.AppendLine(soExData.Message); sb.Append("InnerException Message: "); sb.AppendLine(soExData.InnerExceptionMessage); throw new Application Exception(sb.toString(), soEx); } This will give you the actual error that the smartobject is returning. Mine was a datetime value being in the wrong format. so if you selected a date lower than 12 it worked, anything higher and it failed as obviously there are only 12 months in a year ;) I hope this helps some people!

Cheers, 
Steve

The statements and opinions made in my postings are my own, and do not reflect the opinions of SourceCode Technology Holdings, Inc. or its subsidiaries. All information is provided as is with no warranties, express or implied, and grants no rights or licenses.

Top 10 Contributor
Posts 533
Points 1,553
BasharA replied on Tue, Jul 3 2012 7:19 AM

Hi SteveB  your Prophecy came true!!!!!!

Thanx a Lot Steve; it really helped me.

Many thanks

Bashar Adas   Bashar_Adas@hotmail.com

  • | Post Points: 1
Page 1 of 1 (5 items) | RSS