use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class JSClientServerTest method testJSPayloadMode.
@Test
public void testJSPayloadMode() throws Exception {
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
QName serviceName = new QName(NS, "SOAPService_Test1");
QName portName = new QName(NS, "SoapPort_Test1");
SOAPServiceTest1 service = new SOAPServiceTest1(wsdl, serviceName);
assertNotNull(service);
String response1 = new String("TestGreetMeResponse");
String response2 = new String("TestSayHiResponse");
try {
Greeter greeter = service.getPort(portName, Greeter.class);
updateAddressPort(greeter, JSX_PORT);
String greeting = greeter.greetMe("TestGreetMeRequest");
assertNotNull("no response received from service", greeting);
assertEquals(response1, greeting);
String reply = greeter.sayHi();
assertNotNull("no response received from service", reply);
assertEquals(response2, reply);
} catch (UndeclaredThrowableException ex) {
ex.printStackTrace();
throw (Exception) ex.getCause();
}
}
use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class ManagedBusTest method testTwoSameNamedEndpoint.
@Test
public void testTwoSameNamedEndpoint() throws Exception {
SpringBusFactory factory = new SpringBusFactory();
Bus bus = factory.createBus();
try {
InstrumentationManager im = bus.getExtension(InstrumentationManager.class);
assertNotNull(im);
InstrumentationManagerImpl imi = (InstrumentationManagerImpl) im;
imi.setServer(ManagementFactory.getPlatformMBeanServer());
imi.setEnabled(true);
imi.init();
Greeter greeter1 = new GreeterImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setAddress("http://localhost:" + SERVICE_PORT + "/Hello");
svrFactory.setServiceBean(greeter1);
svrFactory.getProperties(true).put("managed.endpoint.name", "greeter1");
svrFactory.create();
Greeter greeter2 = new GreeterImpl();
svrFactory = new JaxWsServerFactoryBean();
svrFactory.setAddress("http://localhost:" + SERVICE_PORT + "/Hello2");
svrFactory.setServiceBean(greeter2);
svrFactory.getProperties(true).put("managed.endpoint.name", "greeter2");
svrFactory.create();
MBeanServer mbs = im.getMBeanServer();
ObjectName name = new ObjectName(ManagementConstants.DEFAULT_DOMAIN_NAME + ":type=Bus.Service.Endpoint,*");
Set<?> s = mbs.queryMBeans(name, null);
assertEquals(2, s.size());
} finally {
bus.shutdown(true);
}
}
use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class JarResolverTest method testResolver.
@Test
public void testResolver() throws Exception {
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
createBus();
assertNotNull(bus);
ServiceContractResolverRegistryImpl registry = new ServiceContractResolverRegistryImpl();
registry.setBus(bus);
assertNotNull(bus.getExtension(ServiceContractResolverRegistry.class));
JarServiceContractResolver resolver = new JarServiceContractResolver();
registry.register(resolver);
Service service = Service.create(serviceName);
// service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
// "http://localhost:9000/SoapContext/SoapPort");
Greeter greeter = service.getPort(portName, Greeter.class);
updateAddressPort(greeter, PORT);
String resp = greeter.sayHi();
assertNotNull(resp);
}
use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class JettyBasicAuthTest method setUp.
@Before
public void setUp() throws Exception {
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
greeter = new SOAPService(wsdl, SERVICE_NAME).getPort(Greeter.class);
BindingProvider bp = (BindingProvider) greeter;
ClientProxy.getClient(greeter).getInInterceptors().add(new LoggingInInterceptor());
ClientProxy.getClient(greeter).getOutInterceptors().add(new LoggingOutInterceptor());
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS);
bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "ffang");
bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "pswd");
}
use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class JettyDigestAuthTest method setupClient.
private HTTPConduit setupClient(boolean async) throws Exception {
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
greeter = new SOAPService(wsdl, SERVICE_NAME).getPort(Greeter.class);
BindingProvider bp = (BindingProvider) greeter;
ClientProxy.getClient(greeter).getInInterceptors().add(new LoggingInInterceptor());
ClientProxy.getClient(greeter).getOutInterceptors().add(new LoggingOutInterceptor());
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS);
HTTPConduit cond = (HTTPConduit) ClientProxy.getClient(greeter).getConduit();
HTTPClientPolicy client = new HTTPClientPolicy();
cond.setClient(client);
if (async) {
if (cond instanceof AsyncHTTPConduit) {
UsernamePasswordCredentials creds = new UsernamePasswordCredentials("ffang", "pswd");
bp.getRequestContext().put(Credentials.class.getName(), creds);
bp.getRequestContext().put(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE);
client.setAutoRedirect(true);
} else {
fail("Not an async conduit");
}
} else {
bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "ffang");
bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "pswd");
cond.setAuthSupplier(new DigestAuthSupplier());
}
ClientProxy.getClient(greeter).getOutInterceptors().add(new AbstractPhaseInterceptor<Message>(Phase.PRE_STREAM_ENDING) {
public void handleMessage(Message message) throws Fault {
Map<String, ?> headers = CastUtils.cast((Map<?, ?>) message.get(Message.PROTOCOL_HEADERS));
if (headers.containsKey("Proxy-Authorization")) {
throw new RuntimeException("Should not have Proxy-Authorization");
}
}
});
client.setAllowChunking(false);
return cond;
}
Aggregations