简体   繁体   中英

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. 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:

在此输入图像描述

But the code only works, if I specify the uuid , which is not, what I'm trying to achieve. 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

When I leave out the uuid I get this Error:

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:

<?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?

I figured it out myself. The routePartitionName is also a mandatory parameter, which had to be specified. 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());
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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