1

我正在尝试使用 Cisco 的 AXL API 从 CUCM 获取目录号。这是相关的代码:

private void getNumber(){
    AXLAPIService axlService = new AXLAPIService();
    AXLPort axlPort = axlService.getAXLPort();

    String validatorUrl = "https://mycucm: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);


    GetLineReq axlParams = new GetLineReq();


    axlParams.setPattern("7491817");
    axlParams.setUuid("{48a6ff28-cea7-fc3e-3d82-8cc245ed4ea3}");


    GetLineRes getLineResponse = axlPort.getLine(axlParams);


    Demo.informUser("Line Information: \n" 
            + "Alerting Name: " + getLineResponse.getReturn().getLine().getAlertingName() + "\n" 
            + "Dial Number: " + getLineResponse.getReturn().getLine().getPattern() + "\n" 
            + "Description: " + getLineResponse.getReturn().getLine().getDescription() + "\n"
            + " " + getLineResponse.getReturn().getLine().getShareLineAppearanceCssName());
}

从这个图中可以看出,只需要指定uuid或数字的模式

在此处输入图像描述

但是代码只有在我指定uuid时才有效,这不是我想要实现的。我唯一给出的是我想使用的模式来获取所有其他信息。我已经检查了 Cisco 的这个站点:如何...使用 JAX-WS 创建 AXL Java 客户端

当我省略uuid时,我收到此错误:

Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Item not valid: The specified Line was not found

我还检查了目录号是如何使用 AXLSqlToolkit 存储在 CUCM 数据库中的:

<?xml version="1.0" encoding="UTF-8" standalone="no"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header/><SOAP-ENV:Body><axl:executeSQLQueryResponse xmlns:axl="http://www.cisco.com/AXL/API/7.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" sequence="1405672933992"><return><row><dnorpattern>7491817</dnorpattern><pkid>48a6ff28-cea7-fc3e-3d82-8cc245ed4ea3</pkid></row></return></axl:executeSQLQueryResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

有谁知道,我如何才能获得目录号码,仅使用模式值?

4

1 回答 1

3

我自己想通了。routePartitionName 也是一个强制参数,必须指定。这是我的方法的工作代码:

private void getNumber(){
AXLAPIService axlService = new AXLAPIService();
AXLPort axlPort = axlService.getAXLPort();

String validatorUrl = "https://mycucm: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);


GetLineReq axlParams = new GetLineReq();
ObjectFactory objectFactory = new ObjectFactory(); //This is new

XFkType routePartition = new XFkType(); 
routePartition.setValue("PHONES");     // This is where you specify your route partition name

axlParams.setPattern("7491817");
axlParams.setRoutePartitionName(objectFactory.createGetLineReqRoutePartitionName(routePartition));


GetLineRes getLineResponse = axlPort.getLine(axlParams);


Demo.informUser("Line Information: \n" 
        + "Alerting Name: " + getLineResponse.getReturn().getLine().getAlertingName() + "\n" 
        + "Dial Number: " + getLineResponse.getReturn().getLine().getPattern() + "\n" 
        + "Description: " + getLineResponse.getReturn().getLine().getDescription() + "\n"
        + " " + getLineResponse.getReturn().getLine().getShareLineAppearanceCssName());
}
于 2014-07-25T08:06:24.873 回答