Пример #1
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;
  }
Пример #2
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());
  }
  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);
  }
Пример #4
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");
  }
Пример #5
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);
 }
 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();
 }
  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);
  }
Пример #8
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");
 }
Пример #9
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);
  }
Пример #10
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);
  }
 @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);
 }
Пример #12
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
 }
Пример #13
0
 public static void main(String[] args) {
   try {
     Endpoint.publish("http://localhost:18080/greeting", new GreetingService());
   } catch (Throwable t) {
     t.printStackTrace();
     System.exit(1);
   }
 }
  @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");
  }
 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
 }
 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());
   }
 }
Пример #17
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();
  }
Пример #18
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);
  }
 /**
  * @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);
 }
Пример #20
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));
  }
Пример #21
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");
  }
Пример #22
0
  @Test
  public void test1() throws Exception {
    log.info("Starting Server");

    Endpoint.publish(
        WebServiceUtils.createServiceAdress(BasseService.class, baseAdress), basseService);

    log.info("wait");
    List<Basse> basses = basseServiceClient.getBasses();
    for (Basse basse : basses) {
      log.info("marque: " + basse.getMarque() + ", " + basse.getModel());
    }
  }
  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");
  }
Пример #24
0
 private CXFServer() {
   setName("CXFServer started at " + new Date().toString());
   Object implementor = new SchoolServiceWS();
   String address = "http://localhost:9000/SoapContext/SoapPort";
   System.out.println("Starting Server");
   try {
     Endpoint.publish(address, implementor);
     System.out.println("Server ready on http://localhost:9000/SoapContext/SoapPort ...");
   } catch (Throwable e) {
     System.out.println("Server NOT ready on http://localhost:9000/SoapContext/SoapPort ...");
     System.out.println("");
     e.printStackTrace();
   }
 }
Пример #25
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();
    }
  }
    protected void run() {
      SpringBusFactory factory = new SpringBusFactory();
      Bus bus = factory.createBus();
      BusFactory.setDefaultBus(bus);
      setBus(bus);

      ControlImpl implementor = new ControlImpl();
      implementor.setAddress("http://localhost:" + PORT + "/SoapContext/GreeterPort");
      GreeterImpl greeterImplementor = new GreeterImpl();
      greeterImplementor.setThrowAlways(true);
      greeterImplementor.useLastOnewayArg(true);
      implementor.setImplementor(greeterImplementor);
      ep = Endpoint.publish(CONTROL_PORT_ADDRESS, implementor);
      LOG.fine("Published control endpoint.");
    }
 public static void main(String[] args) {
   RetailerImpl retailerImpl;
   String retailerName;
   Scanner in = new Scanner(System.in);
   ;
   String port;
   String url;
   System.out.println("Please input the port number to publish your retailer:");
   port = in.nextLine();
   System.out.print("Input the name of current retailer:");
   retailerName = in.nextLine();
   url = "http://localhost:" + port + "/ws/retailer";
   retailerImpl = new RetailerImpl(retailerName);
   Endpoint.publish(url, retailerImpl);
   System.out.println(retailerName + " is published. The url is:" + url);
 }
Пример #28
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();
   }
 }
  public static void main(String[] args)
      throws IllegalArgumentException, IOException, URISyntaxException {
    String PROTOCOL = "http://";
    String HOSTNAME = InetAddress.getLocalHost().getHostAddress();
    if (HOSTNAME.equals("127.0.0.1")) {
      HOSTNAME = "localhost";
    }
    String PORT = "6902";
    String BASE_URL = "/ws/dbws";

    if (String.valueOf(System.getenv("PORT")) != "null") {
      PORT = String.valueOf(System.getenv("PORT"));
    }

    String endpointUrl = PROTOCOL + HOSTNAME + ":" + PORT + BASE_URL;
    System.out.println("Starting DB Service...");
    System.out.println("--> Published. Check out " + endpointUrl + "?wsdl");
    Endpoint.publish(endpointUrl, new DbwsImpl());
  }
Пример #30
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);
  }