Using WSDL2Java Classes

Version 1
    This document was generated from CDN thread

    Created by: GREGORY LEGGETT on 31-03-2011 11:16:14 AM
    I know this is probably more of a Java question, but I am looking for some guidance with properly parsing results from a request using the WSDL2Java built classes; now that I have the classes built without errors.
    I am somewhat new to Java and am working with a basic request to getPhone(), and am trying to determine the best way to retrieve the results into a more useable format than chaining method calls:
    import javax.xml.rpc.ServiceException;


    public class Main {
        public static void main(String[] args) throws ServiceException {
   loc = new AXLAPIServiceLocator();
   stub = (AXLAPIBindingStub)loc.getAXLPort();
            GetPhoneReq getPhoneReq = new GetPhoneReq();
            try {
                GetPhoneRes getPhoneRes = stub.getPhone(getPhoneReq);
                System.out.println("Result: "+getPhoneRes.get_return().getDevice().getSoftkeyTemplateName());
            } catch (Exception exp) {
                System.out.println("Fault: "+exp.getMessage());
    This obviously only returns the SoftkeyTemplateName, but I would like to have a hash/array of the phone values to parse, as opposed to creating method calls to each phone element.
    Any help, or criticism, someone can provide would be greatly appreciated.

    Subject: RE: Using WSDL2Java Classes
    Replied by: Stefan Schallmeiner on 04-04-2011 03:25:10 AM
    Hi Gregory,

    it might be that I'm misunderstanding the question, or are you new to object-oriented programming in general?

    But anyway there isn't a hash/array of the phone values, there are only getter/setter-methods (for each attribute) because Cisco is following strictly the web-service standards (which is not always helpfull, i know).

    To shorten things up a little you can store the return object. Like this:

    XIPPhone  phone = getPhoneRes.get_return().getDevice();

    String name = phone.getName();
    String uuid = phone.getUuid();

    But thats pretty much the way it is

    Subject: RE: Using WSDL2Java Classes
    Replied by: GREGORY LEGGETT on 06-04-2011 09:31:29 AM
    Is the green showing that much?

    Anyway, I understand the use of getters/setters, but I was thinking there was a way of utilizing the serializer/deserializer to produce a full list of nested values, as opposed to calling each one independently.  Part of this thinking spills over from old programming models, but I was also thinking this could be achieved since the nested values are available when debugging the code and drilling into getPhoneRes.

    Am I just crazy and this is a mirage I shouldn't be chasing?