Ejemplo n.º 1
0
  protected void doGet(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    // Create the port
    //    URL wsdlURL = getServletContext().getResource("/WEB-INF/wsdl/TestService.wsdl");
    URL wsdlURL = new URL("http://" + hostName + ":8081/jaxws-endpoint?wsdl");
    QName qname = new QName("http://org.jboss.ws/jaxws/endpoint", "EndpointService");
    Service service = Service.create(wsdlURL, qname);
    EndpointInterface port = (EndpointInterface) service.getPort(EndpointInterface.class);

    // Invoke the endpoint
    String param = req.getParameter("param");
    String retStr = port.echo(param);

    // Test epr
    DocumentBuilder builder = getDocumentBuilder();
    assertEndpointReference(
        endpoint1.getEndpointReference(DOMUtils.parse(TEST_ELEMENT, builder)),
        TEST_ELEMENT,
        builder);
    assertEndpointReference(
        endpoint1.getEndpointReference(W3CEndpointReference.class, (Element[]) null),
        null,
        builder);

    // Return the result
    PrintWriter pw = new PrintWriter(res.getWriter());
    pw.print(retStr);
    pw.close();
  }
Ejemplo n.º 2
0
  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);
  }
  private void subTestServiceCall() throws Exception {
    // server.start();
    final Service service = Service.create(getClass().getResource(wsdlLocation), SERVICE_NAME);
    service.addPort(PORT_NAME, endpointInfo.getBinding().getBindingId(), endpointInfo.getAddress());

    // 1. Register a local callback endpoint on the client side
    final ClientProviderHandler callbackHandler =
        new ClientProviderHandler(errorTransfer, messageTransfer, callbackMap);
    final Endpoint ep = CallContext.createCallbackEndpoint(callbackHandler, wsdlLocation);
    callbackEndpoint = ep;
    ep.publish(CLIENT_CALLBACK_ENDPOINT);

    // 2. Create a client
    final Dispatch<StreamSource> dispatcher =
        service.createDispatch(PORT_NAME, StreamSource.class, Service.Mode.PAYLOAD);
    CallContext.setupDispatch(dispatcher, ep);
    if (mep == REQUEST_CALLBACK_ENFORCED) {
      final QName opName = new QName(SERVICE_NAMESPACE, operation);
      CallContext.enforceOperation(opName, dispatcher);
    }

    // 3. Invoke the service operation
    final StreamSource request = new StreamSource(getClass().getResourceAsStream(requestLocation));
    dispatcher.invokeOneWay(request);
    assertTrue(messageTransfer.take() != null);
    sleep(1);
    checkError(false);
  }
Ejemplo n.º 4
0
  @Override
  public boolean startGreeter(String cfgResource) {
    String derbyHome = System.getProperty("derby.system.home");
    try {
      System.setProperty("derby.system.home", derbyHome + "-server");
      SpringBusFactory bf = new SpringBusFactory();
      greeterBus = bf.createBus(cfgResource);
      BusFactory.setDefaultBus(greeterBus);
      LOG.info("Initialised bus " + greeterBus + " with cfg file resource: " + cfgResource);
      LOG.fine("greeterBus inInterceptors: " + greeterBus.getInInterceptors());

      Interceptor logIn = new LoggingInInterceptor();
      Interceptor logOut = new LoggingOutInterceptor();
      greeterBus.getInInterceptors().add(logIn);
      greeterBus.getOutInterceptors().add(logOut);
      greeterBus.getOutFaultInterceptors().add(logOut);

      if (cfgResource.indexOf("provider") == -1) {
        Endpoint.publish(address, implementor);
        LOG.info("Published greeter endpoint.");
      } else {
        Endpoint.publish(address, new GreeterProvider());
        LOG.info("Published greeter provider.");
      }
    } finally {
      if (derbyHome != null) {
        System.setProperty("derby.system.home", derbyHome);
      } else {
        System.clearProperty("derby.system.home");
      }
    }

    return true;
  }
Ejemplo n.º 5
0
  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);
  }
Ejemplo n.º 6
0
  @Override
  public void destroy() {
    endpoint1.stop();
    endpoint2.stop();

    super.destroy();
  }
 @Before
 public void setUp() throws Exception {
   endpoint =
       Endpoint.publish(
           "http://localhost:" + port + "/CxfMtomPOJOProducerTest/jaxws-mtom/hello", getImpl());
   SOAPBinding binding = (SOAPBinding) endpoint.getBinding();
   binding.setMTOMEnabled(true);
 }
  @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");
  }
Ejemplo n.º 9
0
  public static void main(final String[] args) {

    String url = (args.length > 0) ? args[0] : "http://localhost:4434/buecherservice";
    System.out.println("url: " + url);
    Endpoint ep = Endpoint.publish(url, new BuecherServiceImpl());
    System.out.println("published");
    JOptionPane.showMessageDialog(null, "TestWsServer beenden");
    ep.stop();
  }
Ejemplo n.º 10
0
  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);
  }
Ejemplo n.º 11
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");
  }
Ejemplo n.º 12
0
  @Test
  public void testWSDLPublishWithCatalogs() throws Exception {
    Endpoint ep =
        Endpoint.publish("http://localhost:" + PORT + "/SoapContext/SoapPort", new GreeterImpl());

    try {
      String result =
          readUrl(
              "http://localhost:"
                  + PORT
                  + "/SoapContext/SoapPort?"
                  + "xsd=hello_world_schema2.xsd");
      assertTrue(result, result.contains("xsd=hello_world_schema.xsd"));
      assertTrue(result, result.contains("xsd=hello_world_schema3.xsd"));
      assertTrue(result, result.contains("xsd=d/hello_world_schema4.xsd"));

      result =
          readUrl(
              "http://localhost:"
                  + PORT
                  + "/SoapContext/SoapPort?"
                  + "xsd=hello_world_schema3.xsd");
      assertTrue(result.length() > 0);

      result =
          readUrl(
              "http://localhost:"
                  + PORT
                  + "/SoapContext/SoapPort?"
                  + "xsd=d/hello_world_schema4.xsd");
      assertTrue(result, result.contains("xsd=d/d/hello_world_schema4.xsd"));

      result =
          readUrl(
              "http://localhost:" + PORT + "/SoapContext/SoapPort" + "?xsd=hello_world_schema.xsd");
      assertTrue(
          result,
          result.contains("xsd=http://apache.org/hello_world/types2/hello_world_schema2.xsd"));

      result =
          readUrl(
              "http://localhost:"
                  + PORT
                  + "/SoapContext/SoapPort"
                  + "?wsdl=hello_world_messages_catalog.wsdl");
      assertTrue(result, result.contains("xsd=hello_world_schema.xsd"));
    } finally {
      ep.stop();
    }
  }
Ejemplo n.º 13
0
  @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());
  }
Ejemplo n.º 14
0
  /**
   * Funcion que permite publicar la url del servicio Web
   *
   * @param arg
   */
  public static void main(String arg[]) {
    String ip = "";
    String puerto = "";

    try {
      ResourceBundle rb = ResourceBundle.getBundle("co.com.codesoftware.properties.baseProperties");
      String valida = rb.getString("IP_DINAMICA");

      if ("SI".equalsIgnoreCase(valida)) {
        ip = rb.getString("IP_FIJA");
      } else {
        ip = InetAddress.getLocalHost().getHostAddress();
      }
      puerto = rb.getString("PUERTO");
    } catch (UnknownHostException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    System.out.println("Este es la ip: " + ip);
    Endpoint.publish("http://" + ip + ":" + puerto + "/WS/server", new SAFWS());
    System.out.println(
        "Servicos desplegados en la siguiente direccion: \n\n\n"
            + "http://"
            + ip
            + ":"
            + puerto
            + "/WS/server/SAFWS?wsdl");
  }
Ejemplo n.º 15
0
 public void startup() {
   // TODO Auto-generated method stub
   HelloWebServiceImp implementor = new HelloWebServiceImp();
   String address = "http://localhost:9090/helloWorld";
   Endpoint.publish(address, implementor);
   System.out.println("Starting WebServer::" + "http://localhost:9090/helloWorld");
 }
 public static void main(String[] argv) throws SQLException {
   AssetLifecycleManagement implementor = new AssetLifecycleManagement();
   implementor.initMaintenanceScheduler();
   String address = "http://localhost:9000/AssetLifecycleManagement";
   Endpoint.publish(address, implementor);
   implementor.close();
 }
Ejemplo n.º 17
0
  protected void run() {
    String port = TestUtil.getPortNumber(Server.class);

    Object implementor = new HandlerTestImpl();
    String address = "http://localhost:" + port + "/HandlerTest/SoapPort";
    Endpoint.publish(address, implementor);
  }
Ejemplo n.º 18
0
 public static void main(String[] args) {
   ApplicationContext ctx =
       new ClassPathXmlApplicationContext("net/tomastrnka/lab/citrus/ws/application-context.xml");
   ReservationServiceImpl reservationService = new ReservationServiceImpl();
   reservationService.setDao(ctx.getBean(ReservationDAO.class));
   Endpoint.publish("http://localhost:7777/ws/ReservationService", reservationService);
 }
Ejemplo n.º 19
0
 public static void main(String[] args) {
   try {
     Endpoint.publish("http://localhost:18080/greeting", new GreetingService());
   } catch (Throwable t) {
     t.printStackTrace();
     System.exit(1);
   }
 }
Ejemplo n.º 20
0
 protected Server() throws Exception {
   // START SNIPPET: publish
   System.out.println("Starting Server");
   FileServiceImpl implementor = new FileServiceImpl();
   String address = "http://localhost:9000/FileService";
   Endpoint.publish(address, implementor);
   // END SNIPPET: publish
 }
Ejemplo n.º 21
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();
   }
 }
 protected TalendTutoServiceMockStarter() throws Exception {
   // START SNIPPET: publish
   System.out.println("Starting Server");
   AirportSoap implementor = new AirportSoapImpl();
   String address = "http://localhost:8200/esb/AirportService";
   Endpoint.publish(address, implementor);
   System.out.println("Server started");
   // END SNIPPET: publish
 }
Ejemplo n.º 23
0
 @AfterClass
 public static void teardown() {
   if (endpoint != null) {
     endpoint.stop();
   }
   if (ddlDrop) {
     runDdl(conn, DROP_OPTLOCK_TABLE, ddlDebug);
   }
 }
 public static void main(String... str) {
   // EndpointPublisher.main("6666","/doclitbare","com.pg.ws.service.doc.lit.bare.DocLitBareServiceClass");
   try {
     Endpoint.publish("http://localhost:6668/doclitbaretest/", new DocLitBareServiceClass());
     System.out.println("deployed..");
   } catch (Exception e) {
     System.out.println(" FAILED " + e.getMessage());
   }
 }
Ejemplo n.º 25
0
 protected void tearDown() throws Exception {
   super.tearDown();
   // Sleep to give endpoint some time to process the non-anonymous request
   // this is needed in case the object is exchanged between client and non-anonymous response
   // endpoint,
   // which leads to test tearDown(), yet the ack to non-anonymous response is not sent back to
   // server yet.
   Thread.sleep(5000);
   if (responseProcessor != null) responseProcessor.stop();
 }
Ejemplo n.º 26
0
  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);
  }
Ejemplo n.º 27
0
 /**
  * @param args
  * @throws JAXBException
  */
 public static void main(String[] args) throws JAXBException {
   // TODO Auto-generated method stub
   // debug-----------
   for (int i = 0; i < args.length; ++i) {
     System.out.println(args[i]);
   }
   // ----------------
   WsnProcessImpl wsnprocess = new WsnProcessImpl();
   wsnprocess.init();
   Endpoint.publish(args[0], wsnprocess);
 }
Ejemplo n.º 28
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");
  }
Ejemplo n.º 29
0
  protected void run() {
    Object implementor = new GreeterImpl();
    String address = "http://localhost:" + REG_PORT + "/XMLService/XMLPort";
    eps.add(Endpoint.publish(address, implementor));

    Object implementor1 = new org.apache.hello_world_xml_http.wrapped.GreeterImpl();
    address = "http://localhost:" + WRAP_PORT + "/XMLService/XMLPort";
    eps.add(Endpoint.publish(address, implementor1));

    Object faultImplementor = new GreeterFaultImpl();
    String faultAddress = "http://localhost:" + REG_PORT + "/XMLService/XMLFaultPort";
    eps.add(Endpoint.publish(faultAddress, faultImplementor));

    Object implementor2 = new HeaderTesterImpl();
    address = "http://localhost:" + REG_PORT + "/XMLContext/XMLPort";
    eps.add(Endpoint.publish(address, implementor2));

    Object implementor3 = new org.apache.hello_world_xml_http.mixed.GreeterImpl();
    address = "http://localhost:" + MIX_PORT + "/XMLService/XMLPort";
    eps.add(Endpoint.publish(address, implementor3));
  }
  public static void main(String[] args) {
    // Source: http://stackoverflow.com/a/16338394/873282 - works on JDK8
    System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true");
    System.setProperty(
        "com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", "true");
    System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true");
    System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true");

    String endpointLocation = "http://localhost:1235/ProcessOrder";
    Endpoint.publish(endpointLocation, new ProcessOrder());
    System.out.println("published at " + endpointLocation);
    System.out.println("Get the WSDL at " + endpointLocation + "?wsdl");
  }