private static void startShibbolethSNAA(
      String path,
      String prefix,
      String secretKeyURL,
      IUserAuthorization authorization,
      Injector injector,
      ShibbolethProxy shibbolethProxy) {

    log.debug(
        "Starting Shibboleth SNAA, path ["
            + path
            + "], prefix["
            + prefix
            + "], secretKeyURL["
            + secretKeyURL
            + "]");

    Set<String> prefixes = new HashSet<String>();
    prefixes.add(prefix);

    ShibbolethSNAAImpl shibSnaa =
        new ShibbolethSNAAImpl(prefixes, secretKeyURL, authorization, injector, shibbolethProxy);

    HttpContext context = server.createContext(path);
    Endpoint endpoint = Endpoint.create(shibSnaa);
    endpoint.publish(context);

    log.debug("Started shibboleth SNAA on " + server.getAddress() + path);
  }
  private static void startJAASSNAA(
      String path,
      String urnprefix,
      String jaasModuleName,
      String jaasConfigFile,
      IUserAuthorization authorization) {

    log.debug(
        "Starting JAAS SNAA, path ["
            + path
            + "], prefix["
            + urnprefix
            + "], jaasConfigFile["
            + jaasConfigFile
            + "], jaasModuleName["
            + jaasModuleName
            + "], authorization["
            + authorization
            + "]");

    System.setProperty("java.security.auth.login.config", jaasConfigFile);

    JAASSNAA jaasSnaa = new JAASSNAA(urnprefix, jaasModuleName, authorization);

    HttpContext context = server.createContext(path);
    Endpoint endpoint = Endpoint.create(jaasSnaa);
    endpoint.publish(context);

    log.debug("Started JAAS SNAA on " + server.getAddress() + path);
  }
  @Before
  public void setUp() throws Exception {
    bidderWS = new BidderWS("http://localhost:6166/BidderService?wsdl");
    endpoint = Endpoint.create(bidderWS);
    endpoint.publish("http://localhost:6166/BidderService");

    wsClient = new WSClient("http://localhost:6166/BidderService?wsdl");
  }
  private static void startDummySNAA(String path, String prefix) {

    DummySNAA dummySNAA = new DummySNAA();

    HttpContext context = server.createContext(path);
    Endpoint endpoint = Endpoint.create(dummySNAA);
    endpoint.publish(context);

    log.info("Started dummy SNAA on " + server.getAddress() + path);
  }
Beispiel #5
0
  protected Server() throws Exception {
    System.out.println("Starting Server");

    Endpoint ep = Endpoint.create(SOAPBinding.SOAP11HTTP_BINDING, new DoubleItPortTypeImpl());
    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put("ws-security.callback-handler", "service.ServiceKeystorePasswordCallback");
    properties.put("ws-security.signature.properties", "serviceKeystore.properties");
    properties.put(
        Endpoint.WSDL_PORT, new QName("http://www.example.org/contract/DoubleIt", "DoubleItPort"));
    ep.setProperties(properties);
    ep.publish("http://localhost:9000/doubleit/services/doubleit");
  }
  @Override
  public void init(ServletConfig config) throws ServletException {
    super.init(config);

    endpoint1 = Endpoint.create(SOAPBinding.SOAP11HTTP_BINDING, new EndpointBean());
    hostName = System.getProperty("jboss.bind.address", "localhost");
    hostName =
        (!hostName.startsWith("[") && hostName.indexOf(":") != -1)
            ? "[" + hostName + "]"
            : hostName;
    endpoint1.publish("http://" + hostName + ":8081/jaxws-endpoint");
    endpoint2 =
        Endpoint.publish(
            "http://" + hostName + ":8081/jaxws-endpoint2/endpoint/long/path", new EndpointBean());
  }
Beispiel #7
0
 public void testEntity() throws Exception {
   int port = PortAllocator.getFreePort();
   String address = "http://localhost:" + port + "/entity";
   Endpoint endpoint = Endpoint.create(new MyEndpoint());
   endpoint.publish(address);
   try {
     HTTPResponseInfo rInfo = sendEntity(address);
     String resp = rInfo.getResponseBody();
     if (resp.contains("x1y1")) {
       fail("Entity is getting resolved");
     }
     int code = rInfo.getResponseCode();
     assertEquals(HttpURLConnection.HTTP_INTERNAL_ERROR, code);
   } finally {
     endpoint.stop();
   }
 }
  private static void startFederator(
      FederatorType type,
      String path,
      String secretAuthKeyURL,
      Injector injector,
      ShibbolethProxy shibbolethProxy,
      Map<String, Set<String>>... prefixSets) {

    // union the prefix sets to one set
    Map<String, Set<String>> prefixSet = new HashMap<String, Set<String>>();
    for (Map<String, Set<String>> p : prefixSets) {
      prefixSet.putAll(p);
    }

    // Debug
    {
      log.debug("Starting Federator with the following prefixes: ");
      for (Entry<String, Set<String>> entry : prefixSet.entrySet()) {
        log.debug(
            "Prefix: url="
                + entry.getKey()
                + ", prefixes: "
                + Arrays.toString(entry.getValue().toArray()));
      }
    }

    switch (type) {
      case GENERIC:
        federator = new FederatorSNAA(prefixSet);
        break;
      case WISEBED:
        federator =
            new WisebedSnaaFederator(prefixSet, secretAuthKeyURL, injector, shibbolethProxy);
        break;
    }

    HttpContext context = server.createContext(path);
    Endpoint endpoint = Endpoint.create(federator);
    endpoint.publish(context);

    log.debug("Started " + type + " federator SNAA on " + server.getAddress() + path);
  }
Beispiel #9
0
  @Override
  public void start(BundleContext context) throws Exception {
    /* JNDI.properties added manually */
    Hashtable<String, String> MYHASH = new Hashtable<String, String>();
    MYHASH.put(
        "java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
    MYHASH.put("java.naming.provider.url", "tcp://localhost:61616");
    MYHASH.put("connectionFactoryNames", "connectionFactory");
    MYHASH.put("queue.requestQueue", "foot.requestQueue");
    MYHASH.put("queue.responseQueue", "foot.responseQueue");

    //		System.out.println("\n\n MyHASH : "+MYHASH.toString());

    /* put jndi.properties into bundle INFORMATIONS */
    context.registerService(Service.class.getName(), new Service(), MYHASH);

    /* publish WSDL of service */
    FootWorldCup impl = new FootWorldCup();
    endpoint = Endpoint.create(impl);
    endpoint.publish("http://localhost:8090/ws");
  }
Beispiel #10
0
  /**
   * Creates and publishes a messaging service endpoint at the specified address.
   *
   * @param service The service that should be started at <var>address</var>.
   * @return The newly created endpoint.
   */
  public static Endpoint publish(MessagingService service) {

    // service = new RequestTracer(new MessagingServiceImpl(service));
    service = new MessagingServiceImpl(service);

    Endpoint endpoint = Endpoint.create(service);
    endpoint.setProperties(
        new HashMap<String, Object>() {
          {
            put(
                Endpoint.WSDL_PORT,
                new QName(MessagingService.NAMESPACE, MessagingService.PORT_NAME));
            put(
                Endpoint.WSDL_SERVICE,
                new QName(MessagingService.NAMESPACE, MessagingService.SERVICE_NAME));
          }
        });

    String address = getServiceUrl();
    endpoint.publish(address);
    logger.log(Level.INFO, "Listening at {0}…", address);
    return endpoint;
  }
 @BeforeClass
 public static void setUp() throws WSDLException {
   try {
     conn = buildConnection();
   } catch (Exception e) {
     e.printStackTrace();
   }
   String ddlCreateProp = System.getProperty(DATABASE_DDL_CREATE_KEY, DEFAULT_DATABASE_DDL_CREATE);
   if ("true".equalsIgnoreCase(ddlCreateProp)) {
     ddlCreate = true;
   }
   String ddlDropProp = System.getProperty(DATABASE_DDL_DROP_KEY, DEFAULT_DATABASE_DDL_DROP);
   if ("true".equalsIgnoreCase(ddlDropProp)) {
     ddlDrop = true;
   }
   String ddlDebugProp = System.getProperty(DATABASE_DDL_DEBUG_KEY, DEFAULT_DATABASE_DDL_DEBUG);
   if ("true".equalsIgnoreCase(ddlDebugProp)) {
     ddlDebug = true;
   }
   if (ddlCreate) {
     runDdl(conn, CREATE_OPTLOCK_TABLE, ddlDebug);
     try {
       Statement stmt = conn.createStatement();
       for (int i = 0; i < POPULATE_OPTLOCK_TABLE.length; i++) {
         stmt.addBatch(POPULATE_OPTLOCK_TABLE[i]);
       }
       stmt.executeBatch();
     } catch (SQLException e) {
       if (ddlDebug) {
         e.printStackTrace();
       }
     }
   }
   builder.setProjectName(OPTLOCK_TEST);
   builder.setTargetNamespace(OPTLOCK_NAMESPACE);
   TableOperationModel tModel = new TableOperationModel();
   tModel.setName(OPTLOCK);
   tModel.setTablePattern(OPTLOCK);
   builder.getOperations().add(tModel);
   builder.quiet = true;
   // builder.setLogLevel(SessionLog.FINE_LABEL);
   builder.setLogLevel(SessionLog.OFF_LABEL);
   builder.setDriver(DATABASE_DRIVER);
   builder.setPlatformClassname(DATABASE_PLATFORM);
   builder.getProperties().put(SESSIONS_FILENAME_KEY, NO_SESSIONS_FILENAME);
   builder.setUsername(username);
   builder.setPassword(password);
   builder.setUrl(url);
   builder.setPackager(
       new JSR109WebServicePackager(null, "WebServiceTestPackager", noArchive) {
         @Override
         public void start() {}
       });
   builder.build(
       DBWS_SCHEMA_STREAM,
       __nullStream,
       DBWS_SERVICE_STREAM,
       DBWS_OR_STREAM,
       DBWS_OX_STREAM,
       __nullStream,
       __nullStream,
       DBWS_WSDL_STREAM,
       __nullStream,
       __nullStream,
       __nullStream,
       __nullStream,
       null);
   endpoint = Endpoint.create(new OptLockTestSuite());
   endpoint.publish(ENDPOINT_ADDRESS);
   QName serviceQName = new QName(OPTLOCK_SERVICE_NAMESPACE, OPTLOCK_SERVICE);
   portQName = new QName(OPTLOCK_SERVICE_NAMESPACE, OPTLOCK_PORT);
   testService = Service.create(serviceQName);
   testService.addPort(portQName, SOAP11HTTP_BINDING, ENDPOINT_ADDRESS);
 }
 /**
  * Sets up a Endpoint for listenign to non-anonymous responses, which uses the Exchanger to pass
  * the request message. This in unnecessary for anonymous tests.
  *
  * @throws Exception
  */
 protected void setUp() throws Exception {
   super.setUp();
   nonAnonAddress = getNonAnonymousClientAddress();
   responseProcessor = Endpoint.create(new NonAnonymousRespProcessor(respMsgExchanger));
   responseProcessor.publish(nonAnonAddress);
 }