gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 05:20:52 25 4
gpt4 key购买 nike

我正在尝试做的是使用 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());
}

从这个图中可以看出,只需要指定数字的 uuidpattern:

enter image description here

但代码仅在我指定 uuid 时有效,而这不是我想要实现的。我唯一给出的是模式,我想使用它来获取所有其他信息。我已经从 Cisco 检查了这个站点:How to ... Create an AXL Java Client using JAX-WS

当我遗漏 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>

有谁知道,我如何仅通过使用模式-value 来获取目录号码?

最佳答案

我自己想通了。 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());
}

关于java - 如何使用 JAX-WS 在 AXL Java 客户端中使用 GetLineReq,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24825964/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com