Package de.innovationgate.wgaservices

Source Code of de.innovationgate.wgaservices.Test

/*******************************************************************************
* Copyright 2009, 2010 Innovation Gate GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package de.innovationgate.wgaservices;

import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.activation.DataSource;
import javax.activation.FileDataSource;

import de.innovationgate.wgaservices.types.Form;
import de.innovationgate.wgaservices.types.RemoteSession;

public class Test {

  /**
   * @param args
   */
  public static void main(String[] args) {
    try {
      WGACoreServices client = ClientFactory.createCoreServiceClient("http://localhost:8080/WGAPublisher");     
      RemoteSession session = client.adminLogin("admin", "wga");
      ActionCaller caller = ClientFactory.createActionCaller(client, session, "website");
      //List<Object> params = new ArrayList<Object>();
      //params.add("A");
      //params.add("B");
      //params.add("C");
      //caller.callAction("myRemoteAction");
      //caller.callAction("myRemoteAction", params);
      Form form = new Form("test");
      form.setField("myfield", "value");
      form.setField("aDate", new Date());
      form.setField("aNumber", new Integer(4711));
      form.addFileAsAttachment(new File("/home/tbinias/downloads/eclipse-SDK-3.4.2-linux-gtk-x86_64.tar.gz"), "eclipse.tgz");
      Object result = caller.callAction("myRemoteAction", null, form);
      System.out.println(result);
      //List<DataSource> tmpList = new ArrayList<DataSource>();
      //tmpList.add(new FileDataSource(new File("/home/tbinias/downloads/eclipse-SDK-3.4.2-linux-gtk-x86_64.tar.gz")));
      //client.installPlugins(session, tmpList);
     
    } catch (MalformedURLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (WGAServiceException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

  }

}
TOP

Related Classes of de.innovationgate.wgaservices.Test

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.