use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.
the class ProviderClientServerTest method testSOAPMessageModeDocLit.
@Test
public void testSOAPMessageModeDocLit() throws Exception {
QName serviceName = new QName("http://apache.org/hello_world_soap_http", "SOAPProviderService");
QName portName = new QName("http://apache.org/hello_world_soap_http", "SoapProviderPort");
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
SOAPService service = new SOAPService(wsdl, serviceName);
assertNotNull(service);
String response1 = new String("TestSOAPOutputPMessage");
String response2 = new String("Bonjour");
try {
Greeter greeter = service.getPort(portName, Greeter.class);
setAddress(greeter, ADDRESS);
try {
greeter.greetMe("Return sayHi");
fail("Should have thrown an exception");
} catch (Exception ex) {
// expected
assertTrue(ex.getMessage().contains("sayHiResponse"));
}
for (int idx = 0; idx < 2; idx++) {
String greeting = greeter.greetMe("Milestone-" + idx);
assertNotNull("no response received from service", greeting);
assertEquals(response1, greeting);
String reply = greeter.sayHi();
assertNotNull("no response received from service", reply);
assertEquals(response2, reply);
}
try {
greeter.greetMe("throwFault");
fail("Expected a fault");
} catch (SOAPFaultException ex) {
assertTrue(ex.getMessage().contains("Test Fault String"));
}
} catch (UndeclaredThrowableException ex) {
throw (Exception) ex.getCause();
}
}
use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.
the class ThreadPoolTest 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;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS);
}
use of org.apache.hello_world_soap_http.SOAPService 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.SOAPService 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.SOAPService 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();
}
}
Aggregations