1

我正在尝试运行“ https://developer.cisco.com/docs/axl/#!javajax-ws-quickstart ”中显示的 axl 演示

我是 axl、eclipse 和 java 的新手,只是想弄湿我的脚趾。

我已按照列出的说明进行操作,该项目仅显示 1 行错误:

GetPhoneRes getPhoneResponse = axlPort.getPhone(axlParams);

错误类型为 AXL 错误。

编译器中没有显示其他错误。

谁能给我关于问题可能是什么或如何解决问题的任何想法?

package com.cisco.axl.demo;
/**
 * demo to pull basic phone info
 */
import javax.xml.ws.BindingProvider;

import com.cisco.axlapiservice.AXLAPIService;
import com.cisco.axlapiservice.AXLPort;
import com.cisco.axl.api._10.*;

/**
 * 
 **  @author t01136
 ** Performs Getphone using AXL API
 ** Service Consumers were generated by the java ?? wsimport command:
 ** wsimport -keep -b schema/current/AXLSOAP.xsd -Xnocompile -s src -d bin -verbose schema/current/AXLAPI.wsd
 * and since AXL uses HTTPS, you will have to install the UC applications
 * certificate into you keystore in order to run this sample app.
 * You can run the program by CD'ing to the bin folder within this project
 * C:\Users\t01136.POS\eclipse-workspace\axl-demo\bin
 * and running the following command
 * java -cp .  com.cisco.axl.demo.Demo
 */
public class Demo {
	/**
	 * UC app host.
	 */
	protected static String ucHost = null;
	
	/**
	 * OS admin.
	 */
	protected static String ucAdmin = null;
	
	/**
	 * OS admin password.
	 */
	protected static String ucPswd = null;
	
	/**
	 * phoneName used in request.
	 */
	protected static String phoneName = null;
	
	/**
	 * Run the demo
	 * 
	 * @param args not used
	 */
	public static void main(String[] args) {
		// Verify JVM has a console
		if (System.console() == null) {
			System.err.println("The Cisco AXL Sample App requires a console.");
			System.exit(1);
		} else {
			Demo.informUser("%nWelcome to the Cisco AXL Sample APP .%n");
		}
		Demo demo = new Demo();
		demo.getPhoneInfo();
		
	}
	
	/**
	 * get information about phone
	 */
	public void getPhoneInfo() {
		// Ask for the UC application to upgrade
		// Demo.informuser("%nWhat UC server would you like to access?%n");
		ucHost = promptUser("  Host:  ");
		ucAdmin = promptUser("  OS Admin Account:  ");
		ucPswd = promptUser("  OS Admin Password:  ");
		
		// Ask for the phone name
		Demo.informUser("%nEnter the name of the phone you want to retrieve information about.%n");
		phoneName = promptUser("  Phone Name:  ");
		
		// Make the getPhoneRequest
		getPhone();
		}

//private String promptUser(String string) {
//		// TODO Auto-generated method stub
//		return null;
//	}

/**
	   * Makes the getPhone request and displays some of the fields that are returned.
	 */
	private void getPhone() {

	// Instantiate the wsimport generated AXL API Service client --
	// see the wsimport comments in the class javadocs above
	AXLAPIService axlService = new AXLAPIService();
	AXLPort axlPort = axlService.getAXLPort();


	// Set the URL, user, and password on the JAX-WS client
	String validatorUrl = "https://"
	    + Demo.ucHost
	    + ":8443/axl/";


	((BindingProvider) axlPort).getRequestContext().put(
	    BindingProvider.ENDPOINT_ADDRESS_PROPERTY, validatorUrl);
	((BindingProvider) axlPort).getRequestContext().put(
	    BindingProvider.USERNAME_PROPERTY, Demo.ucAdmin);
	((BindingProvider) axlPort).getRequestContext().put(
	    BindingProvider.PASSWORD_PROPERTY, Demo.ucPswd);

	// Create a GetPhoneReq object to represent the getPhone request and set the name of the device
	//to name entered by user
	GetPhoneReq axlParams = new GetPhoneReq();
	axlParams.setName(phoneName);

	//Make a call to the AXL Service and pass the getPhone request
	GetPhoneRes getPhoneResponse = axlPort.getPhone(axlParams);

	//display information returned in the response to the user
	Demo.informUser("Product=" + getPhoneResponse.getReturn().getPhone().getProduct() + "%n"
	        + getPhoneResponse.getReturn().getPhone().getLoadInformation().getValue() + "%n");
	}

// -------------------- Some I/O Helper Methods ------------------------
	
	/**
	* Provide the user some instructions.
    */
	protected static void informUser(String info) {
		System.console().format(info);
	}
	
	/**
	* Ask the user a question
	*/
	protected static String promptUser(String question) {
		String answer = null;
		while (answer==null || answer.isEmpty() ) {
			answer = System.console().readLine(question);
		}
		return answer.trim();
		}
	}
	

其实我也注意到了包资源管理器树

其中包含以下代码:

package com.cisco.axlapiservice;

导入 javax.xml.ws.WebFault;

/** * 此类由 JAX-WS RI 生成。* JDK 6 中的 JAX-WS RI 2.1.6 * 生成的源版本:2.1 * */ @WebFault(name = "axlError", targetNamespace = " http://www.cisco.com/AXL/API/10.5 ") public类 AXLError 扩展异常 {

/**
 * Java type that goes as soapenv:Fault detail element.
 * 
 */
private com.cisco.axl.api._10.AXLError faultInfo;

/**
 * 
 * @param message
 * @param faultInfo
 */
public AXLError(String message, com.cisco.axl.api._10.AXLError faultInfo) {
    super(message);
    this.faultInfo = faultInfo;
}

/**
 * 
 * @param message
 * @param faultInfo
 * @param cause
 */
public AXLError(String message, com.cisco.axl.api._10.AXLError faultInfo, Throwable cause) {
    super(message, cause);
    this.faultInfo = faultInfo;
}

/**
 * 
 * @return
 *     returns fault bean: com.cisco.axl.api._10.AXLError
 */
public com.cisco.axl.api._10.AXLError getFaultInfo() {
    return faultInfo;
}

}

当我查看“getFaultInfo():AXLError”的内容时,我看到“可序列化类 AXLError 没有声明 long 类型的静态最终 serialVersionUID 字段”,有 4 个快速修复可用。

但由于所有这些都是从 callmanager 下载的一部分,我认为它不会有错误。

也许这会给某人一个线索。

谢谢

4

0 回答 0