use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class NoSpringServletClientTest method testBasicConnection.
@Test
public void testBasicConnection() throws Exception {
SOAPService service = new SOAPService(new URL(serviceURL + "Greeter?wsdl"));
Greeter greeter = service.getPort(portName, Greeter.class);
try {
String reply = greeter.greetMe("test");
assertNotNull("no response received from service", reply);
assertEquals("Hello test", reply);
reply = greeter.sayHi();
assertNotNull("no response received from service", reply);
assertEquals("Bonjour", reply);
} catch (UndeclaredThrowableException ex) {
throw (Exception) ex.getCause();
}
}
use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class BusShutdownTest method doWork.
private void doWork(URL wsdlUrl, String address) {
SOAPService service = new SOAPService(wsdlUrl);
assertNotNull(service);
Greeter greeter = service.getSoapPort();
// overwrite client address
InvocationHandler handler = Proxy.getInvocationHandler(greeter);
BindingProvider bp = (BindingProvider) handler;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, address);
Client client = ClientProxy.getClient(greeter);
HTTPConduit c = (HTTPConduit) client.getConduit();
c.setClient(new HTTPClientPolicy());
c.getClient().setConnection(ConnectionType.CLOSE);
// invoke twoway call
greeter.sayHi();
}
use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class WSAFaultToClientServerTest method testOneWayFaultTo.
@Test
public void testOneWayFaultTo() throws Exception {
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
QName serviceName = new QName("http://apache.org/hello_world_soap_http", "SOAPServiceAddressing");
Greeter greeter = new SOAPService(wsdl, serviceName).getPort(Greeter.class, new AddressingFeature());
EndpointReferenceType faultTo = new EndpointReferenceType();
AddressingProperties addrProperties = new AddressingProperties();
AttributedURIType epr = new AttributedURIType();
String faultToAddress = "http://localhost:" + FaultToEndpointServer.FAULT_PORT + "/faultTo";
epr.setValue(faultToAddress);
faultTo.setAddress(epr);
addrProperties.setFaultTo(faultTo);
BindingProvider provider = (BindingProvider) greeter;
Map<String, Object> requestContext = provider.getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + FaultToEndpointServer.PORT + "/jaxws/greeter");
requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProperties);
greeter.greetMeOneWay("test");
// wait for the fault request
int i = 2;
while (HelloHandler.getFaultRequestPath() == null && i > 0) {
Thread.sleep(500);
i--;
}
assertTrue("FaultTo request fpath isn't expected", "/faultTo".equals(HelloHandler.getFaultRequestPath()));
}
use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class MAPTestBase method createGreeter.
public Greeter createGreeter(EndpointReferenceType target) throws Exception {
ServiceImpl serviceImpl = ServiceDelegateAccessor.get(new SOAPService(getWSDLURL(), SERVICE_NAME));
Greeter g = serviceImpl.getPort(target, Greeter.class);
updateAddressPort(g, getPort());
return g;
}
use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class WSAFeatureXmlTest method testClientProxyFactory.
@Test
public void testClientProxyFactory() {
JaxWsProxyFactoryBean cf = new JaxWsProxyFactoryBean();
cf.setAddress("http://localhost:" + PORT + "/test");
cf.setServiceClass(Greeter.class);
cf.setBus(getBus());
Configurer c = getBus().getExtension(Configurer.class);
c.configureBean("client.proxyFactory", cf);
Greeter greeter = (Greeter) cf.create();
Client client = ClientProxy.getClient(greeter);
checkAddressInterceptors(client.getInInterceptors());
}
Aggregations