About object returned by a java callout

Hi all,
I'm doing a java callout to a method like this
public static ResultVO send(final String ...)
where ResultVO is a simple value object that includes two fields:
private int msgId;
private String timestamp;
In ALSB I'm trying to trace simply the contents of the object using a log action with $resultVO statement.
Here what I see on ALSB log file:
... REQUEST] DEBUG: <ctx:java-content ref="jcid:-7643e517:119b82c761f:-7fd0" xmlns:ctx="http://www.bea.com/wli/sb/context"/>>
I tried also with string($resultVO) but in that case I don't see anything.
Does a java callout has to return only primitive types or only void or what are the restrictions on java callout returned values ?
Thanks
ferp

Hi,
I've already tried with your suggested option 1):
public class ResultVO implements Serializable { ...
the static method invoked by ALSB in the java callout action:
public static ResultVO send(
final String ...,
final String ...,
final String ...,
final XmlObject msg)
throws FailureException { ...
and in ALSB I've assigned the returned value to the result variable.
When I log the result variable I see only:
... DEBUG messag : <con:java-content ref="jcid:102f2086:119b93e49d2:-7fd0" xmlns:con="http://www.bea.com/wli/sb/context"/>>
and not the string form of the value that the object represents.
How can I access to VO members, say for e.g. result.getTimestamp() ?
Thanks
ferp

Similar Messages

  • Can i return an Array of Objects from c++ to java ??

    hello all,
    Can i return an Array of Objects from c++ to java ??
    If so how is it possible ??
    regards,
    gautam

    I suggest you look into the JNI, Java Native Interface. The answer is yes.

  • How to Create a connection pool in OSB java callout

    Dear Team,
    In our project, we need read some data from DB, and do corresponding operation. currently, we need setup the connection first, execute the SQL, and close the connection.
    But the concurrency of call is very high, is there a way to create a connection pool, then we can use the connection pool to get the connection and execute the SQL, then return the connection to the pool.
    if connection pool is not available, is there any way to create the connection outside the java callout, that we can just execute the SQL in java callout.
    The OSB version is 11.1.1.6.0
    Thanks.
    Best Regards,
    Raysen Jia
    Edited by: Raysen Jia on Oct 16, 2012 8:44 AM

    Hi Team,
    Thanks for your help.
    What I need is not only the db connection, may be other kind of things, such as read configuration from file...
    If I write the code in java callout with static java method to create and close the connection, each time when request come in, OSB will create a new connection (or read the file), I think it's not the best practice to do this kind of work.
    I think the weblogic is running in JVM, is there any way we can define variables or new object in the JVM directly?

  • Unable to access Custom UDTs returned from a Java Stored Procedure

    Hi,
    I have a UDT in the DB :-
    create type contactrecord as object (
    CN_ID NUMBER(8),
    CN_TITLE VARCHAR2(40),
    CN_FIRST_NAME VARCHAR2(25)
    and this is the corresponding java class ContactDetails.java that maps to this UDT, that I loaded in the Aurora VM.
    package package1;
    mport java.sql.SQLData;
    import java.sql.SQLException;
    import java.sql.SQLInput;
    import java.sql.SQLOutput;
    public class ContactDetails implements SQLData
    private String sql_type;
    private long CN_ID;
    private String CN_TITLE;
    private String CN_FIRST_NAME;
    public String getSQLTypeName() throws SQLException
    return this.sql_type;
    //implementation of readSql
    public void readSQL(SQLInput stream, String typeName) throws SQLException
    sql_type = typeName;
    CN_ID = stream.readLong();
    CN_TITLE = stream.readString();
    CN_FIRST_NAME = stream.readString();
    public void writeSQL(SQLOutput stream) throws SQLException
    stream.writeLong(CN_ID);
    stream.writeString(CN_TITLE);
    stream.writeString(CN_FIRST_NAME);
    //getters and setters for the class vars go here.....
    There is another class A.java that has a java stored procedure/function, which I loaded into the Aurora VM
    Here is the class.
    package package1;
    public class A
    public static ContactDetails returnObject(String name )
         ContactDetails cd = new ContactDetails();
         cd.setCN_ID(1);
    cd.setCN_FIRST_NAME(name);
    return cd;
    Then I declared the call spec for A.returnObject() as
    FUNCTION returnObject(name varchar2) return contactrecord
    AS LANGUAGE JAVA
    NAME 'package1.A.returnObject(java.lang.String) return package1.ContactDetails';
    Then I tried to call the function returnObject through JDBC calls from a class in another VM.
    When I access the object returned by the function, I get a null object.
    Here is the Client code:
    CallableStatement cs = null;
    ResultSet rs = null;
    try
    cs = conn.prepareCall("{ ? = call returnObject(?) }");
    java.util.Map map = conn.getTypeMap();
    map.put("ADMIN.CONTACTRECORD", Class.forName("package1.ContactDetails"));
    conn.setTypeMap(map);
    cs.registerOutParameter(1, OracleTypes.STRUCT, "ADMIN.CONTACTRECORD");
    cs.setString(2, "John Doe" );
    cs.execute();
    ContactDetails cd = (ContactDetails)cs.getObject(1);
    System.out.println("contact first name is:-"+cd.getCN_FIRST_NAME()); //Null Pointer here..cd is null....:(
    if (cs != null) cs.close();
    catch(Exception e)
    e.printStackTrace();
    Although If I try to access the same function from a pl/sql block, I am able
    to access the contactrecord fields.
    What could be wrong ..???
    I could not find any error with the object mapping, as it works perfectly when I interact directly from my VM to the DB,
    without going thru the aurora VM.
    I am using a OCI driver to connect to the DB via JDBC.
    Thanx in advance for any help at all.
    -sk

    Shahid,
    I too have had bad luck in many cases with the automatic translation of Java types to PL/SQL and back. I think the SYS package on the PL/SQL side which handles some of the conversion is DBMS_PICKLER (there are equivalent Java classes which do the same in that world and seem to execute automagically when a conversion is needed). You might want to double-check the data type mappings against the DOC on OTN to make sure they map 1-1. Also make sure the permissions are granted against your objects to whoever is executing them, etc. Very often, I've resorted to passing simple scalar types between the two languages as in some cases the results with complex types are inconsistent.
    Sorry this isn't much help,
    -Dan
    http://www.compuware.com/products/devpartner/db/oracle_debug.htm
    Debug PL/SQL and Java in the Oracle Database

  • How to get return value from java and read by other application?

    i want to read return value from java and the other application read it.
    for example:
    public class test_return {
        test_return(){
        public int check(){
            return 1;
        public static void main(String args[]){
           new test_return().check();
    }from that class i make as jar file. How to read the return value (1) by other application?
    thx..

    If your installer is requiring some process it invokes to return a particular value on failure, then the installer is seriously broken. There are a bazillion commands your installer could invoke, and any of them could fail, which in turn could invalidate the entire install process, and any of them could return any value on failure. The only value that's consistent (in my experience) is that zero means success and non-zero means failure, with specific non-zero values being different in different programs.
    About the only control you have over the JVM's exit code is that if your main method completes without throwing an exception, the JVM will have an exit code of 0, and if main throws an exception (either explicitly or by not catching one thrown from below), it will be non-zero. I'm not even sure if that's guaranteed, but I would guess that's the case.
    EDIT: I'm kind of full of crap here. If you're writing the Java code, you can call System.exit(whatever). But nonetheless, if your installer requires certain exit codes from any app--java or otherwise--you have a problem.
    Edited by: jverd on Oct 29, 2009 1:27 AM

  • Java Callout with Collections in OSB

    I need return a collection (List) in Java Callout Action, i recive only this content in any variable:
    <con:java-content ref="jcid:15906698:135e486b745:-7f91" xmlns:con="http://www.bea.com/wli/sb/context"/>
    how i do for read or convert to list in OSB message flow ?
    my escenary is, excecute un method in java callout, this method recive a colection and return a collection. i cant view estructur in message flow. only view <con:java-content.....
    can any help me?
    I need your help.
    Regards
    [email protected]

    http://docs.oracle.com/cd/E13159_01/osb/docs10gr3/eclipsehelp/ui_ref.html#sj_uiSplitJoinJavaCalloutProperties
    try returning an Array, it seems more supported than a List :o)

  • Reusable objects using web dynpro java...any suggestions ?

    Hello All,
    I want to create few Reusable objects using web dynpro java. Please suggest some scenarios.
    regards
    Mrinalini.

    Hi,
    I can suggest especially this one:
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/30d56578-f7e5-2a10-5ab5-8afc55d2e0e8
    Some other hits you may find useful:
    This guide mentions some tutorials about reusability:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/ba2db0e5-0601-0010-9790-e271902f2c38?quicklink=index&overridelayout=true
    Here
    Web Dynpro Java [original link is broken]
    and here
    SAP NetWeaver Composition Environment Samples Center [original link is broken]
    you'll find other tutorials as well.
    Best Regards,
    Ervin

  • ALSB / OSB Java callout to gunzip

    We have an input file which is in a gz format, which we need to gunzip before passing onto our business service.
    We're writing a simple Java callout component to do this - taking an input stream and returning an output stream.
    What variable should I pass into my input stream from the callout in the proxy service message flow?
    I've tried $body and $input, but neither of these work.
    Thanks in advance
    Phil Riley

    Have tried logging to output, and this is what I get:
    $attachments[0]/ctx:attachment/ctx:body - empty
    $body
    <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <con:binary-content ref="cid:2a96c6b3:12da3c4b844:-7f3c" xmlns:con="http://www.bea.com/wli/sb/context"/>
    </soapenv:Body>
    $inbound
    <con:endpoint name="ProxyService$FredhopperExtract$ProxyServices$Test GZip" xmlns:con="http://www.bea.com/wli/sb/context">
    <con:service/>
    <con:transport>
    <con:uri>file:////apps/bea/dp_tmp</con:uri>
    <con:mode>request</con:mode>
    <con:qualityOfService>best-effort</con:qualityOfService>
    <con:request xsi:type="file:FileRequestMetaData" xmlns:file="http://www.bea.com/wli/sb/transports/file" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <tran:headers xsi:type="file:FileRequestHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">
    <file:fileName>/apps/bea/dp_tmp/test.txt.gz</file:fileName>
    </tran:headers>
    <tran:encoding xmlns:tran="http://www.bea.com/wli/sb/transports">utf-8</tran:encoding>
    <file:isFilePath>false</file:isFilePath>
    </con:request>
    </con:transport>
    <con:security>
    <con:transportClient>
    <con:username>&lt;anonymous></con:username>
    </con:transportClient>
    </con:security>
    </con:endpoint>
    None of these actually have the contents of the message - the $body is the closest which tells me that it is binary and has a ref.

  • Invoke DBAdapter from Java Callout

    Hello,
    in OSB I need to invoke a DB-Adapter from a Java Callout. How can I achieve this?
    I cound not find any documentation about this (javadoc etc).
    Horst

    Ideally you should not need to access DB adapter from a Java callout. Use java callout for transformations, get back the transformed data, and call a business service based on DB Adapter.
    Alternatively, call java callout and make write code in Java to access DB directly using Weblogic datasource and connection pool.
    And if you dont want to do it any other way, create a business service based on the said DB Adapter, create a wrapper proxy(which internally calls the DB adapter based business service) of Any XML type with HTTP transport or even a WSDL based webservice, and call this from your Java code.

  • ALSB - Java Callout (.jar using commons-httpclient-3.1)

    Hello everyone,
    I'm having a not so funny problem.
    I made a Java class, that will be called by a Proxy Service (Java callout). I'm using the commons.httpclient-3.1.jar (+ codec and logging).
    Here's the code:
    package util.http;
    import org.apache.commons.httpclient.HttpClient;
    import org.apache.commons.httpclient.methods.*;
    public class UtilitaireHTTP {
    // method used by the Proxy Service
    public static String getLastModified (String url){
    return getHeader(url,"last-modified");
    private static String getHeader(String url, String header){
    HttpClient client = new HttpClient();
    String lastModified = "404";
    HeadMethod head = new HeadMethod(url);
    try {
    //not working
    /*int statusCode = client.executeMethod( head );
    if (statusCode == 200){
         lastModified = head.getResponseHeader(header).getValue();
    //working
    lastModified = "200";
    catch(Exception e){
         System.out.println(e);
    finally {
    // release any connection resources used by the method
    head.releaseConnection();
    return lastModified;     
    Here's the problem: Whenever I remove the comment block, test it (it's going to work with JUnit), create a JAR. Import it into ALSB jar resources folder. When I do a Java Callout in a Proxy Service I won't be able to see my method getLastModified. If I put that block in comment, re-do all the export import, I'll see the method in the list.
    //not working
    /*int statusCode = client.executeMethod( head );
    if (statusCode == 200){
         lastModified = head.getResponseHeader(header).getValue();
    //working
    lastModified = "200";
    Anyone knows the solution or problem.
    Thank you!
    Van

    While playing with java callouts i've built working "groovy callout" sample. This way you can keep logic in your alsb proxy service rather than in jar file. Have a look. http://blog.aujava.com/?p=64

  • EJB3 Stateful:ClassCastException when casting the object returned in lookup

    Hi,
    I'm developing a web application that make use of EJB3 stateless and stateful beans. The application server is the Websphere Application Server 6.1.0.15 with the EJB3 Feature Pack installed and the web server is the IBM HTTP Server running in another machine.
    The problem I'm facing is that for every stateful bean after the lookup, it throws a ClassCastExcption when casting the object returned. See part of the log below.
    [7/13/08 3:15:48:869 CDT] 0000001c SystemErr R java.lang.ClassCastException: cannot cast class com.spcs.dsa.ejb.authenticationmanager._AuthenticationManager_Stub to class com.spcs.dsa.ejb.authenticationmanager._AuthenticationManager_Stub
    at com.ibm.rmi.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:396)
    at com.spcs.dsa.ejb.client.DsaEjbClient.getAuthenticationRemote(DsaEjbClient.java:37)
    at com.spcs.dsa.action.NewCardAction.execute(NewCardAction.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    Please notice in the log above that the cast was done for the correct class.
    Here is the java code:
    AuthenticationManager auth =
    (AuthenticationManager) javax.rmi.PortableRemoteObject.narrow(
    context.lookup("com.spcs.dsa.ejb.authenticationmanager.AuthenticationManager"),
    AuthenticationManagerStub.class);
    This problem doesn't happen for statless beans. If you simply change the class to be stateless, this problem stop to happen.
    If you run this code in a stand alone program, this problem doesn't happen. It only happen when running in the web server.
    Does anybody know what should be done to solve this problem ??
    Thanks,
    Marcos.

    I'm not familiar with any specifics of IBM's implementation but from an EJB 3 spec perspective there is no need to use PortableRemoteObject.narrow() if you're retrieving an EJB 3.0 Remote Business interface, regardless of the component type( stateful vs. stateless). In addition, the "_Stub" class should never have to be part of your client programming model. That should be hidden within the vendor's implementation, if present at all.
    If AuthenticationManager is the Remote 3.0 Business Interface
    @Remote
    public interface AuthenticationManager {
    your client lookup should be :
    AuthenticationManager am = (AuthenticationManager) context.lookup("...");

  • Pass an ArrayList of objects from C++ to JAVA using JNI

    Hello,
    I need to get the running Windows processes using C++ and have a Process struct in C++ having 2 fields: name and pid. I want to pass an ArrayList of Process from C++ to Java. I have found an example of how to pass an array of objects from C++ to Java, but I'd like to pass an ArrayList, and I was wondering if this is possible, before understanding that example and use an array.
    I don't have much experience with C++ and I don't even know if you have something like an ArrayList in C++, so I'm sorry if it doesn't make any sense what I'm talking about. Thank you.

    From C you can access and/or imnstantiate one of the
    java collections. In other words, your C code should
    simply populate java structures and a collection.I have read this is possible after I posted this, but didn't find an example yet. I began reading "Java Native Interface" book from Addison-Wesley today to get a better understanding of JNI.
    If you know where to find an example of doing this, I would appreciate it. Otherwise, I suppose I will find this in the above mentioned book quite soon... Thank you.

  • Java callouts from bpel  - 11g

    I had Oracle Soa Suite 10.1.3 with Toplink/WSIF. I used to generate classes using bpel/schemac and place them in systems/classes directory.
    But we migrated to Oracle Soa suite 11g. In 11g we don't see bpel folder. Are there any examples to handle the above in 11g?
    Questions are:
         Where is schemac located?
         Where should the generated classes go?
         How can I use java callouts from bpel?
         Where can I examples?

    Hello globo,
    if you have a synchronous process you simple use
    NormalizedMessage nmRet = deliveryService.request(processName, processMethod, normalizedMessage);
    nmRet.getPayload();
    And here you have the payload of your return.
    For callbacks and values from an asynchronous process have a look at clemens' blog:
    http://clemensblog.blogspot.com/2006/04/bpel-implementing-async-callback-with.html
    Greets Jens

  • Java Callout-how can we pass certain type other then primitives

    Hi,
    I have a java method: void which accepts a message of certain type (bean with various properties i.e. LogType) which i want to invoke from the java call out method. I already have jar in the resources and can select the method but cannot figure out what to add in the 'Expression' for the input type
    XSD:
    <xs:element name="ErrorLog" type="log:ErrorLogType">
    <complexType name="ErrorLogType">
    <sequence>
    <element name="error" type="string"/>
    </sequence>
    </complexType>
    in the Java call out section i can select the method
    Name section: com.package.ErrorLogType
    Expression: <what to go here?> I have tried the following
    <ns:ErrorLog xmlns:ns="http://my.name.space/error">
    <ns:error>some error </ns:error> or <error>some error</error>
    </ns:ErrorLog>
    i have confirmed the package name of the generate types already which is correct.
    I have already added the schema in the schema in namespace definition in Xquery Expression Editor
    Thanks!
    Edited by: sallo on Sep 8, 2009 4:58 PM

    http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/userguide/context.html --- how to pass java objects to java callouts is documented in Java Content in the body Variable
    The content can be passed to another appropriate action (like Java callout) as a variable (for example, $pojo). The object itself is not touched. The argument is automatically de-referenced to the actual object.
    Manoj

  • Should I use the object returned from em.merge()

    I am still confused how to use em.merge() correctly. I need to know if I should use the result of em.merge().
    PersistentObject obj = new PersistentObject();
    obj.setSomething("Value#1");
    // Should I do this and continue to use the object returned from merge().
    obj = em.merge(obj);
    obj.setSomething("Value#2");

    Chris,
    First thanks for your and your teams awesome support.
    The reason I always get confused with merge() is my misunderstanding about how clones and caching are handled. Let me give you 2 scenerios and could you tell me what the problems are, is any?
    Scenerio #1: (using return from merge)
    -- Start of Transaction #1
    EntityObject obj = new EntityObject();
    obj.setName("chris");
    obj = em.merge(obj);
    -- End of Transaction #1
    -- Start of Transaction #2
    obj.setName("scott");
    obj = em.merge(obj);
    -- End of Transaction #2
    Is this ok, will I lose data, are the clones and cache ok?
    Scenerio #2: (NOT using return from merge)
    -- Start of Transaction #1
    EntityObject obj = new EntityObject();
    obj.setName("chris");
    em.merge(obj);
    -- End of Transaction #1
    -- Start of Transaction #2
    obj.setName("scott");
    em.merge(obj);
    -- End of Transaction #2
    Is this ok, ?
    These 2 scenerios are different in the fact that one uses the return from merge and one does not. Which one is correct, and what would the problem be with the wrong one?

Maybe you are looking for

  • How to isolate the signals between TX/RX and RX2 on the USRP N210?

    Hello everyone,     I want to use one USRP N210 to transmit and receive signals simultaneously. But when I try to transmit signals from TX/RX and receive signals from RX2(the transmitted and received signals are on the same center frequency), I found

  • Question about exceptions in function module GUI_DOWNLOAD

    To all, I add the function module 'GUI_DOWNLOAD' in the ABAP report program. After the user download the data to excel, the program also displays a report on the screen for print output. If the user keep the excel file open and tries to replace the f

  • Managing warranties for equipment components

    Hi! I have the following issue: I need to implement a solution where user can manage warranties for equipment's components besides the equipment warranty. User requires that when a new component is assigned to an equipment, like bill of materials or

  • IPhone 4s coverage problems?

    Hi, Since a few weeks I'm using my iPhone 4s. This is my fourth iPhone in a row and I was always very happy with it. Since I have received my iPhone 4s I have noticed that my network coverage indicator (the bars) very often shows a low coverage 1 to

  • Optimization

    Hi All, I Have got the following Dimensions in Essbase. I am using Essbase 9.3.1 1. Accounts 2. Period 3. Year 4. Activity 5. Version 6. Currency 7. Company 8.Asset Type 9. Cost Centre 10.Invest_Char 11. Location Of the above only Accounts and Period