IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Reference extensible array in .NET web service

  • 1.  Reference extensible array in .NET web service

    Posted Mon January 25, 2010 08:58 PM

    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.


    #Mainframe-Integration
    #webMethods
    #EntireX


  • 2.  RE: Reference extensible array in .NET web service

    Posted Tue January 26, 2010 10:08 AM

    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


    #Mainframe-Integration
    #EntireX
    #webMethods


  • 3.  RE: Reference extensible array in .NET web service

    Posted Tue January 26, 2010 07:40 PM

    thanks! I will give that a try.


    #EntireX
    #webMethods
    #Mainframe-Integration


  • 4.  RE: Reference extensible array in .NET web service

    Posted Wed January 27, 2010 08:05 PM

    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!


    #Mainframe-Integration
    #EntireX
    #webMethods


  • 5.  RE: Reference extensible array in .NET web service

    Posted Thu January 28, 2010 05:11 PM

    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


    #webMethods
    #Mainframe-Integration
    #EntireX


  • 6.  RE: Reference extensible array in .NET web service

    Posted Thu January 28, 2010 05:13 PM

    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 : <use>
    */
    #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</use>

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


    #Mainframe-Integration
    #webMethods
    #EntireX


  • 7.  RE: Reference extensible array in .NET web service

    Posted Tue February 02, 2010 10:25 PM

    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


    #webMethods
    #EntireX
    #Mainframe-Integration


  • 8.  RE: Reference extensible array in .NET web service

    Posted Thu February 04, 2010 02:53 PM

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


    #EntireX
    #webMethods
    #Mainframe-Integration


  • 9.  RE: Reference extensible array in .NET web service

    Posted Fri February 05, 2010 06:14 AM

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


    #EntireX
    #webMethods
    #Mainframe-Integration