Reference extensible array in .NET web service

I have an extensible array that I want to expose to a .NET web service. Any idea how I would define the data structure in VB.NET in order to return the array data from Natural?

The Natural components were generated using the IDL Extractor for Natural in Eclipse 3.3.

Example of data area
0100 PARAMETER
0110 1 #OT-RECORD-CNT (N3)
0120 1 #OT-RETURN-CODE (N4)
0130 1 #OT-STATUS-MSG (A80)
0140 1 #OT-DATA (1:*)
0150 2 #OT-CASE-NUMBER (N10)
0160 2 #OT-CASE-TYPE (N2)

I’ve tried using a Structure, but it doesn’t seem to like it.
Public Structure test
Public reccnt As Integer
Public retcde As Integer
Public status As String
Public ret_data As DataTable

Any help to overcome this hurdle is appreciated.

Hi jcoignet,

you can simpy use the EntireX .NET Wrapper to generate a .NET interface object from this IDL. Then you can use that interface object in a .NET Web service to call Natural underneath.

With kind regards,
Dietmar

thanks! I will give that a try.

On the returned data, how should I define the array in .NET and how do I parse through it? We haven’t had much luck.

It appears to be an object or an array, but for some reason, only the 1st occurrence is being returned, even though we know there are at least 19 to be returned.

Thanks!

Hi jcoignet,
the EntireX .NET Wrapper works on an interface description (IDL) file. For your example it looks like (file Test.idl):

library 'Test' is
  program 'Test' is
    define data PARAMETER 
    1 #OT-RECORD-CNT (N3) 
    1 #OT-RETURN-CODE (N4) 
    1 #OT-STATUS-MSG (A80) 
    1 #OT-DATA (/1:V) 
    2 #OT-CASE-NUMBER (N10) 
    2 #OT-CASE-TYPE (N2) 
    end-define

Running the .NET Wrapper on this IDL it generates the c-sharp code from Test.cs.

Regards, Dietmar

Somehow the file attachment did not work. Here’s the C-sharp file:

#region * * * P L E A S E D O N O T M O D I F Y * * *
/***************************************************************************
** Module name : Test.cs
** Description : Client Stub File for .NET (8.1.2.0)
**
** * * * P L E A S E D O N O T M O D I F Y * * *
**
** Author : Generated by Software AG EntireX IDL Compiler
** Template : csharp_client.tpl for C#
** Platform : .NET-able Platforms
** Usage :
*/
#endregion
#region parameters
/

** sanitize C#
** Broker : localhost:1971
** Service : RPC/SRV1/CALLNAT
** ATOSTRING : Default
** A1TOCHAR : false
** B1TOBYTE : false
** TRIM : true
** SANITIZE : true
***************************************************************************/
#endregion
#region required namespaces
using System;
using System.Text;
using System.Runtime.InteropServices;
using SoftwareAG.EntireX.NETWrapper.Runtime;
#endregion

#region AssemblyInfo
#if USE_ASSEMBLY_INFO
using System.Reflection ;
[assembly: AssemblyTitle(“EntireX .NET Wrapper Client”)]
[assembly: AssemblyDescription(“EntireX .NET Wrapper Client”)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(“Software AG”)]
[assembly: AssemblyProduct(“EntireX Communicator”)]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion(“1.0.*”)]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
#endif
#endregion

namespace SoftwareAG.EntireX.NETWrapper.Generated.Test.Groups
{
#region Groups for LIBRARY ‘Test’, PROGRAM ‘Test’

public class Test
{
public class OtData
{
[SendAs(IdlType.N, preDecimal=10, postDecimal=0, Id=0)]public decimal otCaseNumber;
[SendAs(IdlType.N, preDecimal=2, postDecimal=0, Id=1)]public decimal otCaseType;
}
}

#endregion
}
namespace SoftwareAG.EntireX.NETWrapper.Generated.Test
{
[EntireXVersion(“8.1.2.0”)]
[Library(“Test”)]
[Broker(“localhost:1971”)]
[Service(“RPC/SRV1/CALLNAT”)]
public class ClassTest : ServiceHolder
{
#region Constructor(s) etc for LIBRARY ‘Test’

public ClassTest() : base() {}
public ClassTest(Broker broker) : base ( broker ) {}
public ClassTest(Service service) : base ( service ) {}

#endregion
#region Method/Function for LIBRARY ‘Test’ PROGRAM ‘Test’

[Program("Test")]
public void Test(
  [SendAs(IdlType.N, preDecimal=3, postDecimal=0)][In, Out] ref decimal otRecordCnt,
  [SendAs(IdlType.N, preDecimal=4, postDecimal=0)][In, Out] ref decimal otReturnCode,
  [SendAs(IdlType.A, Length=80f, Trim=true)][In, Out] ref StringBuilder otStatusMsg,
  [SendAs(IdlType.Group, Dim=0f, Unbounded = true, Dimensions = 1)][In, Out] ref SoftwareAG.EntireX.NETWrapper.Generated.Test.Groups.Test.OtData[] otData
){
  ArrayHolder otDataHolder = new ArrayHolder ( otData ) ;
  service.Send(
    this.GetType().GetMethod("Test"),
    new Ref(ref otRecordCnt),
    new Ref(ref otReturnCode),
    otStatusMsg,
    otDataHolder
  );
  otData = (Groups.Test.OtData[]) otDataHolder.array ;
}

#endregion
}
}

How would I return the array?

public class Service1 : System.Web.Services.WebService
{
   Service broker = new Service("BROKWEB");
    [WebMethod]
    public string RFS()
    {
        Brokweb b = new Brokweb(broker);
        decimal rec_cnt;
        decimal ret_cde;
        string msg;
        ArrayHolder return_data;
        RFS = b.Emsawrfs(out rec_cnt, out ret_cde, out msg, out return_data);
    }

I am getting:
Error 3 Argument ‘4’: cannot convert from ‘out SoftwareAG.EntireX.NETWrapper.Runtime.ArrayHolder’ to ‘out SoftwareAG.EntireX.NETWrapper.Generated.BROKWEB.Groups.Emsawrfs.OtData[]’ C:\Documents and Settings\JC19512\My Documents\Visual Studio 2008\Projects\WebService1\WebService1\Service1.asmx.cs 34 69 WebService1

Hi jcoigent,
could you open a service request? It’s probably easier then to get the questions answered.
Regards, Dietmar

This doesn’t look like a product problem, but more like a training requirement, so
another option, probably more appropriate would be to request a few days of mentoring/training from Global Consulting Services (ok, ok, yeah, I’m tooting our own horn, sorry).