Heads Up :
The post you are writing will appear in a public forum. Please ensure all content is appropriate for public consumption. Review the employee guidelines for the community here.
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 { com.cisco.www.AXLAPIService.AXLAPIServiceLocator loc = new AXLAPIServiceLocator(); loc.setAXLPortEndpointAddress("https://1.1.1.1:8443/axl/"); com.cisco.www.AXLAPIService.AXLAPIBindingStub stub = (AXLAPIBindingStub)loc.getAXLPort(); stub.setUsername("admin"); stub.setPassword("password"); GetPhoneReq getPhoneReq = new GetPhoneReq(); getPhoneReq.setPhoneName("SEP222222222222"); 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:
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?
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: