custom functoid

Home Page Forums BizTalk 2004 – BizTalk 2010 custom functoid

Viewing 1 reply thread
  • Author
    Posts
    • #14655

      I’ve created a functoid but It has a problem. :).
      If I paste the code (just the class) beneath in a console application, it works fine so it has to do with the functoid.

      I’ve created a strong key.
      I have submitted the \\obj\\debug\\*.dll to the GAC and also placed it under \\mapper extensions in the biztalk folder.
      Then added the functiod to the toolbox, selected the *.dll from \\mapper extensions.

      This is the code from the functoid:
      ——————————————-

      namespace GenerateOrderIdFunctoid
      {
      public class CreateOrderID :BaseFunctoid
      {
      public CreateOrderID()
      {
      this.ID = 6002;
      SetupResourceAssembly(\”GenerateOrderIDFunctoid.Resources\”, Assembly.GetExecutingAssembly());
      SetName(\”Name\”);
      SetDescription(\”Description\”);
      SetBitmap(\”icon\”);
      this.SetMinParams(0);
      this.SetMaxParams(0);
      SetExternalFunctionName(GetType().Assembly.FullName, \”GenerateOrderIDFunctoid.CreateOrderID\”, \”OrderID\”);
      this.Category = FunctoidCategory.DatabaseLookup;
      this.OutputConnectionType = ConnectionType.All;
      }

      public string OrderID()
      {
      //connectie
      string connectionString = \”Server=AWS00293\\\\STAGE;Database=OrderSysteem;User ID=ASPNET;Password=”;Trusted_Connection=YES\”;
      SqlConnection conn = new SqlConnection(connectionString);
      SqlDataAdapter dataAdapter = new SqlDataAdapter();
      SqlCommand command = new SqlCommand();

      dataAdapter.SelectCommand = conn.CreateCommand();
      dataAdapter.SelectCommand.CommandText = \”SELECT TOP 1 OrderID FROM dbo.Orders ORDER BY OrderID DESC\”;
      DataSet ds = new DataSet();
      dataAdapter.Fill(ds, \”LastOrderID\”);

      //data uit dataset halen
      DataTable dataTable = ds.Tables[0];

      string id = \”\”;
      //Standaard op 1, is er geen order, dan begint men vanaf 1
      Int64 followingNumber = 1;

      foreach (DataRow dataRow in dataTable.Rows)
      {
      id = dataRow[\”OrderID\”].ToString();
      id = id.Substring(5).Trim();
      followingNumber = Convert.ToInt64(id);
      followingNumber++;
      }

      //we hebben nu zowel id als followingNumber
      string word = \”order\”;
      string dump = followingNumber.ToString();
      for (int i = 0; i < 10 – dump.Length; i++)
      {
      word += \”0\”;
      }
      return \”\” + word + followingNumber;
      }
      }
      }
      ————————
      This is the error:

      ———————
      Xlang

      Uncaught exception (see the ‘inner exception’ below) has suspended an instance of service ‘Orchestrations.CheckOrder(4e73d817-91ea-ce89-1929-07a378910447)’.
      The service instance will remain suspended until administratively resumed or terminated.
      If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
      InstanceId: 0b8f8467-1283-4213-bc8a-ff0532af0e75
      Shape name: Cstr_Order
      ShapeId: d8c6b4e6-f0a1-4770-8c78-557fe12ddff1
      Exception thrown from: segment 1, progress 6
      Inner exception: Error encountered while executing the transform Transforms.FromWebshop_XML_To_OrderReference_XML. Error:Unable to create the transform..

      Exception type: XTransformationFailureException
      Source: Microsoft.XLANGs.Engine
      Target Site: Void ApplyTransform(System.Type, System.Object[], System.Object[])
      The following is a stack trace that identifies the location where the exception occured

      at Microsoft.XLANGs.Core.Service.ApplyTransform(Type mapRef, Object[] outParams, Object[] inParams)
      at Orchestrations.CheckOrder.segment1(StopConditions stopOn)
      at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
      Additional error information:

      Value cannot be null.
      Parameter name: extension

      Exception type: ArgumentNullException
      Source: System.Xml
      Target Site: Void AddExtensionObject(System.String, System.Object)
      The following is a stack trace that identifies the location where the exception occured

      at System.Xml.Xsl.XsltArgumentList.AddExtensionObject(String namespaceUri, Object extension)
      at Microsoft.XLANGs.BaseTypes.TransformBase.get_TransformArgs()
      at Microsoft.XLANGs.RuntimeTypes.TransformMetaData..ctor(Type transformBaseType)
      at Microsoft.XLANGs.RuntimeTypes.TransformMetaData._creator(Type t)
      at Microsoft.XLANGs.RuntimeTypes.MetadataCache._slowFor(Type t)
      at Microsoft.XLANGs.RuntimeTypes.MetadataCache.For(Type t)
      at Microsoft.XLANGs.RuntimeTypes.TransformMetaData.For(Type t)
      at Microsoft.XLANGs.Core.Service.ApplyTransform(Type mapRef, Object[] outParams, Object[] inParams)
      ———————–

      Hm, Any idea’s 😛 [/code]

    • #14654

      I was able to create one fairly easy.

      Here is a great article…

      http://www.codeproject.com/dotnet/CustomFunctoid.asp

      Good Luck!

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.