我是 AR 系统 API 的新手。我正在尝试通过 Java 在 BMC Remedy 中创建票证,如下所示。
Ticket ticket = new Ticket();
String result = ticket.CreateTicket();
这是我的 Ticket.java 类。
package com.bmc.arsys.ticket;
import com.bmc.arsys.api.*;
public class Ticket {
private static ARServerUser server ;
String EntryId = "";
public String CreateTicket() {
server = new ARServerUser();
server.setServer("172.26.29.34");
server.setUser("dashboards");
server.setPassword("dashboards");
server.setPort(1531);
try {
System.out.println("start to verify user: ");
server.verifyUser();
} catch (ARException arException) {
System.out.println("Connected to AR Server Error occurred: " + arException.getMessage());
arException.printStackTrace();
}
showARSystemDetails();
Entry newEntry = new Entry();
newEntry.put(7, new Value(0)); // Status<br>
newEntry.put(8, new Value("This record is created via Java API")); // Short Description<br>
newEntry.put(1000000163, new Value(4000)); // Impact - (High) 1000/2000/3000/4000 (Low)<br>
newEntry.put(1000000162, new Value(4000)); // Urgency - (High) 1000/2000/3000/4000 (Low)<br>
newEntry.put(1000000000, new Value("xyz")); // Description<br>
newEntry.put(1000000151, new Value("xyz")); // Details<br>
newEntry.put(1000000099, new Value(0)); // Service Type - 0/1/2/3<br>
newEntry.put(240001002, new Value("xyz")); // Product Name<br>
newEntry.put(200000003, new Value("xyz")); // Product Cat Tier 1<br>
newEntry.put(240001002, new Value("xyz")); // Product Cat Tier 2<br>
newEntry.put(200000005, new Value("xyz")); // Product Cat Tier 3<br>
newEntry.put(1000000063, new Value("xyz")); // Operational Cat Tier 1<br>
newEntry.put(1000000064, new Value("xyz")); // Operational Cat Tier 2<br>
newEntry.put(1000000217, new Value("xyz")); // Assigned Group<br>
newEntry.put(1000000054, new Value("xyz")); // Corporate ID<br>
newEntry.put(2, new Value("Demo"));
newEntry.put(1000000164, new Value("xyz"));
newEntry.put(1000000161, new Value("xyz"));
newEntry.put(1000000082, new Value("xyz"));
newEntry.put(1000000056, new Value("xyz"));
newEntry.put(1000000019, new Value("xyz"));
newEntry.put(1000000018, new Value("xyz"));
newEntry.put(1000000001, new Value("xyz"));
try {
EntryId = server.createEntry("HPD:Help Desk", newEntry);
System.out.println("Request ID: " + EntryId);
} catch (ARException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
server.logout();
return EntryId;
}
private static void showARSystemDetails() {
System.out.println("Connected to AR Server: " + server.getServerInfoStr());
System.out.println("AR Server version: " + server.getServerVersion() + "\n");
System.out.println("List all connected users and last accessed time");
try {
for (UserInfo user : server.getListUser(Constants.AR_USER_LIST_CURRENT)) {
System.out.println(" " + user.getUserName() + " - "
+ user.getLastAccessTime().toDate());
}
} catch (ARException e) {
System.out.println(e.getMessage());
}
}
}
它成功连接到 AR Systen API。但它给出了以下例外。
ERROR (304): Must have Administrative permissions to perform this operation;
ERROR (306): Value does not fall within the limits specified for the field; (Pattern - $MENU$) : 1000000001
ERROR (306): Value does not fall within the limits specified for the field; (Pattern - $MENU$) : 1000000082
ERROR (326): Required field cannot be blank.; 1000000164
at com.bmc.arsys.apitransport.ApiProxyJRpcBase.verifyStatus(Unknown Source)
at com.bmc.arsys.apitransport.ApiProxyJRpcBase.a(Unknown Source)
at com.bmc.arsys.apitransport.ApiProxyJRpcBase.arCall(Unknown Source)
at com.bmc.arsys.api.ProxyJRpc.ARCreateEntry(Unknown Source)
at com.bmc.arsys.api.ARServerUser.createEntry(Unknown Source)
at com.bmc.arsys.ticket.Ticket.CreateTicket(Ticket.java:65)
at com.arapi.action.RequestHandler.setIssue(RequestHandler.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)
at org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:249)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:249)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:562)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
如果有人可以帮助我解决这个问题,我将不胜感激。
谢谢你