@Test
 public void testEcho() {
   QueryOrderRequest request = new QueryOrderRequest();
   QueryOrderResponse response =
       (QueryOrderResponse) webServiceTemplate.marshalSendAndReceive(echoUrl, request);
   System.out.println(ToStringBuilder.reflectionToString(response));
 }
예제 #2
0
 @Override
 public String sayHello(String name) {
   SayHelloRequest request = WS_CLIENT_FACTORY.createSayHelloRequest();
   request.setName(name);
   SayHelloResponse response = (SayHelloResponse) wsTemplate.marshalSendAndReceive(request);
   return response.getName();
 }
예제 #3
0
 @Override
 public List<UserGen> getUsersByName(String name) {
   GetUsersByNameRequest request = WS_CLIENT_FACTORY.createGetUsersByNameRequest();
   request.setName(name);
   GetUsersByNameResponse response =
       (GetUsersByNameResponse) wsTemplate.marshalSendAndReceive(request);
   return response.getUserGen();
 }
  public int getBalance() throws LogonException {
    if (!session.alreadyLoggedOn())
      throw new LogonException("Not Logged On; Session does not exist");

    GetBalanceRequest getBalanceRequest = new GetBalanceRequest();
    getBalanceRequest.setSessionId(session.getSessionId());

    return ((GetBalanceResponse) wsTemplate.marshalSendAndReceive(getBalanceRequest)).getBalance();
  }
예제 #5
0
  public Double getConversionRate(Currency fromCurrency, Currency toCurrency) {
    ConversionRate conversionRate = new ObjectFactory().createConversionRate();
    conversionRate.setFromCurrency(fromCurrency);
    conversionRate.setToCurrency(toCurrency);

    ConversionRateResponse response =
        (ConversionRateResponse) webServiceTemplate.marshalSendAndReceive(conversionRate);

    return response.getConversionRateResult();
  }
  public void submitQuest(int questID) throws LogonException {
    if (!session.alreadyLoggedOn())
      throw new LogonException("Not Logged On; Session does not exist");

    SubmitQuestRequest submitQuestRequest = new SubmitQuestRequest();
    submitQuestRequest.setSessionId(session.getSessionId());
    submitQuestRequest.setQuestID(questID);

    wsTemplate.marshalSendAndReceive(submitQuestRequest);
  }
  public List<BuildingInfo> getBuildings() throws LogonException {
    if (!session.alreadyLoggedOn())
      throw new LogonException("Not Logged On; Session does not exist");

    GetBuildingsRequest getBuildingsRequest = new GetBuildingsRequest();
    getBuildingsRequest.setSessionId(session.getSessionId());

    return ((GetBuildingsResponse) wsTemplate.marshalSendAndReceive(getBuildingsRequest))
        .getPayload()
        .getGetBuildingsResponseMessage()
        .getBuildings();
  }
  public List<QuestNPCInfo> getQuests(int npcID) throws LogonException {
    if (!session.alreadyLoggedOn())
      throw new LogonException("Not Logged On; Session does not exist");

    GetQuestsNPCRequest questsNPCRequest = new GetQuestsNPCRequest();
    questsNPCRequest.setSessionId(session.getSessionId());
    questsNPCRequest.setNPCID(npcID);

    GetQuestsNPCResponse getQuestsNPCResponse =
        (GetQuestsNPCResponse) wsTemplate.marshalSendAndReceive(questsNPCRequest);

    return getQuestsNPCResponse.getPayload().getQuestsNPCResponseMessage().getQuests();
  }
  public String respawn() throws LogonException {

    // Make sure user is already logged on before letting them logout
    if (!session.alreadyLoggedOn())
      throw new LogonException("Not Logged On; Session does not exist");

    RespawnRequest respawnRequest = new RespawnRequest();
    respawnRequest.setSessionId(session.getSessionId());

    RespawnResponse logoutResponse =
        (RespawnResponse) wsTemplate.marshalSendAndReceive(respawnRequest);

    return logoutResponse.getStatus();
  }
  public void logout() throws LogonException {

    // Make sure user is already logged on before letting them logout
    if (!session.alreadyLoggedOn())
      throw new LogonException("You must first be logged on before calling Logout");

    LogoutRequest logoutRequest = new LogoutRequest();
    logoutRequest.setSessionId(session.getSessionId());

    LogoutResponse logoutResponse =
        (LogoutResponse) wsTemplate.marshalSendAndReceive(logoutRequest);
    System.out.println("logout response = " + logoutResponse.getStatus());
    session.wipe();
  }
  public String runAdminCommand(String adminCommand) throws LogonException {

    // Make sure user is  already logged on
    if (!session.alreadyLoggedOn())
      throw new LogonException("Not Logged On; Session does not exist");

    AdminCommandRequest adminCommandRequest = new AdminCommandRequest();
    adminCommandRequest.setSessionId(session.getSessionId());
    adminCommandRequest.setCommand(adminCommand);

    AdminCommandResponse adminCommandResponse =
        (AdminCommandResponse) wsTemplate.marshalSendAndReceive(adminCommandRequest);

    return adminCommandResponse.getStatus();
  }
  public List<String> playerAttack() throws LogonException {
    if (!session.alreadyLoggedOn())
      throw new LogonException("Not Logged On; Session does not exist");

    AttackEntityRequest attackEntityRequest = new AttackEntityRequest();
    attackEntityRequest.setSessionId(session.getSessionId());

    AttackEntityResponse attackEntityResponse =
        (AttackEntityResponse) wsTemplate.marshalSendAndReceive(attackEntityRequest);

    try {
      return attackEntityResponse.getPayload().getEntity();
    } catch (Exception e) {
      return null;
    }
  }
  public void login() throws LogonException {

    // Make sure user is not already logged on
    if (session.alreadyLoggedOn()) throw new LogonException("Already Logged On; Session Exists");

    LoginRequest loginRequest = new LoginRequest();
    loginRequest.setUserName(session.getUserName());

    LoginResponse loginResponse = (LoginResponse) wsTemplate.marshalSendAndReceive(loginRequest);
    System.out.println("login response = " + loginResponse.getSessionId());

    // See if the server returned an error.  If so, throw it to caller as an exception
    if (loginResponse.getSessionId().equalsIgnoreCase("Already Logged On"))
      throw new LogonException(loginResponse.getSessionId());

    session.setSessionId(loginResponse.getSessionId());
  }
  /**
   * @see org.apromore.filestore.client.FileStoreService#resetUserPassword(String, String)
   *     {@inheritDoc}
   */
  @Override
  @SuppressWarnings("unchecked")
  public boolean resetUserPassword(String username, String password) {
    LOGGER.debug("Preparing Reset the Users Password.....");

    ResetUserPasswordInputMsgType msg = new ResetUserPasswordInputMsgType();
    msg.setUsername(username);
    msg.setPassword(password);

    JAXBElement<ResetUserPasswordInputMsgType> request =
        WS_CLIENT_FACTORY.createResetUserPasswordRequest(msg);

    JAXBElement<ResetUserPasswordOutputMsgType> response =
        (JAXBElement<ResetUserPasswordOutputMsgType>)
            webServiceTemplate.marshalSendAndReceive(request);
    return response.getValue().isSuccess();
  }
  /**
   * @see org.apromore.filestore.client.FileStoreService#writeUser(org.apromore.model.UserType)
   *     {@inheritDoc}
   */
  @Override
  @SuppressWarnings("unchecked")
  public UserType writeUser(UserType user) throws Exception {
    LOGGER.debug("Preparing WriteUserRequest.....");

    WriteUserInputMsgType msg = new WriteUserInputMsgType();
    msg.setUser(user);

    JAXBElement<WriteUserInputMsgType> request = WS_CLIENT_FACTORY.createWriteUserRequest(msg);

    JAXBElement<WriteUserOutputMsgType> response =
        (JAXBElement<WriteUserOutputMsgType>) webServiceTemplate.marshalSendAndReceive(request);
    if (response.getValue().getResult().getCode() == -1) {
      throw new Exception(response.getValue().getResult().getMessage());
    }

    return response.getValue().getUser();
  }
  public double[] updateLocation(double x, double y) throws LogonException {

    // Make sure user is  already logged on
    if (!session.alreadyLoggedOn())
      throw new LogonException("Not Logged On; Session does not exist");

    SetMyLocationRequest setMyLocationRequest = new SetMyLocationRequest();
    setMyLocationRequest.setSessionId(session.getSessionId());
    setMyLocationRequest.setXCooridinate(x);
    setMyLocationRequest.setYCooridinate(y);

    SetMyLocationResponse setMyLocationResponse =
        (SetMyLocationResponse) wsTemplate.marshalSendAndReceive(setMyLocationRequest);

    return new double[] {
      setMyLocationResponse.getModifiedLocationX(), setMyLocationResponse.getModifiedLocationY()
    };
  }
  /** @see org.apromore.filestore.client.FileStoreService#readUserByEmail(String) {@inheritDoc} */
  @Override
  @SuppressWarnings("unchecked")
  public UserType readUserByEmail(String email) throws Exception {
    LOGGER.debug("Preparing ResetUserRequest.....");

    ReadUserByEmailInputMsgType msg = new ReadUserByEmailInputMsgType();
    msg.setEmail(email);

    JAXBElement<ReadUserByEmailInputMsgType> request =
        WS_CLIENT_FACTORY.createReadUserByEmailRequest(msg);

    JAXBElement<ReadUserByEmailOutputMsgType> response =
        (JAXBElement<ReadUserByEmailOutputMsgType>)
            webServiceTemplate.marshalSendAndReceive(request);
    if (response.getValue().getResult().getCode() == -1) {
      throw new Exception(response.getValue().getResult().getMessage());
    } else {
      return response.getValue().getUser();
    }
  }
  /*
   * (non-Javadoc)
   * @see com.bnpparibas.goe.service.edservice.UploadPerformanceDataService#execute(java.lang.String, java.lang.String,
   * java.lang.String, java.lang.String, byte[])
   */
  public Object execute(
      String edCodeText,
      String cutOffDateText,
      String signatureDataText,
      String uploadDateText,
      byte[] fileStream)
      throws Exception {

    UploadPerformanceDataMessageCallback callback =
        new UploadPerformanceDataMessageCallback(new URI(wsAddressingAction));
    callback.setEdCodeText(edCodeText);
    callback.setCutOffDateText(cutOffDateText);
    callback.setSignatureDataText(signatureDataText);
    callback.setUploadDateText(uploadDateText);

    UploadPerformanceDataRequest requestPayload = new UploadPerformanceDataRequest();
    requestPayload.setFilestream(fileStream);

    return (UploadPerformanceDataResponse)
        edwServicesTemplate.marshalSendAndReceive(serviceEndpoint, requestPayload, callback);
  }
  public List<NPCInfo> getNPCInfo() throws LogonException {

    // Make sure user is  already logged on
    if (!session.alreadyLoggedOn())
      throw new LogonException("Not Logged On; Session does not exist");

    // Finally try to get a list of user locations
    GetNPCInfoRequest getNPCInfoRequest = new GetNPCInfoRequest();
    getNPCInfoRequest.setSessionId(session.getSessionId());

    GetNPCInfoResponse getNPCInfoResponse =
        (GetNPCInfoResponse) wsTemplate.marshalSendAndReceive(getNPCInfoRequest);
    List<NPCInfo> npcList;

    try {
      npcList = getNPCInfoResponse.getPayload().getNPCInfoResponseMessage().getNPCs();
    } catch (NullPointerException e) {
      npcList = null;
    }

    return npcList;
  }