The following macros are not currently supported in the header:
  • style

list 调用客户端示例

以下代码是采用 JSON 输出格式的 Axis 客户端程序示例,该程序调用 listServiceRequest 操作,以查询并返回登录用户及其组的、匹配指定搜索条件的所有未结服务请求的列表。    

public class ServiceRequestClient
{    


public void main (

String [] args)
   { 


try
      { 
         // Create the request
         ServiceRequestStub                        srqStub         = 

new ServiceRequestStub();
         ServiceRequestStub.Credentials            credentials     = 

new ServiceRequestStub.Credentials();
         ServiceRequestStub.ExtendedSettings       extParams       = 

new ServiceRequestStub.ExtendedSettings();

         // Initialize Credentials (User Name & User Password / Authorization Token & Slice Token)
         credentials.setUserName (

"wsuser");
         credentials.setUserPassword (

"wsuser");

         // Initialize Extended Settings such as Response Format (XML, JSON)
         extParams.setResponseFormat (

"JSON");

         // Invoke the LIST service
         ServiceRequestStub.DefaultServiceResponse serviceResponse = srqStub.listServiceRequest (credentials, extParams, ticketIdentifier);

         // Inspect successful execution of service and retrieve the response text


if (serviceResponse.getResponseStatus ().equals (

"OK"))
         { 


System.out.println(

"JSON Response : " + serviceResponse.getResponseText ());  
         } 
         // Retrieve the status code, status message and error messages, in 

case of failures


else
         { 


System.out.println(

"Status Code : " + serviceResponse.getStatusCode ());


System.out.println(

"Status Message : " + serviceResponse.getStatusMessage ());


System.out.println(

"Errors : " + Arrays.asList (serviceResponse.getErrors ()).toString ());
         } 
      } 


catch (Exception e) 
      { 


System.out.println (

"Exception: " + e.getMessage());
      } 
   } 
} 

© 2017 ServiceAide 1-650-206-8988 http://www.serviceaide.com info@serviceaide.com