我现在必须通过 java rest web-service 将 Avaya IVRS 与 Service 集成。如果用户通过 Avaya IVRS 拨打电话,他应该可以通过电话键盘从菜单中进行选择并执行以下功能:- 1. 添加工单 2. 更新工单 3. 关闭工单 我已经编写了创建和更新工单的代码但我现在不知道如何与服务集成。
/////////////////////////////////////////////////
// POST OPERATION -- Create a new Incident ticket
/////////////////////////////////////////////////
String endpointPOST = baseURI + "/in";
PostMethod post = new PostMethod(endpointPOST);
post.addRequestHeader("X-AccessKey", accessKey);
post.addRequestHeader("Accept" , "application/xml");
post.addRequestHeader("Content-Type", "application/xml; charset=UTF-8");
post.setRequestBody("<in>" + "<customer COMMON_NAME=\"System_SD_User\"/>" +
"<description>Created from REST API Java Samples code</description>" + "</in>");
try {
System.out.println("Execute POST request for " + endpointPOST);
// Execute POST request
int result = client.executeMethod(post);
System.out.println("Response status code: " + result);
System.out.println("Response body: ");
System.out.println(post.getResponseBodyAsString());
System.out.println();
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
post.releaseConnection();
}
//////////////////////////////////////////////////////
// PUT OPERATION -- Update an existing Incident ticket
//////////////////////////////////////////////////////
String endpointPUT = baseURI + "/in/400001";
PutMethod put = new PutMethod(endpointPUT);
put.addRequestHeader("X-AccessKey", accessKey);
put.addRequestHeader("Accept" , "application/xml");
put.addRequestHeader("Content-Type", "application/xml; charset=UTF-8");
put.setRequestBody(
"<in>" + "<summary>Updated from REST API Java Samples code</summary>" + "</in>");
try {
System.out.println("Execute PUT request for " + endpointPUT);
// Execute PUT request
int result = client.executeMethod(put);
System.out.println("Response status code: " + result);
System.out.println("Response body: ");
System.out.println(put.getResponseBodyAsString());
System.out.println();
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
put.releaseConnection();
}