Hi Guys,
The application is accessing a web service using Axis 2 below is the code we used to connect and parse:
public class parse extends com.avaya.sce.runtime.BasicServlet {
// {{START:CLASS:FIELDS
// }}END:CLASS:FIELDS
private static final String BARRED = "CBAR";
private static final String SBARRED = "SBAR";
/**
* Default constructor Last generated by Dialog Designer at: 2013-OCT-17
* 10:26:08 AM
*/
public parse() {
// {{START:CLASS:CONSTRUCTOR
super();
// }}END:CLASS:CONSTRUCTOR
}
/**
* This method allows for custom integration with other Java components. You
* may use Java for sophisticated logic or to integrate with custom
* connectors (i.e. JMS, custom web services, sockets, XML, JAXB, etc.)
*
* Any custom code added here should work as efficiently as possible to
* prevent delays. It's important to design your callflow so that the voice
* browser (Voice Portal/IR) is not waiting too long for a response as this
* can lead to a poor caller experience. Additionally, if the response to
* the client voice browser exceeds the configured timeout, the platform may
* throw an "error.badfetch".
*
* Using this method, you have access to all session variables through the
* SCESession object.
*
* The code generator will *** NOT *** overwrite this method in the future.
* Last generated by Dialog Designer at: 2013-OCT-17 10:26:08 AM
*/
public void servletImplementation(
com.avaya.sce.runtimecommon.SCESession mySession) {
// TODO: Add your code here!
IVariable x = mySession
.getVariable(IProjectVariables.GET_ASSIGNED_PRODUCT_DETAILS);
String mob_num = x.getComplexVariable().getField(
IProjectVariables.GET_ASSIGNED_PRODUCT_DETAILS_FIELD_MSISDN)
.getStringValue();
String ProductType = x.getComplexVariable().getField(IProjectVariables.GET_ASSIGNED_PRODUCT_DETAILS_FIELD_PRODUCTTYPE)
.getStringValue();
IVariable var = mySession.getVariable(IProjectVariables.SUBS_STATUS);
IVariable var2 = mySession.getVariable(IProjectVariables.SUB_STATUS_2);
try {
OrderingServiceStub stub = new OrderingServiceStub();
GetAssignedProductDetails req = new GetAssignedProductDetails();
MSISDN_type15 msisdn = new MSISDN_type15();
msisdn.setMSISDN_type14(mob_num);
req.setMSISDN(msisdn);
OutputFieldsFilterCriteria ptype = new OutputFieldsFilterCriteria();
ptype.setProductType(true);
req.setOutputFieldsFilterCriteria(ptype);
GetAssignedProductDetailsE param = new GetAssignedProductDetailsE();
param.setGetAssignedProductDetails(req);
GetAssignedProductDetailsResponseE respE = stub
.getAssignedProductDetails(param);
///System.out.println("Product Type:" + ptype);
System.out.println("Mobile Number: " + msisdn);
// System.out.println("Subscriber Status: " +
// respE.getGetAssignedProductDetailsResponse().getGetAssignedProductDetailsResult()
// .getAssignedProducts().getAssignedProduct());
Boolean isBarred = FALSE;
Boolean SBarred = FALSE;
if (isValidResponse(respE)) {
for (AssignedProductDetails assignedProduct : respE
.getGetAssignedProductDetailsResponse()
.getGetAssignedProductDetailsResult()
.getAssignedProducts().getAssignedProduct()) {
if (assignedProduct.getProductType() != null) {
if (BARRED.equals(assignedProduct.getProductType()
.getValueAsString())) {
isBarred = TRUE;
}
else if (SBARRED.equals(assignedProduct.getProductType()
.getValueAsString())) {
SBarred = TRUE;
}
}
}
}
System.out.println("SUB IS BARRED: " + isBarred);
System.out.println("SUB IS SBARRED: " + SBarred);
// ASSIGN SUBSCRIBER'S STATUS TO A VARIABLE
var.getSimpleVariable().setValue(isBarred);
var2.getSimpleVariable().setValue(SBarred);
} catch (AxisFault e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
private boolean isValidResponse(GetAssignedProductDetailsResponseE response) {
return response != null
&& response.getGetAssignedProductDetailsResponse() != null
&& response.getGetAssignedProductDetailsResponse()
.getGetAssignedProductDetailsResult() != null
&& response.getGetAssignedProductDetailsResponse()
.getGetAssignedProductDetailsResult()
.getAssignedProducts() != null;
}
Now during our testing we can see that it normally end the session but when large volume of calls came in/ during production then the issue encountered, which some sessions are getting hung/locked, that's why we need to know if there is a way we could end the session in our application. Or any enhancement on the code to fix this.
Thanks,
|