I'm attempting to code the method below. The code accesses a program call bean to a COBOL program on the iseries. From what I can see, the COBOL program is accessed correctly yet nothing is returned to the method below (I have verified this by stepping thru debug).

All of the other methods I've done were returning an array of data. This is the only one I've had to do so far that is returning a single record.

Can anyone help figure out what I'm doing wrong or what I might be missing?

And Happy New Year!

public static Credentials verifyCredentials(String VSnumber,
String emailaddress, String password) {
WEBCREDEN cr = new WEBCREDEN();
cr.getREQUEST_LIST().setREQ_VSNO(VSnumber);
cr.getREQUEST_LIST().setREQ_EML(emailaddress);
cr.getREQUEST_LIST().setREQ_PWD(password);
cr.invoke();


Credentials o = new Credentials();


o.setVSnumber(cr.getRESPONSE_LIST().getRSP_VSNO());
o.setEmail(cr.getRESPONSE_LIST().getRSP_EML());
o.setSessionID(cr.getRESPONSE_LIST().getRSP_SESSION());
o.setStatus(cr.getRESPONSE_LIST().getRSP_STATUS());
o.setLastname(cr.getRESPONSE_LIST().getRSP_LSTNM());
o.setFirstname(cr.getRESPONSE_LIST().getRSP_FRTNM());
o.setTitle(cr.getRESPONSE_LIST().getRSP_TITLE());     o.setCountry(cr.getRESPONSE_LIST().getRSP_CNTRY());
o.setPostalcode(cr.getRESPONSE_LIST().getRSP_POSTAL());     o.setPhonenumber(cr.getRESPONSE_LIST().getRSP_PHONE());
o.setType(cr.getRESPONSE_LIST().getRSP_TYPE());


System.out.println("Returned: " + o.getEmail());


return null;
}

Post whole Credentials-class.
In first view, your static method should return o; not return null;

public class HappyNewYear{
public static void main(String[] args) {
        String VSnumber = "VSnumber";
        String emailaddress = "emailaddress";
        String password = "password";
        Credentials myCredentials = Aaaaaaaaaaa.verifyCredentials(VSnumber, emailaddress, password);
        // now you have outside-acces  
        System.out.println("Returned: " + myCredentials.getEmail());
       // other
        System.out.println("Returned: " + myCredentials.getxxx());  
        System.out.println(myCredentials); 
    }
}

where Aaaaaaaaaaa is a name of class, where verifyCredentials() is placed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.