# Reference extensible array in .NET web service

**URL:** <https://techcommunity.softwareag.com/t/reference-extensible-array-in-net-web-service/92611>\
**Category:** Forum\
**Tags:** Mainframe-Integration, EntireX\
**Created:** [January 26, 2010, 1:57am UTC](https://techcommunity.softwareag.com/t/reference-extensible-array-in-net-web-service/92611 "2010-01-26T01:57:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcoignet](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@jcoignet](https://techcommunity.softwareag.com/u/jcoignet)\
**Post date:** [January 26, 2010, 1:57am UTC](https://techcommunity.softwareag.com/t/reference-extensible-array-in-net-web-service/92611/1 "2010-01-26T01:57:36Z")

</div>

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](http://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.

---

<div class="post-metadata">

**Author:** ![Dietmar\_Gartner](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/dietmar_gartner/32/127_2.png) [@Dietmar\_Gartner](https://techcommunity.softwareag.com/u/Dietmar_Gartner)\
**Post date:** [January 26, 2010, 3:07pm UTC](https://techcommunity.softwareag.com/t/reference-extensible-array-in-net-web-service/92611/2 "2010-01-26T15:07:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jcoignet](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@jcoignet](https://techcommunity.softwareag.com/u/jcoignet)\
**Post date:** [January 27, 2010, 12:39am UTC](https://techcommunity.softwareag.com/t/reference-extensible-array-in-net-web-service/92611/3 "2010-01-27T00:39:47Z")

</div>

thanks! I will give that a try.

---

<div class="post-metadata">

**Author:** ![jcoignet](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@jcoignet](https://techcommunity.softwareag.com/u/jcoignet)\
**Post date:** [January 28, 2010, 1:05am UTC](https://techcommunity.softwareag.com/t/reference-extensible-array-in-net-web-service/92611/4 "2010-01-28T01:05:06Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Dietmar\_Gartner](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/dietmar_gartner/32/127_2.png) [@Dietmar\_Gartner](https://techcommunity.softwareag.com/u/Dietmar_Gartner)\
**Post date:** [January 28, 2010, 10:10pm UTC](https://techcommunity.softwareag.com/t/reference-extensible-array-in-net-web-service/92611/5 "2010-01-28T22:10:58Z")

</div>

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

```auto
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

---

<div class="post-metadata">

**Author:** ![Dietmar\_Gartner](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/dietmar_gartner/32/127_2.png) [@Dietmar\_Gartner](https://techcommunity.softwareag.com/u/Dietmar_Gartner)\
**Post date:** [January 28, 2010, 10:12pm UTC](https://techcommunity.softwareag.com/t/reference-extensible-array-in-net-web-service/92611/6 "2010-01-28T22:12:34Z")

</div>

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  
}  
}

---

<div class="post-metadata">

**Author:** ![jcoignet](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@jcoignet](https://techcommunity.softwareag.com/u/jcoignet)\
**Post date:** [February 3, 2010, 3:25am UTC](https://techcommunity.softwareag.com/t/reference-extensible-array-in-net-web-service/92611/7 "2010-02-03T03:25:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dietmar\_Gartner](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/dietmar_gartner/32/127_2.png) [@Dietmar\_Gartner](https://techcommunity.softwareag.com/u/Dietmar_Gartner)\
**Post date:** [February 4, 2010, 7:52pm UTC](https://techcommunity.softwareag.com/t/reference-extensible-array-in-net-web-service/92611/8 "2010-02-04T19:52:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [February 5, 2010, 11:13am UTC](https://techcommunity.softwareag.com/t/reference-extensible-array-in-net-web-service/92611/9 "2010-02-05T11:13:45Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:57pm UTC](https://techcommunity.softwareag.com/t/reference-extensible-array-in-net-web-service/92611/10 "2021-04-02T14:57:58Z")

</div>


