简体   繁体   English

如何使用JAX-WS在AXL Java客户端中使用GetLineReq

[英]How to use GetLineReq in AXL Java Client using JAX-WS

What I'm trying to do is to obtain a Directory Number from CUCM, using the AXL API from Cisco. 我要做的是使用Cisco的AXL API从CUCM获取目录号码。 Here's the relevant Code: 这是相关的代码:

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());
}

As you can tell from this diagram it is only necessary to specify either the uuid or the pattern of the number: 从图中可以看出,只需指定uuid或数字模式

在此输入图像描述

But the code only works, if I specify the uuid , which is not, what I'm trying to achieve. 但是代码只有在我指定uuid时才有效,而不是,我正在努力实现的目标。 The only thing i have given, is the pattern , which I want to use, to get all the other information. 我唯一给出的是我想要使用的模式 ,以获取所有其他信息。 I Already examined this site from Cisco: How to ... Create an AXL Java Client using JAX-WS 我已经从思科检查了这个网站: 如何...使用JAX-WS创建一个AXL Java客户端

When I leave out the uuid I get this Error: 当我遗漏了uuid时,我得到了这个错误:

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

I also checked, how the Directory Number is stored inside the CUCM Database using the AXLSqlToolkit: 我还检查了如何使用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>

Does anyone know, how I can obtain the Directory Number, only by using the pattern -value? 有谁知道,我怎样才能获得目录号码,只能使用模式 -value?

I figured it out myself. 我自己想通了。 The routePartitionName is also a mandatory parameter, which had to be specified. routePartitionName也是必需参数,必须指定。 Here's the working code of my method: 这是我的方法的工作代码:

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());
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM