JVariant out

2010-07-29
2012-11-29
  • PDV PDVMIPV
    PDV PDVMIPV
    2010-07-29

    Hi

    I needo to call this function:

    HRESULT CreateIadsTimeArray( int RequestedPoints,  VARIANT* TimeArray ) ;

    I tried with this code:

    JIVariant varTimeArray = JIVariant.EMPTY_BYREF();

    dispatch.callMethodA("CreateIadsTimeArray", new Object{NDATA, varTimeArray});

    but a the end the variable varTimeArray don't contain the Array of Dispatch that it should be contains.

    Can you help me?

     
  • Hi,
         Please try JIVariant.OUT_IDISPATCH() .

    thanks,
    best regards,
    Vikram

     
  • PDV PDVMIPV
    PDV PDVMIPV
    2010-07-29

    I Tried with your suggestion, but I had the error below:

    Exception in thread "main" org.jinterop.dcom.impls.automation.JIAutomationException: Invalid callee.
            at org.jinterop.dcom.impls.automation.JIDispatchImpl.invoke(JIDispatchImpl.java:333)
            at org.jinterop.dcom.impls.automation.JIDispatchImpl.callMethodA(JIDispatchImpl.java:520)
            at org.jinterop.dcom.impls.automation.JIDispatchImpl.callMethodA(JIDispatchImpl.java:526)
            at org.jinterop.dcom.impls.automation.JIDispatchImpl.callMethodA(JIDispatchImpl.java:477)
            at test.Main.main(Main.java:86)
    Caused by: org.jinterop.dcom.common.JIRuntimeException: Invalid callee.
            at org.jinterop.dcom.core.JICallBuilder.readResult(JICallBuilder.java:1079)
            at org.jinterop.dcom.core.JICallBuilder.read(JICallBuilder.java:957)
            at ndr.NdrObject.decode(NdrObject.java:36)
            at rpc.ConnectionOrientedEndpoint.call(ConnectionOrientedEndpoint.java:137)
            at rpc.Stub.call(Stub.java:113)
            at org.jinterop.dcom.core.JIComServer.call(JIComServer.java:901)
            at org.jinterop.dcom.core.JIComServer.call(JIComServer.java:856)
            at org.jinterop.dcom.core.JIComObjectImpl.call(JIComObjectImpl.java:266)
            at org.jinterop.dcom.core.JIComObjectImpl.call(JIComObjectImpl.java:153)
            at org.jinterop.dcom.impls.automation.JIDispatchImpl.invoke(JIDispatchImpl.java:315)
            … 4 more
    Java Result: 1

     
  • Okay,  then please try OUTPARAMforType(IJIDispatch.class,true);

     
  • PDV PDVMIPV
    PDV PDVMIPV
    2010-07-29

    Below the error with the code  JIVariant varTimeArray = JIVariant.OUTPARAMforType(IJIDispatch.class, true);

    Exception in thread "main" org.jinterop.dcom.common.JIException: The stub received bad data. Please check whether the API has been called in the right way, with correct parameter formation.
            at org.jinterop.dcom.core.JIComServer.call(JIComServer.java:905)
            at org.jinterop.dcom.core.JIComServer.call(JIComServer.java:856)
            at org.jinterop.dcom.core.JIComObjectImpl.call(JIComObjectImpl.java:266)
            at org.jinterop.dcom.core.JIComObjectImpl.call(JIComObjectImpl.java:153)
            at org.jinterop.dcom.impls.automation.JIDispatchImpl.invoke(JIDispatchImpl.java:315)
            at org.jinterop.dcom.impls.automation.JIDispatchImpl.callMethodA(JIDispatchImpl.java:520)
            at org.jinterop.dcom.impls.automation.JIDispatchImpl.callMethodA(JIDispatchImpl.java:526)
            at org.jinterop.dcom.impls.automation.JIDispatchImpl.callMethodA(JIDispatchImpl.java:477)
            at test.Main.main(Main.java:86)
    Caused by: rpc.FaultException: Received fault. (unknown)
            at rpc.ConnectionOrientedEndpoint.call(ConnectionOrientedEndpoint.java:141)
            at rpc.Stub.call(Stub.java:113)
            at org.jinterop.dcom.core.JIComServer.call(JIComServer.java:901)
            … 8 more
    Java Result: 1

     
  • Okay, do you have a native sample ? We can have a look at the Wireshark capture.

     
  • PDV PDVMIPV
    PDV PDVMIPV
    2010-07-29

    Unfortunally I don't have the source code of the DLL.

    The test was made with a special simplification of the dll.

    I have the DLL that i really need to use.
    This DLL works perfectly with J-Integra,
    if you want, I can send to you the dll and java code that use in java with j-integra?

    About the Wireshark I don't know how I can use it, the dll that I call is localized locally in my machine.

    Thanks

     
  • Okay , please send the code to the support address.

    thanks,
    best regards,
    Vikram

     
  • PDV PDVMIPV
    PDV PDVMIPV
    2010-08-02

    I sent to you the DLL and my code at address: vikramrc@users.sourceforge.net

    Do you recive it?

     
  • PDV PDVMIPV
    PDV PDVMIPV
    2010-09-29

    Any news regarding the problem ?

     
  • wmiquest
    wmiquest
    2011-06-20

    How to pass in and out method parameters to a method call?

    Example:

    void CheckPasswordExist( string Command, uint32 ReturnCode , uint32 PasswordExists);

    Here I have to set a value for in parameter Command.
    Output will be passed to password exists.

    I tried with this code:
    JIString cmd = new JIString("Admin");

    JIVariant result = dispatch.callMethodA("CheckPasswordExist", new Object {
                                                                                                                         new JIVariant(cmd),
                                                                                                                         new JIVariant("ReturnCode", true),
                                                                                                                         new JIVariant(""PasswordExists", true)
                                                                                                                   }
                                                                                                             );

    Is this correct way of passing in and out parameters?

     
  • Hi,
         Please have a look at JIVariant Javadocs for Out params.

    thanks,
    best regards,
    Vikram

     
  • wmiquest
    wmiquest
    2011-06-22

    Where can i find the documentation for JIVariant Javadocs?