Return value is null

hi,
in my java file, i am selecting only one field and the value will be displayed into my jsp file, the problem is, it return a null value meaning the value of bizid is null.can anybody can tell what's the problem with my script??
here is my method in java file:
public void setbizID( String value ) {
bizID = value;
public String getBizID() {
System.out.println("testing:" +bizID);
return bizID;
public String view_detail() {
System.out.println("start view detail");
try {
System.out.println("start select from table");
st =con.createStatement();
String query ="SELECT bizid from inventory where productid = '"+productID+"'";
System.out.println(query);
rs = st.executeQuery(query);
System.out.println("end of select process");
System.out.println("bizID is:" +bizID);
catch (SQLException e){
System.out.println(e.getMessage());
System.out.println("error");
return bizID;
and this is my jsp file:
<%@ page import ="java.sql.*" %>
<%@ page import ="java.lang.*" %>
<%@ page import ="java.util.*" %>
<%@ page import ="java.io.*" %>
<%@ page import ="InsertIntoInv" %>
<%! String productID;
String bizID; %>
<jsp:useBean id="check" class="InsertIntoInv" scope="request" />
<jsp:setProperty name="check" property="*" />
<% check.connect(); %>
<% String bizID = check.getBizID(); %>
<% check.view_detail(); %>

okie..i'll paste all my script here..hope u can help me..:)
actually, i want to display bizid in my jsp page and the select stmt is in my java file...hope it won't confuse u..
AddInventory.jsp:
<html>
<head>
<title>Inventory : Add New Entry</title>
</head>
<%@ page import ="java.sql.*" %>
<%@ page import ="java.lang.*" %>
<%@ page import ="java.util.*" %>
<%@ page import ="java.io.*" %>
<%@ page import ="InsertIntoInv" %>
<%! String productID;
String bizID; %>
<jsp:useBean id="check" class="InsertIntoInv" scope="request" />
<jsp:setProperty name="check" property="*" />
<% if (request.getParameter("productID") != null) {
productID = request.getParameter("productID");
} %>
<% if (request.getParameter("bizID") != null) {
bizID = request.getParameter("bizID");
} %>
<%
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("dd/MM/yyyy");
java.util.Date currentTime_1 = new java.util.Date();
String dateString = formatter.format(currentTime_1);
%>
<tr>
<td>
date1 :<%= dateString %>
</td>
</tr>
<% check.connect(); %>
<% String bizID = check.getBizID(); %>
<% check.view_detail(); %>
<br>Your bizID is :<br>
<% out.println(check.view_detail()); %><br>
<% out.println(check.getBizID()); %><br>
<body>
<p> </p>
<table width="100%" border="0">
<tr bgcolor="#6699CC">
<td bgcolor="#66CCFF"><div align="center"><strong><font size="2" face="Arial, Helvetica, sans-serif">Inventory
and Replenishment</font></strong></div></td>
<td><div align="center"><strong><font size="2" face="Arial, Helvetica, sans-serif">Warehouse</font></strong></div></td>
<td><div align="center"><strong><font size="2" face="Arial, Helvetica, sans-serif">Inventory
Movement </font></strong></div></td>
<td><div align="center"><strong><font size="2" face="Arial, Helvetica, sans-serif">Reporting</font></strong></div></td>
</tr>
<tr>
<td width="100%" colspan="4" bgcolor="#FFFFCC"><font size="2" face="Arial, Helvetica, sans-serif">
Add Entry | Edit
| Delete
| View List </font></td>
</tr>
</table>
<form name="formAddInv" method="post" action="CheckAddInventory.jsp?prodID=<%= productID %>">
<p><font size="2" face="Arial, Helvetica, sans-serif"><strong>Inventory Informations</strong></font></p>
<table width="100%" border="0">
<tr>
<td><font size="2" face="Arial, Helvetica, sans-serif">Product ID</font></td>
<td><font size="2" face="Arial, Helvetica, sans-serif">:</font></td>
<td><font size="2" face="Arial, Helvetica, sans-serif">  <%= productID %></font></td>
<input type="hidden" name="ProdID" value="<%= productID %>">
</tr>
<tr>
<td><font size="2" face="Arial, Helvetica, sans-serif">Business ID</font></td>
<td><font size="2" face="Arial, Helvetica, sans-serif">:</font></td>
<td><font size="2" face="Arial, Helvetica, sans-serif">  <%= bizID %></font></td>
</tr>
<tr>
<td><font size="2" face="Arial, Helvetica, sans-serif">Date Created</font></td>
<td><font size="2" face="Arial, Helvetica, sans-serif">:</font></td>
<td><font size="2" face="Arial, Helvetica, sans-serif">  <%= new java.util.Date() %></font></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><br>  <input type="submit" name="Submit" value="Insert New Inventory">
<input type="reset" name="reset" value="Cancel"> </td>
</tr>
</table>
<p> </p>
</form>
</body>
</html>
and InsertIntoInv.java:
import java.sql.*;
import java.util.*;
import java.io.*;
import java.lang.*;
import java.lang.String;
public class InsertIntoInv{
String error;
Connection con;
Statement st;
ResultSet rs;
String zoneid;
String zonename;
String productID;
String bizID;
// define the data source for the driver
String sourceURL = "jdbc:postgresql://localhost/b2b";
String username = "username";
String password = "psswd";
public InsertIntoInv() {
public void setproductID( String value ) {
productID = value;
public void setbizID( String value ) {
bizID = value;
public void setwarehouseID( String value ) {
warehouseID = value;
public void setwarehousename( String value ) {
warehousename = value;
public String getproductID() {
return productID;
public String getBizID() {
System.out.println("testing:" +bizID);
return bizID;
public String getWarehouseID() {
System.out.println("whid:" +warehouseID);
return warehouseID;
public String getwarehousename() {
System.out.println("whname:" +warehousename);
return warehousename;
public void connect() throws ClassNotFoundException,SQLException,
Exception {
try {
     Class.forName("org.postgresql.Driver");
     con = DriverManager.getConnection(sourceURL,username,password);
     System.out.println("Connected to Database");
catch (ClassNotFoundException cnfe) {
     error = "ClassNotFoundException: Could not locate DB driver.";
     System.out.println("Exception=" + cnfe);
     throw new ClassNotFoundException(error);
catch (SQLException cnfe) {
     error = "SQLException: Could not connect to database.";
     System.out.println("Execption = " + cnfe);
     throw new SQLException(error);
catch (Exception e) {
     error = "Exception: An unknown error occurred while connecting "
+ "to database.";
     throw new Exception(error);
// end method connect
public String view_detail() {
System.out.println("start view detail");
try {
System.out.println("start select from table");
st =con.createStatement();
String query ="SELECT bizid from inventory where productid = '"+productID+"'";
System.out.println(query);
rs = st.executeQuery(query);
System.out.println("end of select process");
System.out.println("bizID is:" +bizID);
catch (SQLException e){
System.out.println(e.getMessage());
System.out.println("error");
return bizID;
public void insert(String zoneid, String zonename) {
try{
System.out.println("prepare to insert");
st = con.createStatement();
System.out.println("masuk tak?");
String query = " INSERT INTO zone VALUES('"+zoneid+"','"+zonename+"')";
System.out.println("query: "+query);
//rs = st.executeQuery(query);
     st.executeUpdate(query);
System.out.println("succesful insert into table");
catch(SQLException sqe) {
//sqe.printStackTrace();
System.out.println("sqe: "+sqe);
public void disconnect() throws SQLException {
     try {
     if ( con != null ) {
          con.close();
     catch (SQLException sqle) {
     error = ("SQLException: Unable to close the database connection.");
     throw new SQLException(error);
// end method disconnect} End class

Similar Messages

  • How to trap null return values from getters when using Method.invoke()?

    Hi,
    I am using Method.invoke() to access getters in an Object. I need to know which getters return a value and which return null. However, irrespective of the actual return value, I am always getting non-null return value when using Method.invoke().
    Unfortunately, the API documentation of Method.invoke() does not specify how it treats null return values.
    Can someone help?
    Thanks

    What do you get as a result?I think I know what the problem is.
    I tested this using following and it worked fine:
    public class TestMethodInvoke {
    public String getName() {
    return null;
    public static void main(String args[]) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
    Object o = new TestMethodInvoke();
    Class cls = o.getClass();
    Method m = cls.getMethod("getName", (Class[]) null);
    Object result = m.invoke(o, (Object[])null);
    if (result == null) {
    System.err.println("OK: Return value was null as expected");
    else {
    System.err.println("FAILED: Return value was NOT null as expected");
    However, when I use the same technique with an EJB 3.0 Entity class, the null return value is not returned. Instead, I get a String() object. Clearly, the problem is the the EJB 3.0 implementation (Glassfish/Toplink) which is manipulating the getters.
    Regards
    Dibyendu

  • Value is null return blank

    Hi all,
    I got two query which link to together in order to get the cost, however, now I want to show on my report if there is not found in the link it will return null. What I use if the value is null in the field level however when display it still show as null instead of 0 that what I want ?
    Any idea ? or any other way to solve my problem.
    please help me URGENT!!! Thanks.

    Hi John,
    Here is my first query :-
    SELECT AW.PACKAGELEAD,
    SUBSTR(AW.DEVICENO,1,50),
    AW.CURR_OPER,
    AW.CURQTY,
    AW.OPERATION_SEQ_NUM,
    AW.CUSTOMERCODE, ARC.ATTRIBUTE2, AW.DEVICENO DEVICE_NO, BSO.OPERATION_DESCRIPTION, AW.INVENTORY_ITEM_ID
    FROM AIC_COST_WIP_TEMPB AW, AR_CUSTOMERS ARC, BOM_STANDARD_OPERATIONS BSO
    WHERE ARC.ATTRIBUTE1 = AW.CUSTOMERCODE
    AND ARC.STATUS = 'A'
    AND BSO.OPERATION_CODE(+) = AW.CURR_OPER
    ORDER BY AW.DEVICENO, AW.CURR_OPER
    and here is the second query :-
    SELECT DISTINCT MSIK2.CONCATENATED_SEGMENTS,
    BBOM.ASSEMBLY_ITEM_ID,
    BIC.OPERATION_SEQ_NUM,
    CST.MATERIAL_COST,
    BIC.COMPONENT_QUANTITY,
    TO_NUMBER(BIC.attribute1) CPY
    FROM BOM_BILL_OF_MATERIALS BBOM,
         BOM_INVENTORY_COMPONENTS BIC,
         MTL_SYSTEM_ITEMS_KFV MSIK2,
    CST_ITEM_COST_TYPE_V CST
    WHERE BBOM.BILL_SEQUENCE_ID = BIC.BILL_SEQUENCE_ID     
    AND BIC.component_item_id = MSIK2.inventory_item_id
    AND MSIK2.INVENTORY_ITEM_ID = CST.INVENTORY_ITEM_ID
    AND CST.ORGANIZATION_ID = 8
    AND MSIK2.ORGANIZATION_ID = 8
    AND cst.cost_type_id = 1
    AND (BIC.disable_date IS NULL OR (BIC.disable_date - SYSDATE) > 0)
    the link between two qeuery is the query1->inventory_item_id & operation_seq_num versus query2->assembly_item_id & operation_seq_num.
    The both link is working fine. However, I need to show the results of formula and also cumulative of the results. But the result will only be shown if there is a link found between the two query, even I have putting null value as zero if it does not found from the query. So, that's my problem.
    Hope u can understand and help me to resolve this problem. Thanks
    Rgds
    Lim

  • Can not user Raw value as NULL return in Select List

    Help me!
    I recently converted my application to take advantage of the sys_guid() function that oracle offers over the sequence/trigger option.
    However, I user a hierarchical set up and I need to be able to insert a RAW value of '00' if the user does not select something in a select list. When I try to do this, I get an "ORA-01465: invalid hex number" error.
    I've also tried to return 00 and HEXTORAW(0) but that didn't work either. Infact 00 return a can not insert null value. Please help as I believe the sys_guid function is the best choice if I can make it work.

    Hey Scott, my first name is Daniel.
    Here is in detail the reason for which I want to be able to work with RAW. As everyone knows, most of your tables your going to have a UID. In general this is going to be a NUMBER column into which you will insert values that populate from a trigger getting the nextval of a sequence and returning the result into the NUMBER column of the row being inserted.
    This, however, requires a trigger and a sequence. Not that that's really a bad thing, I just think it can be done better. All we are really after here is a UUID or GUID. The thing is if you used a sequence to generate this value, you don't have a good way of knowing that the number is truly unique. You'll learn this as soon as you try to merge with a table from another database or do something else of the like.
    What I prefer to do is to use Oracle's SYS_GUID function when I create a table. To use this function you create a RAW(16) DEFAULT SYS_GUID(). From that point you don't even need to reference the column on insert, unless you're inserting into * and in that case you just specify DEFAULT. The use of sys_guid means I don't need a trigger and I don't need a sequence, and the result will always be unique, regardless of the DB.
    In APEX, and elsewhere, the way you use a select list is with a display value and a return value. An example would be, emp_name as the display value and emp_id as the return value. In my case, the emp_id would be the RAW values returned by the SYS_GUID() function when the employee was created. But it's not working because of the RAW value.
    I know that APEX can enter the value in session state that is returned from a RAW column because I did a test earlier and it worked. I would have to see it in session state for debugging. *** The problem is in creating a new record. ***
    APEX really does not have to work with the RAW column because the default value has been specified. But for some reason, it does not like it anyway. I found this problem when working with parent/child relationships in my tables.
    Lets say there are three columns GUID, TITLE, and PARENT. When creating a new record, I allow the user to select its parent. If the new record IS a parent then they would leave it as the default '- Is Parent -' and the PARENT column would be left as NULL. But because the GUID is RAW to make the relationship work with the parent, the PARENT column would be RAW too and APEX gives me the errors I was telling you about before.
    Sorry for going on so long. I don't know if I even got my point across. ;) Please let me know if you need me to do something on my part to further demonstrate my point. I would be happy to set up a demo if requested.

  • Apex 4 Cascading LOV's how to set a child LOV back to null return value

    Hi,
    My problem is I am using the new Dynamic Actions to implement Cascading LOV functionality in Apex 4 which means not having to submit the page to update child LOVs after parent LOV changes.
    What I am finding is that when you change the parent LOV value then the child LOV (which has a null return value) is not defaulting to the null return value (in my case no selection should return -1) if its list is filtered to a different set of values which doesnt have a valid selection. The child LOV is left without a selection when I need it to default back to the null return value (-1, representing all values).
    Also I was hoping to do this before the page is submitted so the filtering down the hierarchy of LOVs will work where the child is null (-1, meaning all values) and in turn its child LOV(s) will filter also from the null child value.
    Any help would be much appreciated.
    Thanks

    Hi 804641,
    I'm not sure if I get your problem and I tried to reproduce it.
    http://apex.oracle.com/pls/apex/f?p=2672:6 is my example with a cascading LOV where I have also defined a dynamic action which fires when P6_EMPNO changes and it shows the current selection.
    Maybe it helps if you setup an example on apex.oracle.com and provide the workspace/user/pwd so that I can have a look. I'm also not sure about your sentence "using the new Dynamic Actions to implement Cascading LOV functionality", because dynamic actions are not needed for cascading LOVs. It's a feature of the item types themselves where you just have to set the "Cascading LOV Parent Item(s)" attribute.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Unable to capture return values in web services api

    At the time of login to web services if my server is down ,
    it returns following error :
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
            at java.lang.String.substring(String.java:1438)
            at java.lang.String.substring(String.java:1411)
    I want to capture this error so that i can try another server to login. how do i capture this error
    Another place where i want to capture the return Value is when i look for a report on the server
    rh = boBIPlatform.get("path://InfoObjects/Root Folder/"src_folder"/" + reportName +
                               "@SI_SCHEDULEINFO,SI_PROCESSINFO" ,oGetOptions);
    oInfoObjects = rh.getInfoObjects();
    CrystalReport = (CrystalReport)oInfoObjects.getInfoObject(0);
    Here if the report is not there on the server , it returns a null handler exception.
    but if i try catching it by checking my responsehandler is null  like rh == null  it does not catch it.
    Any help will be appreciated
    thanks
    Rakesh Gupta

    Ted : i have two cases
    1)   server = server_st.nextToken();
        providerURL = "http://"server"/dswsbobje/services";
        sessConnURL = new URL(providerURL + "/session");
       Connection boConnection = new Connection(sessConnURL);
       Session boSession = new Session(boConnection);
      EnterpriseCredential boEnterpriseCredential = new    EnterpriseCredential();
                  boEnterpriseCredential.setLogin(userid);
      boEnterpriseCredential.setPassword(pwd);
      boEnterpriseCredential.setAuthType(auth);
    SessionInfo boSI = boSession.login(boEnterpriseCredential);
    I have got a list of servers running web servcies stored in my tokens. when i pass the first server name say " test:8080" and that server is down , i want to catch somewhere in the code above that it did not get the connection so that i can loop back and try with the second server say test1:8080
    This is for failover purposes.
    at present when i was trying to capture return value of boSI it  breaks giving the error
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1438)
    at java.lang.String.substring(String.java:1411)
    2nd case :
    I am geeting reports from the server and scheduling them:
    i run the following code which works fine if reports is there
    rh = boBIPlatform.get("path://InfoObjects/Root Folder/"src_folder"/" + reportName +
    "@SI_SCHEDULEINFO,SI_PROCESSINFO" ,oGetOptions);
    oInfoObjects = rh.getInfoObjects();
    CrystalReport = (CrystalReport)oInfoObjects.getInfoObject(0);
    Here if  the  report  is not there on the server  then i should be able to catch from the response handle rh that it has got a null value.
    but rh does not return a null value 
    the code ultimately throws a null handle at the following line
    CrystalReport = (CrystalReport)oInfoObjects.getInfoObject(0);
    i am not able to catch the null value there also.
    hope you got my issue.

  • Multiple return values (Bug-ID 4222792)

    I had exactly the same request for the same 3 reasons: strong type safety and code correctness verification at compile-time, code readability and ease of mantenance, performance.
    Here is what Sun replied to me:
    Autoboxing and varargs are provided as part of
    JSRs 14 and 201
    http://jcp.org/en/jsr/detail?id=14
    http://jcp.org/en/jsr/detail?id=201
    See also:
    http://forum.java.sun.com/forum.jsp?forum=316
    http://developer.java.sun.com/developer/earlyAccess/adding_generics/index.html
    Multiple return values is covered by Bug-ID 4222792
    Typically this is done by returning an array.
    http://developer.java.sun.com/developer/bugParade/bugs/4222792.html
    That's exactly the problem: we dynamically create instances of array objects that would better fit well within the operand stack without stressing the garbage collector with temporary Array object instances (and with their backing store: 2 separate allocations that need to be recycled when it is clearly a pollution that the operand stack would clean up more efficiently)
    If you would like to engage in a discussion with the Java Language developers, the Generics forum would be a better place:
    http://forum.java.sun.com/forum.jsp?forum=316
    I know that (my report was already refering to the JSR for language extension) Generics is not what I was refering to (even if a generic could handle multiple return values, it would still be an allocated Object
    instance to pack them, i.e. just less convenient than using a static class for type safety.
    The most common case of multiple return values involve values that have known static datatypes and that should be checked with strong typesafety.
    The simple case that involves returning two ints then will require at least two object instances and will not solve the garbage collection overhead.
    Using a array of variable objects is exactly similar, except that it requires two instances for the components and one instance for the generic array container. Using extra method parameters with Integer, Byte, ... boxing objects is more efficient, but for now the only practical solution (which causes the least pollution in the VM allocator and garbage collector) is to use a custom class to store the return values in a single instance.
    This is not natural, and needlessly complexifies many interfaces.
    So to avoid this pollution, some solutions are used such as packing two ints into a long and returning a long, depacking the long after return (not quite clean but still much faster at run-time for methods that need to be used with high frequencies within the application. In some case, the only way to cut down the overhead is to inline methods within the caller code, and this does not help code maintenance by splitting the implementation into small methods (something that C++ can do very easily, both because it supports native types parameters by reference, and because it also supports inline methods).
    Finally, suppose we don't want to use tricky code, difficult to maintain, then we'll have to use boxing Object types to allow passing arguments by reference. Shamely boxed native types cannot be allocated on the operand stack as local variables, so we need to instanciate these local variables before call, and we loose the capacity to track the cases where these local variables are not really initialized by an effective call to the method that will assign them. This does not help debugging, and is against the concept of a strongly typed language like Java should be:
    Java makes lots of efforts to track uninitialized variables, but has no way to determine if an already instanciated Object instance refered in a local variable has effectively received an effective assignment because only the instanciation is kept. A typical code will then need to be written like this:
    Integer a = null;
    Integer b = null;
    if (some condition) {
    //call.method(a, b, 0, 1, "dummy input arg");
    // the method is supposed to have assigned a value to a and b,
    // but can't if a and b have not been instanciated, so we perform:
    call.method(a = new Integer(), b = new Integer(), 0, 1, "dummy input
    arg");
    // we must suppose that the method has modified (not initialized!)
    the value
    // of a and b instances.
    now.use(a.value(), b.value())
    // are we sure here that a and b have received a value????
    // the code may be detected at run-time (a null exception)
    // or completely undetected (the method() above was called but it
    // forgot to assign a value to its referenced objects a and b, in which
    // case we are calling in fact: now.use(0, 0); with the default values
    // or a and b, assigned when they were instanciated)
    Very tricky... Hard to debug. It would be much simpler if we just used:
    int a;
    int b;
    if (some condition) {
    (a, b) = call.method(0, 1, "dummy input arg");
    now.use(a, b);
    The compiler would immediately detect the case where a and b are in fact not always initialized (possible use bere initialization), and the first invoked call.method() would not have to check if its arguments are not null, it would not compile if it forgets to return two values in some code path...
    There's no need to provide extra boxing objects in the source as well as at run-time, and there's no stress added to the VM allocator or garbage collector simply because return values are only allocated on the perand stack by the caller, directly instanciated within the callee which MUST (checked at compile-time) create such instances by using the return statement to instanciate them, and the caller now just needs to use directly the variables which were referenced before call (here a and b). Clean and mean. And it allows strong typechecking as well (so this is a real help for programmers.
    Note that the signature of the method() above is:
    class call {
    (int, int) method(int, int, String) { ... }
    id est:
    class "call", member name "method", member type "(IILjava.lang.string;)II"
    This last signature means that the method can only be called by returning the value into a pair of variables of type int, or using the return value as a pair of actual arguments for another method call such as:
    call.method(call.method("dummy input arg"), "other dummy input arg")
    This is strongly typed and convenient to write and debug and very efficient at run-time...

    Can anyone give me some real-world examples where
    multiple return values aren't better captured in a
    class that logically groups those values? I can of
    course give hundreds of examples for why it's better
    to capture method arguments as multiple values instead
    of as one "logical object", but whenever I've hankered
    for multiple return values, I end up rethinking my
    strategy and rewriting my code to be better Object
    Oriented.I'd personally say you're usually right. There's almost always a O-O way of avoiding the situation.
    Sometimes though, you really do just want to return "two ints" from a function. There's no logical object you can think of to put them in. So you end up polluting the namespace:
    public class MyUsefulClass {
    public TwoInts calculateSomething(int a, int b, int c) {
    public static class TwoInts {
        //now, do I use two public int fields here, making it
        //in essence a struct?
       //or do I make my two ints private & final, which
       //requires a constructor & two getters?
      //and while I'm at it, is it worth implementing
      //equals(), how about hashCode()? clone()?
      //readResolve() ?
    }The answer to most of the questions for something as simple as "TwoInts" is usually "no: its not worth implementing those methods", but I still have to think about them.
    More to the point, the TwoInts class looks so ugly polluting the top level namespace like that, MyUsefulClass.TwoInts is public, that I don't think I've ever actually created that class. I always find some way to avoid it, even if the workaround is just as ugly.
    For myself, I'd like to see some simple pass-by-value "Tuple" type. My fear is it'd be abused as a way for lazy programmers to avoid creating objects when they should have a logical type for readability & maintainability.
    Anyone who has maintained code where someone has passed in all their arguments as (mutable!) Maps, Collections and/or Arrays and "returned" values by mutating those structures knows what a nightmare it can be. Which I suppose is an argument that cuts both ways: on the one hand you can say: "why add Tuples which would be another easy thing to abuse", on the other: "why not add Tuples, given Arrays and the Collections framework already allow bad programmers to produce unmainable mush. One more feature isn't going to make a difference either way".
    Ho hum.

  • Help : Complex parameter and return value in WebService?

    Hi guys
       These days, I publish a WebService, in it there is an
    operation like this:
       List search(List para);
       in this operation, parameter "para" is a java.util.List, which contains many elements, every element is an instance of customizing class "MyItem", I made "MyItem" implements java.io.Serializable interface. Strangely, when I call this operations in my java client,
    I found that I could not get out every element from para in server-side, but para.size() is showing it contains 10 elements in it. The same thing happen to the return value of this operation, in client, I got an instance of java.util.List class as the return value, when I try
    System.out.println(result.get(0)); it output "null", but
    result.size() is 10, I don't know how to explain this
       Does anyone who encounter this issue too?
    I guess it has something to with the Serializable issue ,but I have made every List item serializable, why it looks like this??

    Hi Kevin,
    I answered you by mail some days ago, but just to complete the thread, I am posting the hint also here:
    Custom types should be manually added to the Virtual Interface, so that they can be serialized.
    Best regards,
    Alexander

  • How to get return values from task flow in af:region ?

    Hi!
    I'm working with a taskFlow that is rendered inside a popup using the "popup inside a region pattern" (http://www.oracle.com/technology/products/adf/patterns/popupregionpattern.pdf), but now this taskFlow has an input parameter and a return value definition. So the question is how to get a value returned by this taskFlow thas is called inside a region?
    Any suggestion?
    Thanks in advance!

    Hi,
    write the value to a shared memory scope like session and read it in the regionNavigation listener. If you follow the paper you refer to then the listener determines of the viewId is null, this a return happens. It wuld then look in the memory scope for the return value.
    Another option would be to use an object that you pass as an argument to the task flow you open in the popup. Then you change the object you passed in, which then makes the return information available in teh calling flow. The object you pass in would have to be in a shared scope too
    Frank

  • Remote Object - not able to get the returned value from java method

         Hi ,
    I am developing one sample flex aplication that connects to the java code and displays the returned value from the
    java method in flex client. Here I am able to invoke the java method but not able to collect the returned value.
    lastResult is giving null .  I am able to see the sysout messages in server console.
    I am using flex 3.2 and blazeds server  and java 1.5
    Here is the code what I have written.
    <?xml version="1.0" encoding="utf-8"?><mx:WindowedApplication  xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#FFFFFF" initialize="initApp()">
     <mx:Script><![CDATA[
    import mx.controls.Alert; 
    import mx.binding.utils.ChangeWatcher; 
    import mx.rpc.events.ResultEvent; 
    import mx.messaging.*; 
    import mx.messaging.channels.* 
    public function initApp():void { 
         var cs:ChannelSet = new ChannelSet(); 
         var customChannel:Channel = new AMFChannel("my-amf", "http://localhost:8400/blazeds/messagebroker/amf");     cs.addChannel(customChannel);
         remoteObj.channelSet = cs;
    public function writeToConsole():void {      remoteObj.writeToConsole(
    "hello from Flash client");
          var returnedVal:String = remoteObj.setName().lastResult;     Alert.show(returnedVal);
    //[Bindable] 
    // private var returnedVal:String; 
    ]]>
    </mx:Script>
    <mx:RemoteObject id="remoteObj" destination="sro" /> 
    <mx:Form width="437" height="281">
     <mx:FormItem>  
    </mx:FormItem>  
    <mx:Button label="Write To Server Console" click="writeToConsole()"/>
     </mx:Form>
     </mx:WindowedApplication>
    Java code
    public  
         public SimpleRemoteObject(){  
              super();     }
      class SimpleRemoteObject { 
         public void writeToConsole(String msg) {          System.out.println("SimpleRemoteObject.write: " + msg);     }
         public String setName(){          System.
    out.println("Name changed in Java"); 
              return "Name changed in Java";
    And I have configured destination in  remote-config.xml
    <destination id="sro">
       <properties>    
        <source>SimpleRemoteObject</source>
        <scope>application</scope>
       </properties>
      </destination>
    Please help me .

    You are not able to get the returned value because if you see the Remote object help you will realise you have to use result="resultfn()" and fault = "faultfn()"
    In this you define what you wish to do.
    More importantly in the remote object you need to define which method you wish to call using the method class like this
    <mx:RemoteObject id="remoteObj" destination="sro" result="r1" fault="f1"  >
         <Method name="javaMethodName" result="r2" fault="f2"/>
    <mx:RemoteObject>
    r2 is the function where you get the result back from java and can use it to send the alert.

  • How to get return values from region?

    I add a page flow as region into a page. The page flow has a return parameter. How to get the return value in parent page?

    I have been also intrigued by this question.
    There is however a workaround that you can set the values in requestScope.
    We can have a regionNavigationListener on the region and catch the end of taskflow if viewid is null.
    regionNavigationEvent.getNewViewId() == null
    Here we can read the request values and set wherever to be used.
    maniesh (sid)

  • How to call an Oracle Procedure and get a return value in Php

    Hi Everyone,
    Has anyone tried calling an Oracle procedure from Php using the ora functions and getting the return value ? I need to use the ora funtions (no oci)because of compatibility and oracle 7.x as the database.
    The reason why I post this here is because the ora_exec funtion is returning FALSE but the error code displayes is good. Is this a bug in the ora_exec funtion ?
    My code after the connection call is as follows:
    $cur = ora_open($this->conn);
    ora_commitoff($this->conn);
    $requestid = '144937';
    echo $requestid;
    $rc = ora_parse($cur, "begin p_ins_gsdata2
    (:requestid, :returnval); end;");
    if ($rc == true) {
    echo " Parse was successful ";
    $rc2 = ora_bind ($cur, "requestid", ":requestid", 32, 1);
    if ($rc2 == true) echo " Requestid Bind Successful ";
    $rc3 = ora_bind ($cur, "returnval", ":returnval", 32, 2);
    if ($rc3 == true) echo " Returnval Bind Successful ";
    $returnval = "0";
    $rc4 = ora_exec($cur);
    echo " Result = ".$returnval." ";
    if ($rc4 == false) {
    echo " Exec Returned FALSE ";
    echo " Error = ".ora_error($cur);
    echo " ";
    echo "ErrorCode = ".ora_errorcode($cur);
    echo "Error Executing";
    ora_close ($cur);
    The Oracle procedure has a select count from a table and it returns the number of records in that table. It's defined as:
    CREATE OR REPLACE procedure p_ins_gsdata2 (
    p_requestid IN varchar2 default null,
    p_retcode OUT varchar2)
    as
    BEGIN
    SELECT COUNT (*) INTO p_retcode
    FROM S_GSMRY_DATA_SURVEY
    WHERE request_id = p_requestid ;
    COMMIT;
    RETURN;
    END;
    Nothing much there. I want to do an insert into a table,
    from the procedure later, but I figured that I start with a select count since it's simpler.
    When I ran the Php code, I get the following:
    144937
    Parse was successful
    Requestid Bind Successful
    Returnval Bind Successful
    Result = 0
    Exec Returned FALSE
    Error = ORA-00000: normal, successful completion -- while
    processing OCI function OBNDRA
    ErrorCode = 0
    Error Executing
    I listed the messages on separate lines for clarity. I don't understand why it parses and binds o.k. but the exec returns false.
    Thanks again in advance for your help. Have a great day.
    Regards,
    Rudi

    retcode=`echo $?`is a bit convoluted. Just use:
    retcode=$?I see no EOF line terminating your input. Your flavour of Unix might not like that - it might ignore the command, though I'd be surprised (AIX doesn't).
    replace the EXEC line with :
    select 'hello' from dual;
    and see if you get some output - then you know if sqlplus commands are being called from your script. You didn't mentioned whether you see the banner for sqlplus. Copy/paste the output that you get, it will give us much more of an idea.

  • Calling web service via utl_dbws with unbounded return values

    Hello, everyone.
    I'm trying to use utl_dbws to call web service from Oracle DB 10 g.
    WS has unbounded return value:
    <xs:element maxOccurs='unbounded' minOccurs='0' name='return' type='xs:string'/>
    I'm setting return paramter in web service call handler like this:
    sys.UTL_DBWS.set_return_type(l_h_service_call, cs_qname_type_string);
    and when I'm trying to call it from PL/SQL function I'm getting an error:
    ORA-29532: Java call terminated by uncaught Java exception:
    deserialization error: XML reader error: unexpected character content: "s2"
    ORA-06512: at "SYS.UTL_DBWS", line 388
    ORA-06512: at "SYS.UTL_DBWS", line 385
    ORA-06512: at line 38
    I've tried to return values by out parameters and got the same exception.
    It looks like utl_dbws needs to know parameters count before calling.
    Have anyone succeded in getting arrays from Web Service call?
    This is a part of wsdl:
    <xs:complexType name='getProcessList'>
    <xs:sequence>
    <xs:element minOccurs='0' name='nameMask' type='xs:string'/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name='getProcessListResponse'>
    <xs:sequence>
    <xs:element maxOccurs='unbounded' minOccurs='0' name='return' type='xs:string'/>
    </xs:sequence>
    </xs:complexType>
    Throught SoapUI I can produce such kind of request:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:proc="http://processmanager.argustelecom.ru/">
    <soapenv:Header/>
    <soapenv:Body>
    <proc:getProcessList>
    <processNameMask>*</processNameMask>
    </proc:getProcessList>
    </soapenv:Body>
    </soapenv:Envelope>
    and get a response:
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Header/>
    <env:Body>
    <ns2:getProcessListResponse xmlns:ns2="http://processmanager.argustelecom.ru/">
    <return>s1</return>
    <return>s2</return>
    <return>s3</return>
    <return>s4</return>
    </ns2:getProcessListResponse>
    </env:Body>
    </env:Envelope>
    PL/SQL function:
    DECLARE
    cs_qname_type_string CONSTANT sys.UTL_DBWS.qname
    := sys.UTL_DBWS.to_qname('http://www.w3.org/2001/XMLSchema', 'string') ;
    cs_qname_type_int CONSTANT sys.UTL_DBWS.qname := sys.UTL_DBWS.to_qname('http://www.w3.org/2001/XMLSchema', 'int');
    cs_qname_type_any CONSTANT sys.UTL_DBWS.qname
    := sys.UTL_DBWS.to_qname('http://www.w3.org/2001/XMLSchema', 'anyType') ;
    cs_endpoint CONSTANT VARCHAR2(256) := 'http://server:8080/process-manager/ProcessManager';
    l_service sys.UTL_DBWS.service;
    l_service_qname sys.UTL_DBWS.qname;
    l_port_qname sys.UTL_DBWS.qname;
    l_operation_qname sys.UTL_DBWS.qname;
    l_h_service_call sys.UTL_DBWS.call;
    l_params sys.UTL_DBWS.anydata_list;
    l_ret_val SYS.ANYDATA;
    BEGIN
    l_service_qname := sys.UTL_DBWS.to_qname(NULL, 'ProcessManagerService');
    l_service := sys.UTL_DBWS.create_service(l_service_qname);
    l_port_qname := sys.UTL_DBWS.to_qname(NULL, 'ProcessListServiceBinding');
    l_operation_qname := sys.UTL_DBWS.to_qname('http://processmanager.argustelecom.ru/', 'getProcessList');
    l_h_service_call := sys.UTL_DBWS.create_call(l_service, l_port_qname, l_operation_qname);
    sys.UTL_DBWS.set_target_endpoint_address(l_h_service_call, cs_endpoint);
    -- return type
    sys.UTL_DBWS.set_return_type(l_h_service_call, cs_qname_type_any);
    -- param type
    sys.UTL_DBWS.ADD_PARAMETER(l_h_service_call, 'processNameMask', cs_qname_type_string, 'ParameterMode.IN');
    l_params(1) := anydata.convertvarchar2('*');
    l_ret_val := sys.UTL_DBWS.invoke(l_h_service_call, l_params);
    IF l_ret_val IS NULL THEN
    DBMS_OUTPUT.put_line('l_ret_val is null');
    ELSE
    DBMS_OUTPUT.put_line('l_ret_val is not null');
    END IF;
    sys.UTL_DBWS.release_call(l_h_service_call);
    END;
    Edited by: Ilya on 03.12.2008 3:50

    Hi Tony
    I'm not sure if you would have solved your problem by now, but with my recent experience with the utl_dbws package, for doc lits with complex data types, you have to call the service with an XML request, as opposed to passing the param array.
    If you still need details, reply accordingly.
    Ta
    cT

  • Trying to write an if statement around the return value of a CANCEL_OPTION

    I am writing a program that takes an input String using JOptionPane. The String can be made of only letters of the A-Z alphabet and the space character. I have written an error-checking loop that will pop another input box up along with an error message if any invalid character is detected. The input box has an 'ok' button and a 'cancel' button. As it is, if you hit cancel, the program crashes and you get a NullPointerException. All I want to do is place an if statement inside of the error-checking loop, immediatly after the code to pop up the second input box, that simply does System.exit() and exits the program correctly(rather than crashing) if 'cancel' is clicked.
    My attempt at such an if statement is visible in the following code(letter is a boolean variable defined earlier, and message is the input String that has already been read in):
                   letter = isValidMessage(message);
              while(!letter)
                   message = JOptionPane.showInputDialog(null, "Message must contain only A-Z, a-z, or space character...");
                            if(JOptionPane.CANCEL_OPTION > 0  //or ==0 or ==1 or ==2, nothing works//)
                                JOptionPane.showMessageDialog(null, "No valid message entered - program will terminate...");
                                System.exit(JOptionPane.CANCEL_OPTION);
                   letter = isValidMessage(message);
                    }The if statement doesn't work correctly. If you click 'cancel' when the input box comes up, the program does terminate as it is supposed to. The problem is that if I type something in the box and click 'ok', it also causes the program to terminate rather than continuing. I've tried changing the > to ==. I've tried changing 0 to 1 to 2 to -1(I really am not sure which int return value of CANCEL_OPTION corresponds to which event). I think once I got to do the exact opposite...that is to say, it would continue on with the program whether I clicked 'cancel' or 'ok'. Which is equally bad. I don't know what I'm doing wrong.
    It's probably something simple that I'm just overlooking.

    Well, here's what CANCEL_OPTION is, according to the JOptionPane class:
    /** Return value from class method if CANCEL is chosen. */
        public static final int         CANCEL_OPTION = 2;However, I believe you're going about this in the wrong way.
    With JOptionPane, whenever you show a dialog, it usually returns whatever OPTION the user chose.
    For instance,
        int choice = JOptionPane.showConfirmDialog(parentComponent, "hello");That will bring up a dialog centered on parentComponent, with a message of "hello".
    It will have the default options (YES_NO_OPTION).
    What it returns is the option the user chose.
    There are 4 possible things it can return:
    YES_OPTION, when user clicks "Yes"
    NO_OPTION, when user clicks "No"
    ERROR_OPTION, when an unforseen error occurs and the dialog closes
    CANCEL_OPTION, when the user clicks "Cancel" (if that OPTION type were being used), or if they close the dialog
    So this is how you would check for CANCEL_OPTION:
        int choice = JOptionPane.showConfirmDialog(parentComponent, "hello");
        if (choice == JOptionPane.CANCEL_OPTION) {
            // User cancelled
        else if (choice == JOptionPane.YES_OPTION) {
            // User chose yes
        // EtcSo you see, going about it like this:
    if(JOptionPane.CANCEL_OPTION > 0  //or ==0 or ==1 or ==2, nothing works//)Is really the wrong way, because you're not checking what the user DID, but just what the constant variable "CANCEL_OPTION" is.
    However, it seems as if you're in a unique situation where you don't want the OPTION chosen by the user, but an input String.
    This is all well and good, but I think this limits how you can interact with the user, as the "showInputDialog" methods return the String the user input- not the OPTION they chose, and you need to use both.
    What I've done in the past is created a simple JPanel with its own JTextField.
    I pass the JPanel in as the "message" parameter of a showConfirmDialog call, and get both the user input and their chosen OPTION based off a getText call to the JTextField and the OPTION constant returned by showConfirmDialog.
    Basically,
    JPanel promptPanel = new JPanel(new BorderLayout());
    JTextField promptField = new JTextField();
    promptPanel.add(promptField, BorderLayout.CENTER);
    int choice = JOptionPane.showConfirmDialog(parentComponent, promptPanel, "Input", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
    if (choice == JOptionPane.OK_OPTION) {
       // User chose OK, see if invalid characters were entered
       String input = promptField.getText();
    else if (choice == JOptionPane.CANCEL_OPTION) {
       // User cancelled
    }Hope that helps.
    (note that I'm unsure if showConfirmDialog can accept OK_CANCEL_OPTION as its OPTION parameter, as it says only YES_NO_OPTION and YES_NO_CANCEL_OPTION can be used, but I seem to remember using it in the past. if OK_CANCEL_OPTION doesn't want to work, then use one of the other two and adjust your if statements accordingly)
    Cheers!
    Edited by: LukeFoss on Oct 9, 2007 10:39 PM

  • Problem with Bapi_po_Getdetail return values

    We have developed a web service in asp.net to get the details of a particular purchase order number calling Bapi_po_Getdetail. The input parameters that we pass are:
    string  ITEMS = “X”
    string PURCHASEORDER= “<purchase order number>”
    But when we debug and check the return values from the bapi, BAPIEKPO Table doesn’t have any data, it is null.
    Could someone help us, please?

    Please initialize the BAPIEKPOTable bedore call. Passing null allways returns null.
    NCo:
    string ITEMS = “X”
    string PURCHASEORDER= “<purchase order number>”
    BAPIEKPOTable result = new BAPIEKPOTable();
    proxy.Bapi_po_Getdetail(ITEMS, PURCHASEORDER, ref result);
    Soap Processor / Web Service Wizard
    string ITEMS = “X”
    string PURCHASEORDER= “<purchase order number>”
    BAPIEKPO[] result = new BAPIEKPO[0];
    proxy.Bapi_po_Getdetail(ITEMS, PURCHASEORDER, ref result);

Maybe you are looking for