Define an Endpoint Java Example

Best Java code snippets using javax.xml.ws.Endpoint (Showing top 20 results out of 2,313)

Refine searchRefine arrow

                                  @Override                                                                                                                                                protected                                                                                                                                    void                                                                              publishEndpoint(Endpoint endpoint, WebServiceProvider annotation) {                                                                                                                                                    endpoint.                                                        publish                                                        (buildHttpContext(endpoint, annotation.serviceName()));                                                                                        }                                                                                
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @Override                                                                                                                                                public                                                                                                                                    void                                                                              destroy() {                                                                                                                                                                                                          for                                                                              (Endpoint endpoint :                                                                            this                                                        .publishedEndpoints) {                                                                                                                                                    endpoint.                                                        stop                                                        ();                                                                                                          }                                                  }                                                                                
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        protected                                                                              Endpoint createEndpoint(Object bean) {                                                                                                                                                                                                          return                                                                              (                                                        this                                                        .endpointFeatures != null ?                                                                                                                                                    Endpoint.                                                        create                                                        (                                                        this                                                        .bindingType, bean,                                                                            this                                                        .endpointFeatures) :                                                                                                                                                    Endpoint.                                                        create                                                        (                                                        this                                                        .bindingType, bean));                                                                                        }                                                                                
                                                                                                                          Endpoint endpoint = createEndpoint(                                                        this                                                        .beanFactory.getBean(beanName));                                                                                                                                                                                      if                                                                              (                                                        this                                                        .endpointProperties != null) {                                                                                                                                                    endpoint.                                                        setProperties                                                        (                                                        this                                                        .endpointProperties);                                                                                                                                                                                                      endpoint.                                                        setExecutor                                                        (                                                        this                                                        .executor);                                                                                                                      
                                                                                                                                protected                                                                                                                                    void                                                                              run()  {                                                                                                                                                    String configurationFile =                                                                            "undertowBasicAuthServer.xml"                                                        ;                                                                                                          URL configure =                                                                                                              UndertowBasicAuthServer.                                                        class                                                        .getResource(configurationFile);                                                                                                                                                    Bus bus =                                                                            new                                                                                                                                    SpringBusFactory                                                        ().                                                        createBus                                                        (configure,                                                                            true                                                        );                                                                                                                                                    bus.                                                        getInInterceptors                                                        ().add(                                                        new                                                                              LoggingInInterceptor());                                                                                                                                                    bus.                                                        getOutInterceptors                                                        ().add(                                                        new                                                                              LoggingOutInterceptor());                                                                                                                                                    BusFactory.                                                        setDefaultBus                                                        (bus);                                                                                                          setBus(bus);                                                                                                                                                                GreeterImpl implementor =                                                                            new                                                                              GreeterImpl();                                                                                                                                                    ep = Endpoint.                                                        publish                                                        (ADDRESS, implementor);                                                                                        }                                                                                
                                                                                                                                public                                                                                                                                    void                                                                              run()  {                                                                                                                                                    SpringBusFactory sf =                                                                            new                                                                                                                                    SpringBusFactory                                                        ();                                                                                                                                                    BusFactory.                                                        setDefaultBus                                                        (null);                                                                                                                                                    BusFactory.                                                        setDefaultBus                                                        (                                                                                                                                                    sf.                                                        createBus                                                        (                                                        "org/apache/cxf/systest/type_test/databinding-schema-validation.xml"                                                        ));                                                                                                                                                                                                      Object implementor =                                                                            new                                                                              XMLTypeTestImpl();                                                                                                                                                    String address =                                                                            "http://localhost:"                                                                              + PORT +                                                                            "/XMLService/XMLPort/"                                                        ;                                                                                                                                                    Endpoint.                                                        publish                                                        (address, implementor);                                                                                        }                                                                                
                                                                                                                                private                                                                                                                                    void                                                                              createAndPublishUTPort() {                                                                                                                                                    Endpoint ep = Endpoint.                                                        create                                                        (SOAPBinding.SOAP11HTTP_BINDING,                                                                            new                                                                              GreeterImpl());                                                                                                                                                    Map<String, Object> properties =                                                                            new                                                                              HashMap<String, Object>();                                                                                                                                                    properties.put(                                                        "security.callback-handler"                                                        ,                                                                                                                                                                                                          "com.talend.examples.secure_greeter.PasswordCallback"                                                        );                                                                                                                                                    properties.put(                                                        "security.signature.properties"                                                        ,                                                                                                                                                                                                          "/ws-secpol-wsdl/service.properties"                                                        );                                                                                                          properties.put(                                                                    Endpoint.WSDL_PORT,                                                                                                                                                                    new                                                                              QName(                                                        "http://talend.com/examples/secure-greeter"                                                        ,                                                                            "UTGreeterPort"                                                        )                                                                                                          );                                                                                                              ep.                                                        setProperties                                                        (properties);                                                                                                                                                    ep.                                                        publish                                                        (                                                        "http://localhost:9000/SecureUTGreeter"                                                        );                                                                                        }                                                                                
                                                                                                                                protected                                                                                                                                    void                                                                              run() {                                                                                                                                                    setBus(BusFactory.                                                        getDefaultBus                                                        ());                                                                                                                                                    Object implementor =                                                                            new                                                                              GreeterImpl();                                                                                                                                                    String address =                                                                            "http://localhost:"                                                                                                                                                                                                            + TestUtil.getPortNumber(DispatchClientServerTest.                                                        class                                                        )                                                                                                                                                    +                                                                            "/SOAPDispatchService/SoapDispatchPort"                                                        ;                                                                                                                                                    ep = Endpoint.                                                        create                                                        (SOAPBinding.SOAP11HTTP_BINDING, implementor);                                                                                                                                                    Map<String, Object> properties =                                                                            new                                                                              HashMap<>();                                                                                                                                                    Map<String, String> nsMap =                                                                            new                                                                              HashMap<>();                                                                                                                                                    nsMap.put(                                                        "gmns"                                                        ,                                                                            "http://apache.org/hello_world_soap_http/types"                                                        );                                                                                                                                                    properties.put(                                                        "soap.env.ns.map"                                                        , nsMap);                                                                                                                                                    properties.put(                                                        "disable.outputstream.optimization"                                                        ,                                                                            "true"                                                        );                                                                                                                                                                                                      ep.                                                        setProperties                                                        (properties);                                                                                                                                                    ep.                                                        publish                                                        (address);                                                                                                                                                    BusFactory.                                                        setDefaultBus                                                        (null);                                                                                                                                                    BusFactory.                                                        setThreadDefaultBus                                                        (null);                                                                                        }                                                  @Override                              
                                                                                                                                private                                                                                                                                    void                                                                              doPublish(String url, Object obj) {                                                                                                                                                    Endpoint ep = Endpoint.                                                        create                                                        (obj);                                                                                                                                                    ep.                                                        getProperties                                                        ().put(SecurityConstants.CALLBACK_HANDLER,                                                                            new                                                                              KeystorePasswordCallback());                                                                                                                                                    ep.                                                        getProperties                                                        ().put(SecurityConstants.ENCRYPT_PROPERTIES,                                                                                                                                                                                                          "bob.properties"                                                        );                                                                                                                                                                                                          if                                                                              (streaming) {                                                                                                                                                    ep.                                                        getProperties                                                        ().put(SecurityConstants.ENABLE_STREAMING_SECURITY,                                                                            "true"                                                        );                                                                                                          }                                                                                                              ep.                                                        publish                                                        (url);                                                                                        }                                                                                
                                                                                                                                public                                                                              Endpoint publish(String address, Object o, Class<?> ... extraClasses) {                                                                                                                                                                                                          if                                                                              (extraClasses != null && extraClasses.length >                                                                            0                                                        ) {                                                                                                                                                                                                          throw                                                                                                                                    new                                                                              UnsupportedOperationException(                                                        "Pure JAX-WS does not support the extraClasses"                                                        );                                                                                                          }                                                                                                              Endpoint endpoint = Endpoint.                                                        create                                                        (o);                                                                                                          URL wsdlLocation = WSNWSDLLocator.getWSDLUrl();                                                                                                                                                                    if                                                                              (wsdlLocation != null) {                                                                                                                                                                                                          try                                                                              {                                                                                                                                                                                                          if                                                                              (endpoint.                                                        getProperties                                                        () == null) {                                                                                                                                                    endpoint.                                                        setProperties                                                        (                                                        new                                                                              HashMap<String, Object>());                                                                                                          }                                                                                                              endpoint.                                                        getProperties                                                        ().put(                                                        "javax.xml.ws.wsdl.description"                                                        , wsdlLocation.toExternalForm());                                                                                                                                                    List<Source> mt =                                                                            new                                                                              ArrayList<>();                                                                                                                                                    StreamSource src =                                                                            new                                                                              StreamSource(wsdlLocation.openStream(), wsdlLocation.toExternalForm());                                                                                                          mt.add(src);                                                                                                              endpoint.                                                        setMetadata                                                        (mt);                                                                                                                                                    }                                                                            catch                                                                              (IOException e) {                                                                                                                                                                                                                                                                                                                                      }                                                                    }                                                                                                                                                                endpoint.                                                        publish                                                        (address);                                                                                                                                                                                                          return                                                                              endpoint;                                                                                        }                                                                                
                                  @BeforeClass                                                                                                                                                public                                                                                                                                    static                                                                                                                                    void                                                                              startServers()                                                                            throws                                                                              Exception {                                                                                                                                                    bus = BusFactory.                                                        getDefaultBus                                                        ();                                                                                                                                                    ActiveMQConnectionFactory cf =                                                                            new                                                                              ActiveMQConnectionFactory(                                                        "vm://localhost?broker.persistent=false"                                                        );                                                                                                                                                    PooledConnectionFactory cfp =                                                                            new                                                                              PooledConnectionFactory(cf);                                                                                                                                                    cff =                                                                            new                                                                              ConnectionFactoryFeature(cfp);                                                                                                                                                    String address =                                                                            "http://localhost:"                                                                              + PORT +                                                                            "/SOAPDocLitService/SoapPort"                                                        ;                                                                                                                                                    Endpoint.                                                        publish                                                        (address,                                                                            new                                                                              HTTPGreeterImpl());                                                                                                                                                    EndpointImpl ep1 = (EndpointImpl)Endpoint.                                                        create                                                        (                                                        new                                                                              JMSGreeterImpl());                                                                                                                                                    ep1.                                                        setBus                                                        (bus);                                                                                                                                                    ep1.                                                        getFeatures                                                        ().add(cff);                                                                                                                                                    ep1.                                                        publish                                                        ();                                                                                        }                                                                                
                                                                                                                                protected                                                                                                                                    void                                                                              run() {                                                                                                                                                    SpringBusFactory bf =                                                                            new                                                                                                                                    SpringBusFactory                                                        ();                                                                                                                                                    Bus bus = bf.                                                        createBus                                                        (SERVER_CONFIG_FILE);                                                                                                          setBus(bus);                                                                                                              BusFactory.                                                        setDefaultBus                                                        (bus);                                                                                                                                                                                                      Object implementor =                                                                            new                                                                              HelloImplWithWrapppedContinuation();                                                                                                                                                    String address =                                                                            "http://localhost:"                                                                              + PORT +                                                                            "/hellocontinuation"                                                        ;                                                                                                                                                    EndpointImpl endpointImpl = (EndpointImpl)Endpoint.                                                        publish                                                        (address, implementor);                                                                                                                                                    endpointImpl.                                                        getInInterceptors                                                        ().add(                                                        new                                                                              LoggingInInterceptor());                                                                                                                                                    endpointImpl.                                                        getOutInterceptors                                                        ().add(                                                        new                                                                              LoggingOutInterceptor());                                                                                                                                                    address =                                                                            "https://localhost:"                                                                              + HTTPS_PORT +                                                                            "/securecontinuation"                                                        ;                                                                                                                                                    Endpoint.                                                        publish                                                        (address, implementor);                                                                                        }                                                                                
                                                                                                                                private                                                                                                                                    void                                                                              makeTwoWayCallOnNewBus(URL wsdlUrl, String address) {                                                                                                                                                    SpringBusFactory bf =                                                                            new                                                                                                                                    SpringBusFactory                                                        ();                                                                                                                                                    Bus bus = bf.                                                        createBus                                                        ();                                                                                                                                                    BusFactory.                                                        setDefaultBus                                                        (bus);                                                                                                          Endpoint ep = createService(address);                                                                    doWork(wsdlUrl, address);                                                                                                                                                                                                                                                                                                                                          ep.                                                        stop                                                        ();                                                                                                                                                    bus.                                                        shutdown                                                        (                                                        true                                                        );                                                                                        }                                                                                
                                                                                                                                protected                                                                                                                                    void                                                                              run()  {                                                                                                          String address;                                                                                                              Object implementor =                                                                            new                                                                              ServicePortTypeImpl();                                                                                                                                                    address =                                                                            "http://localhost:"                                                                              + PORT +                                                                            "/schemavalidation"                                                        ;                                                                                                                                                    Endpoint ep = Endpoint.                                                        create                                                        (implementor);                                                                                                                                                    Map<String, Object> map =                                                                            new                                                                              HashMap<>();                                                                                                          map.put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE);                                                                                                              ep.                                                        setProperties                                                        (map);                                                                                                                                                    ((EndpointImpl)ep).                                                        setWsdlLocation                                                        (                                                        "wsdl_systest_jaxws/schemaValidation.wsdl"                                                        );                                                                                                                                                    ((EndpointImpl)ep).                                                        setServiceName                                                        (                                                        new                                                                              QName(                                                                                                                                                                                                          "http://cxf.apache.org/jaxws/schemavalidation"                                                        ,                                                                            "service"                                                        ));                                                                                                                                                    ((EndpointImpl)ep).                                                        getInInterceptors                                                        ().add(                                                        new                                                                              LoggingInInterceptor());                                                                                                                                                    ((EndpointImpl)ep).                                                        getOutInterceptors                                                        ().add(                                                        new                                                                              LoggingOutInterceptor());                                                                                                                                                    ep.                                                        publish                                                        (address);                                                                                        }                                                                                
                                                                                                                                protected                                                                                                                                    void                                                                              run() {                                                                                                                                                    Object implementor =                                                                            new                                                                              AddNumberImpl();                                                                                                                                                    String address =                                                                            "http://localhost:"                                                                              + PORT +                                                                            "/jaxws/add"                                                        ;                                                                                                                                                                                                      EndpointImpl ep =                                                                            new                                                                                                                                    EndpointImpl                                                        (BusFactory.                                                        getThreadDefaultBus                                                        (),                                                                                                          implementor,                                                                    null,                                                                    getWsdl());                                                                                                                                                                ep.                                                        publish                                                        (address);                                                                                                          eps.add(ep);                                                                                                                                                                eps.add(Endpoint.                                                        publish                                                        (address +                                                                            "-provider"                                                        ,                                                                            new                                                                              AddNumberProvider()));                                                                                                                                                    eps.add(Endpoint.                                                        publish                                                        (address +                                                                            "-providernows"                                                        ,                                                                            new                                                                              AddNumberProviderNoWsdl()));                                                                                        }                                                                                                                                                public                                                                                                                                    void                                                                              tearDown() {                                                                    
                                                                                                                                public                                                                                                                                    static                                                                                                                                    void                                                                              publish(String address, Object impl) {                                                                                                                                                    EndpointImpl ep = (EndpointImpl)Endpoint.                                                        create                                                        (impl);                                                                                                                                                    ep.                                                        setBus                                                        (bus);                                                                                                                                                    ep.                                                        getFeatures                                                        ().add(cff);                                                                                                                                                    ep.                                                        publish                                                        (address);                                                                                        }                                                                                
                                                                                                                                protected                                                                                                                                    void                                                                              run()  {                                                                                                                                                    Bus bus = BusFactory.                                                        getDefaultBus                                                        ();                                                                                                          setBus(bus);                                                                                                                                                                Map<String, Object> inProperties =                                                                            new                                                                              HashMap<>();                                                                                                          inProperties.put(ConfigurationConstants.ACTION, ConfigurationConstants.SAML_TOKEN_SIGNED);                                                                                                              inProperties.put(ConfigurationConstants.PW_CALLBACK_REF,                                                                            new                                                                              KeystorePasswordCallback());                                                                                                                                                    inProperties.put(ConfigurationConstants.SIG_VER_PROP_FILE,                                                                            "bob.properties"                                                        );                                                                                                                                                                                                      WSS4JInInterceptor inInterceptor =                                                                            new                                                                              WSS4JInInterceptor(inProperties);                                                                                                                                                                                                      bus.                                                        getInInterceptors                                                        ().add(inInterceptor);                                                                                                                                                                                                      broker.updateWsdl(bus,                                                                            "testutils/jms_test.wsdl"                                                        );                                                                                                                                                                                                      Endpoint.                                                        publish                                                        (null,                                                                            new                                                                              SecurityGreeterImplTwoWayJMS());                                                                                        }                                                                                
                                                                                                                                protected                                                                                                                                    void                                                                              run()  {                                                                                                          String address;                                                                                                              Object implementor =                                                                            new                                                                              RPCLitGreeterImpl();                                                                                                                                                    address =                                                                            "http://localhost:"                                                                              + PORT +                                                                            "/SOAPServiceRPCLit/SoapPort"                                                        ;                                                                                                                                                    ep = Endpoint.                                                        create                                                        (implementor);                                                                                                                                                            URL wsdl = getClass().getResource(wsdlLocation);                                                                                                              ((EndpointImpl)ep).                                                        setWsdlLocation                                                        (wsdl.toString());                                                                                                                                                    ((EndpointImpl)ep).                                                        getInInterceptors                                                        ().add(                                                        new                                                                              LoggingInInterceptor());                                                                                                                                                    ((EndpointImpl)ep).                                                        getOutInterceptors                                                        ().add(                                                        new                                                                              LoggingOutInterceptor());                                                                                                                                                    ep.                                                        publish                                                        (address);                                                                                        }                                                                                
                                                                                                                                                                                                      import                                                                              java.io.*;                                                                                                                              import                                                                              javax.xml.ws.*;                                                                                                                              import                                                                              javax.xml.ws.http.*;                                                                                                                              import                                                                              javax.xml.transform.*;                                                                                                                              import                                                                              javax.xml.transform.stream.*;                                                                                                                                          @WebServiceProvider                                                  @ServiceMode(value = Service.Mode.PAYLOAD)                                                                                        public                                                                                                                                    class                                                                              Server                                                                            implements                                                                              Provider<Source> {                                                                                                                                                                                                                                                            public                                                                              Source invoke(Source request) {                                                                                                                                                                                                          return                                                                                                                                    new                                                                              StreamSource(                                                        new                                                                              StringReader(                                                        "<p>Hello There!</p>"                                                        ));                                                                                                          }                                                                                                                                                                                                                      public                                                                                                                                    static                                                                                                                                    void                                                                              main(String[] args)                                                                            throws                                                                              InterruptedException {                                                                                                                                                                                                      String address =                                                                            "http://127.0.0.1:8080/"                                                        ;                                                                                                                                                    Endpoint.                                                        create                                                        (HTTPBinding.HTTP_BINDING,                                                                            new                                                                              Server()).                                                        publish                                                        (address);                                                                                                                                                                                                      System.out.println(                                                        "Service running at "                                                                              + address);                                                                                                                                                    System.out.println(                                                        "Type [CTRL]+[C] to quit!"                                                        );                                                                                                                                                            Thread.sleep(Long.MAX_VALUE);                                                                    }                                                  }                              
                                                                                                                                protected                                                                                                                                    void                                                                              run() {                                                                                                                                                    Object implementor =                                                                            new                                                                              HWSoapMessageDocProvider();                                                                                                                                                    Endpoint ep = Endpoint.                                                        create                                                        (implementor);                                                                                                                                                    Map<String, Object> map =                                                                            new                                                                              HashMap<>();                                                                                                          map.put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.TRUE);                                                                                                              ep.                                                        setProperties                                                        (map);                                                                                                                                                    ((EndpointImpl)ep).                                                        getInInterceptors                                                        ().add(                                                        new                                                                              LoggingInInterceptor());                                                                                                                                                    ((EndpointImpl)ep).                                                        getOutInterceptors                                                        ().add(                                                        new                                                                              LoggingOutInterceptor());                                                                                                                                                    ep.                                                        publish                                                        (ADDRESS);                                                                                                                                          }                                                                                

healyviscruend41.blogspot.com

Source: https://www.tabnine.com/code/java/classes/javax.xml.ws.Endpoint

0 Response to "Define an Endpoint Java Example"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel