This discussion is archived
8 Replies Latest reply: Jun 28, 2011 11:06 AM by 801819 RSS

Connect from EJB via JATMI to a tuxedo service develop by Service Builder

801819 Newbie
Currently Being Moderated
Hi folks,

In first place, I'm newbie in Tuxedo. I'm Java developer and have basic English.

I have invested a lot of time to try to connect from a EJB via JATMI (using WTC ) to a Tuxedo service develop with Service Builder 2.8. I read the tutorial but have a very simple example and don't work in my case because I must pass to the service structs. I show some code:

IDL (use by Service Builder to generate stubs and skeletons files in c)

[
service_name(MY_TUXEDO_SERVICE),
version(automatic)
]
void Service(
     [in,string]char Cod[N]
     ,[in,char]char otherCod
     ,[in,out]DateTime *aDate
     ,[in, out] short * num_Items
     ,[out, size_is(num_Items)]structs::st_MYTUXEDO_SERVICE *aList;);

This IDL generate varios files. For example the stub (a .cpp) have an empty method where C developers put the logic:

void Service::Implementation(
               Ubyte Cod[N], Ubyte otherCod
               , DateTime * aDate, Int16 * num_Items
               , NAMESPACE(structs)st_MYTUXEDO_SERVICE * aList               
               )



I read the doc and know that Service Builder use FML32. Service Builder is a tool to simplify the develop services that use ATMI Api. Service builder doesn't exist in google, I can't find documentation on this tool.

Well, in this context, can we give some guideline? I discover the class weblogic.wtc.jatmi.mkfldclass32 that can help me to create a table FML32.

Another question is, how can i pass a struct to a tuxedo service, for example DateTime or st_MYTUXEDO_SERVICE ??.

Best regards,
Juan
  • 1. Re: Connect from EJB via JATMI to a tuxedo service develop by Service Builder
    Todd Little Expert
    Currently Being Moderated
    Hi Juan,

    I believe Service Builder is a tool from GFI and not Oracle.

    Structs in Tuxedo are typically passed in VIEW or VIEW32 buffers. A VIEW/VIEW32 buffer essentially maps directly to a C struct. The layout of the VIEW/VIEW32 buffer is defined in something called a view file. This file contains a description of the fields contained in the view including their name, type, number of occurrences, etc. To use a VIEW buffer with WTC you need to use the weblogic.wtc.jatmi.viewj or weblogic.wtc.jatmi.viewj32 to create a class that represents the VIEW buffer. The class is essentially a bean with a set of accessors that are used to set and get the fields of the VIEW buffer. You should be able to find these tools described in the WTC documentation.

    With FML32 buffers, you can have fields that are themselves Tuxedo buffers such as FML32 or VIEW32 buffers. So you should still be able to use FML32 buffers, but define one of the fields to be a VIEW32 buffer. Create the VIEW32 buffer with the normal WTC APIs, populate the bean, and then add the bean to the FML32 buffer again using the WTC APIs.

    Regards,
    Todd Little
    Oracle Tuxedo Chief Architect
  • 2. Re: Connect from EJB via JATMI to a tuxedo service develop by Service Builder
    801819 Newbie
    Currently Being Moderated
    Thanks a lot Todd for your time!! I will investigate about this and I will comment the results here.
  • 3. Re: Connect from EJB via JATMI to a tuxedo service develop by Service Builder
    801819 Newbie
    Currently Being Moderated
    Hi Todd,

    I'm having a problem to make FML32 in java with mkfldclass32 if i must mapp a structure with no simple type fields. For example I have this structure:

    struct foo {

    int a;
    foo2 b;

    }

    struct foo2{
    char v;
    }

    How I can generate a fml32 buffer to this structure? There are no documentation (or I can't found) about use mkfldclass32 with this complex (very common) .

    Regards,
    Juan
  • 4. Re: Connect from EJB via JATMI to a tuxedo service develop by Service Builder
    Todd Little Expert
    Currently Being Moderated
    Hi Juan,

    I would map that structure to a VIEW or VIEW32 buffer as that would be a more natural mapping. As to how it's mapped to FML32 then the mapping depends upon what the Tuxedo service wants to see. It could want to see an FML32 with fields:

    Name Type
    a long
    b view32
    v char

    or

    a long
    v char

    or many other ways. The issue is that FML/FML32 buffers are more like hash maps and not really like structures. VIEW and VIEW32 buffers are used to represent structures where the ordering/placement of fields is important.

    So to construct the buffer on the Java side with WTC, you need to know what the Tuxedo service is actually expecting. My guess is that is the former, which means you'll need to define a VIEW or VIEW32 buffer and use the viewj or viewj32 classes to create the VIEW/VIEW32 class and as well you need to create a field table that defines the a and b fields where the b field is of type VIEW or VIEW32 and then compile the field table with mkfldclass or mkfldclass32.

    Regards,
    Todd Little
    Oracle Tuxedo Chief Architect
  • 5. Re: Connect from EJB via JATMI to a tuxedo service develop by Service Builder
    801819 Newbie
    Currently Being Moderated
    Hi,

    I'm continuous try but can't communicate. I discover some thins.

    1) ServiceBuilder generate some files that have information about the buffers that use, for example the buffer is like this:

    # Identificadores para el servicio foo
    # INICIO DE SERVICIO foo
    #foo_CodGrupo          0     string     -     -
    #foo_ListarPasado          1     carray     -     -
    #foo_IndBaja          2     carray     -     -
    #foo_Fec_Insercio          3     carray     -     -
    #foo_num_Items          4     short     -     -
    #foo_stListGrupoLista          5     carray     -     -
    #foo_UsuarioAlta          6     string     -     -
    # FIN DE SERVICIO foo

    The IDL of the service is:

    #[
    # service_name(foo),
    # version(automatic)
    #]
    # void foo(
    #      [in,string]char CodGrupo[N]
    #     ,[in,char]char ListarPasado
    #     ,[in,char]char IndBaja
    #     ,[in,out] DateTime *Fec_Insercio
    #     ,[in, out] short * num_Items
    #     ,[out, size_is(num_Items)]structs::aStruct *stListGrupoLista
    #     ,[in,string]char UsuarioAlta[N]);


    So I generate the next FML table:

    #FML
    # Fields for database bankdb
    # name                          number type flags comments
    foo_CodGrupo          0     string     -     -
    foo_ListarPasado          1     carray     -     -
    foo_IndBaja          2     carray     -     -
    foo_Fec_Insercio          3     carray     -     -
    foo_num_Items          4     short     -     -
    foo_stListGrupoLista          5     carray     -     -
    foo_UsuarioAlta          6     string     -     -
    #END

    Compile with mkfldclass32 and generate this source file:
    public final class foo
         implements weblogic.wtc.jatmi.FldTbl
    {
         Hashtable nametofieldHashTable;
         Hashtable fieldtonameHashTable;
         /** number: 0 type: string */
         public final static int foo_CodGrupo = 167772160;
         /** number: 1 type: carray */
         public final static int foo_ListarPasado = 201326593;
         /** number: 2 type: carray */
         public final static int foo_IndBaja = 201326594;
         /** number: 3 type: carray */
         public final static int foo_Fec_Insercio = 201326595;
         /** number: 4 type: short */
         public final static int foo_num_Items = 4;
         /** number: 5 type: carray */
         public final static int foo_stListGrupoLista = 201326597;
         /** number: 6 type: string */
         public final static int foo_UsuarioAlta = 167772166;

    ....

    Then in an ejb I try to communicate with the service:

    public void ping() throws Exception {

         Reply myRtn;
         
         TuxedoConnection myTux;

         TypedFML32 input;
         
         myTux = tcf.getTuxedoConnection();

         try {
         input = new TypedFML32(new foo());
         //input.Fadd(foo.foo_CodGrupo, "grup");
         //TypedCArray fecha = new TypedCArray();
         //fecha.setSendSize(2);
         //input.Fadd(foo.foo_Fec_Insercio, fecha);
         log("About to call tpcall");
         myRtn = myTux.tpcall("foo", input, 0);
         } catch (TPReplyException tre) {
         log("tpcall threw TPReplyExcption " + tre);
         throw tre;
         } catch (TPException te) {
         log("tpcall threw TPException " + te);
         throw te;
         } catch (Exception ee) {
         log("tpcall threw exception: " + ee);     
         throw new TPException(TPException.TPESYSTEM, "Exception: " + ee.getMessage());
         }
         log("tpcall successfull!");

         myTux.tpterm();// Closing the association with Tuxedo

    }


    This code generate this TUXEDO log:

    ******* Run time exception information begins ****
    When: Fri Jun 24 17:37:22 2011
    Where: TUX_FMLBuffer::in
    What: LIBFML_CAT:5: ERROR: Unknown field number or type
    Why: Field number: 0
    Subsystem code:10008,Error code:5
    ******* Run time exception information ends *****

    And this WLS log: (Paste at final)...

    How can I do to work this code?

    2) I'm reading the documentation and I found in http://download.oracle.com/docs/cd/E21764_01/web.1111/e13723/xml_fml.htm#i1104716 that I have add a Resource. So I try add in WLS "Home >Summary of WTC Servers >WTCServer-0 >Summary of WTC Servers >WTCServer-0" add a Resource. In field FldTbl32 classes: the complete class name, but WLS show me an error:

    [WTC:180022]Could not set up thefield table information for TDMResources: Class loader problem with: com.foo.services.stubs.foo.

    I paste the class in lib folder and don't work and have the stub in my EAR too. How can I put the FML32 table?


    3) If in my code uncomment this:

    //input.Fadd(foo.foo_CodGrupo, "grup");
         //TypedCArray fecha = new TypedCArray();
         //fecha.setSendSize(2);
         //input.Fadd(foo.foo_Fec_Insercio, fecha);

    I have another error: "tpcall threw exception: Unknown fldid32: 167772160"

    oh! Why this?

    Final:

    I know is a very long post, but I try put the major information possible. Can someone help me with this? Thanks Todd for your information.


    LOG WLS: I can't past complete, exceeds 30000 characters this post if I copy complete.

    ...
    <Jun 24, 2011 12:40:45 PM GMT-03:00> <Info> <WTC> <BEA-180046> <[/TuxRply/get_specific_reply/SessionAcallDescriptor:2:false/weblogic.wtc.gwt.gwdsession@0/true>
    <Jun 24, 2011 12:40:45 PM GMT-03:00> <Info> <WTC> <BEA-180046> <TuxRply/get_specific_reply: Thr Thread[[ACTIVE] ExecuteThread: '20' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads] waiting for message oid SessionAcallDescriptor:2:false/weblogic.wtc.gwt.gwdsession@0 on lockReq = weblogic.wtc.jatmi.TuxRply$LockReq@8602ca>
    ...
    <Jun 24, 2011 12:40:45 PM GMT-03:00> <Info> <WTC> <BEA-180046> </rdsession(0)/dispatch/TdomTcb=TDOM:GWNW_XATMI_FAILURE:2:-1:9:40:1:0:11:0:1966080000:0:null>
    ...
    <Jun 24, 2011 12:40:45 PM GMT-03:00> <Info> <WTC> <BEA-180046> <*]/dsession(0)/tpcall/20/TPESVCFAIL(11):0:0:Unknown(1966080000):QMNONE(0):0>
    tpcall threw TPReplyExcption TPESVCFAIL(11):0:0:Unknown(1966080000):QMNONE(0):0
  • 6. Re: Connect from EJB via JATMI to a tuxedo service develop by Service Builder
    801819 Newbie
    Currently Being Moderated
    I found bulk file:

    service=foo
    export=true
    inbuf=FML32
    outbuf=FML32
    param=__rpr_srv_name__
    type=string
    access=inout
    param=__rpr_srv_version__
    type=integer
    access=in
    param=__rpr_srv_flags__
    type=integer
    access=in
    param=__rpr_srv_processid__
    type=integer
    access=in
    param=__rpr_srv_hostip__
    type=carray
    access=in
    param=__rpr_srv_tranid__
    type=string
    access=in
    param=__rpr_srv_executionid__
    type=integer
    access=in
    param=__rpr_srv_sequence_length__
    type=integer
    access=in
    param=__rpr_srv_sequence__
    type=carray
    access=in
    param=__rpr_srv_size_in__
    type=integer
    access=in
    param=__rpr_srv_transactionName__
    type=string
    access=in
    param=__rpr_cli_dttm__
    type=carray
    access=in
    param=foo_CodGrupo
    type=string
    access=in
    param=foo_ListarPasado
    type=carray
    access=in
    param=foo_IndBaja
    type=carray
    access=in
    param=foo_Fec_Insercio
    type=carray
    access=inout
    param=foo_num_Items
    type=short
    access=inout
    param=foo_UsuarioAlta
    type=string
    access=in
    param=__rpr_excp_subsystem__
    type=integer
    access=out
    param=__rpr_excp_errcode__
    type=integer
    access=out
    param=__rpr_excp_what__
    type=string
    access=out
    param=__rpr_excp_where__
    type=string
    access=out
    param=__rpr_excp_why__
    type=string
    access=out


    I need generate the FML field with all inputs data?
  • 7. Re: Connect from EJB via JATMI to a tuxedo service develop by Service Builder
    Todd Little Expert
    Currently Being Moderated
    Hi Juan,

    Yes, you will need to generate an FML32 buffer with the "in" and "inout" parameters. Most of them appear to be simple types, but some are given as carray. These may be problematic as you need to know how the bytes are supposed to be placed in the carray fields. For example:

    param=__rpr_cli_dttm__
    type=carray
    access=in

    Indicates that the parameter __rpr_cli_dttm__ is a FLD_CARRAY type field. The issue is that it tells you nothing about the contents of the CARRAY as CARRAYs are opaque to Tuxedo. My guess is that it is a date/time just based upon the name, but there are numerous ways to encode date and time information.

    Is GFI unable to help you with this?

    Regards,
    Todd Little
    Oracle Tuxedo Chief Architect
  • 8. Re: Connect from EJB via JATMI to a tuxedo service develop by Service Builder
    801819 Newbie
    Currently Being Moderated
    Thanks Todd again!! You are very helpful.

    Ok, I will try pass all the input information. About carray types you said that is obscure. I will investigate this params and try contact to GIF too. I will research much. If I can resolve it, I post here the solution.

    Another issue that I have is this (previus post):

    3) If in my code uncomment this:

    //input.Fadd(foo.foo_CodGrupo, "grup");
    //TypedCArray fecha = new TypedCArray();
    //fecha.setSendSize(2);
    //input.Fadd(foo.foo_Fec_Insercio, fecha);

    I have another error: "tpcall threw exception: Unknown fldid32: 167772160"

    oh! Why this?

    What's the error? I generate the .java with the FML table. I continue investigate JATMI API.

    Thanks Todd for your time

    Regards,
    Juan

    Edited by: Gardella Juan on Jun 28, 2011 11:06 AM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points