use of org.apache.cxf.jaxws.EndpointImpl in project cxf by apache.
the class ClientMtomXopWithJMSTest method startServers.
@BeforeClass
public static void startServers() throws Exception {
Object implementor = new TestMtomJMSImpl();
bus = BusFactory.getDefaultBus();
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
PooledConnectionFactory cfp = new PooledConnectionFactory(cf);
cff = new ConnectionFactoryFeature(cfp);
EndpointImpl ep = (EndpointImpl) Endpoint.create(implementor);
ep.getFeatures().add(cff);
ep.getInInterceptors().add(new TestMultipartMessageInterceptor());
ep.getOutInterceptors().add(new TestAttachmentOutInterceptor());
// ep.getInInterceptors().add(new LoggingInInterceptor());
// ep.getOutInterceptors().add(new LoggingOutInterceptor());
SOAPBinding jaxWsSoapBinding = (SOAPBinding) ep.getBinding();
jaxWsSoapBinding.setMTOMEnabled(true);
ep.publish();
}
use of org.apache.cxf.jaxws.EndpointImpl in project cxf by apache.
the class Server method run.
protected void run() {
TestProvider implementor = new TestProvider();
Endpoint ep = Endpoint.create(implementor);
((EndpointImpl) ep).setWsdlLocation("wsdl_systest/mtom_provider_validate.wsdl");
ep.publish("http://localhost:" + PORT + "/mtom/provider");
}
use of org.apache.cxf.jaxws.EndpointImpl in project cxf by apache.
the class ManualNumberFactoryImpl method initDefaultServant.
protected void initDefaultServant() {
servant = new ManualNumberImpl();
String wsdlLocation = "wsdl/factory_pattern.wsdl";
String bindingId = null;
EndpointImpl ep = new EndpointImpl(bus, servant, bindingId, wsdlLocation);
ep.setEndpointName(new QName(NUMBER_SERVICE_QNAME.getNamespaceURI(), "NumberPort"));
ep.publish(getServantAddressRoot());
endpoints.add(ep);
templateEpr = ep.getServer().getDestination().getAddress();
}
use of org.apache.cxf.jaxws.EndpointImpl in project cxf by apache.
the class SecurityPolicyTest method testCXF4122.
@Test
public void testCXF4122() throws Exception {
Bus epBus = BusFactory.newInstance().createBus();
BusFactory.setDefaultBus(epBus);
URL wsdl = SecurityPolicyTest.class.getResource("DoubleIt.wsdl");
DoubleItPortTypeImpl implementor = new DoubleItPortTypeImpl();
implementor.setEnforcePrincipal(false);
EndpointImpl ep = (EndpointImpl) Endpoint.create(implementor);
ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortCXF4122"));
ep.setWsdlLocation(wsdl.getPath());
ep.setAddress(POLICY_CXF4122_ADDRESS);
ep.publish();
EndpointInfo ei = ep.getServer().getEndpoint().getEndpointInfo();
setCryptoProperties(ei, "bob.properties", "revocation.properties");
ei.setProperty(SecurityConstants.ENABLE_REVOCATION, Boolean.TRUE);
SpringBusFactory bf = new SpringBusFactory();
Bus bus = bf.createBus();
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItPortCXF4122");
DoubleItPortType pt = service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(pt, PORT);
((BindingProvider) pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
((BindingProvider) pt).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES, "revocation.properties");
((BindingProvider) pt).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, "bob.properties");
// DOM
try {
pt.doubleIt(5);
fail("should fail on server side when do signature validation due the revoked certificates");
} catch (Exception ex) {
// expected
}
// TODO See WSS-464
/*
SecurityTestUtil.enableStreaming(pt);
try {
pt.doubleIt(5);
fail("should fail on server side when do signature validation due the revoked certificates");
} catch (Exception ex) {
String errorMessage = ex.getMessage();
// Different errors using different JDKs...
System.out.println("ERR1: " + errorMessage);
}
*/
((java.io.Closeable) pt).close();
ep.stop();
epBus.shutdown(true);
bus.shutdown(true);
}
use of org.apache.cxf.jaxws.EndpointImpl in project cxf by apache.
the class WSDiscoveryServiceImpl method startup.
public synchronized boolean startup(boolean optional) {
String preferIPv4StackValue = System.getProperty("java.net.preferIPv4Stack");
String preferIPv6AddressesValue = System.getProperty("java.net.preferIPv6Addresses");
if (!started && client.isAdHoc()) {
Bus b = BusFactory.getAndSetThreadDefaultBus(bus);
try {
udpEndpoint = new EndpointImpl(bus, new WSDiscoveryProvider());
Map<String, Object> props = new HashMap<>();
props.put("jaxws.provider.interpretNullAsOneway", "true");
udpEndpoint.setProperties(props);
if ("true".equals(preferIPv6AddressesValue) && "false".equals(preferIPv4StackValue)) {
try {
udpEndpoint.publish("soap.udp://[FF02::C]:3702");
started = true;
} catch (Exception e) {
LOG.log(Level.WARNING, "Could not start WS-Discovery Service with ipv6 address", e);
}
}
if (!started) {
udpEndpoint.publish("soap.udp://239.255.255.250:3702");
started = true;
}
} catch (RuntimeException ex) {
if (!optional) {
throw ex;
}
LOG.log(Level.WARNING, "Could not start WS-Discovery Service.", ex);
} finally {
if (b != bus) {
BusFactory.setThreadDefaultBus(b);
}
}
}
return true;
}
Aggregations