use of org.apache.cxf.jaxws.MessageReplayObserver in project cxf by apache.
the class DispatchTest method testSOAPPBindingNullMessage.
@Test
public void testSOAPPBindingNullMessage() throws Exception {
d.setMessageObserver(new MessageReplayObserver("/org/apache/cxf/jaxws/sayHiResponse.xml"));
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
SOAPService service = new SOAPService(wsdl, SERVICE_NAME);
assertNotNull(service);
JAXBContext jc = JAXBContext.newInstance("org.apache.hello_world_soap_http.types");
Dispatch<Object> disp = service.createDispatch(PORT_NAME, jc, Service.Mode.PAYLOAD);
try {
// Send a null message
disp.invoke(null);
} catch (SOAPFaultException e) {
// Passed
return;
}
fail("SOAPFaultException was not thrown");
}
use of org.apache.cxf.jaxws.MessageReplayObserver in project cxf by apache.
the class DispatchTest method testDOMSource.
@Test
public void testDOMSource() throws Exception {
ServiceImpl service = new ServiceImpl(getBus(), getClass().getResource("/wsdl/hello_world.wsdl"), SERVICE_NAME, null);
Dispatch<Source> disp = service.createDispatch(PORT_NAME, Source.class, Service.Mode.MESSAGE);
disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS);
d.setMessageObserver(new MessageReplayObserver("/org/apache/cxf/jaxws/sayHiResponse.xml"));
Document doc = StaxUtils.read(getResourceAsStream("/org/apache/cxf/jaxws/sayHi2.xml"));
DOMSource source = new DOMSource(doc);
Source res = disp.invoke(source);
assertNotNull(res);
}
use of org.apache.cxf.jaxws.MessageReplayObserver in project cxf by apache.
the class DispatchTest method testJAXB.
@Test
public void testJAXB() throws Exception {
d.setMessageObserver(new MessageReplayObserver("/org/apache/cxf/jaxws/sayHiResponse.xml"));
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
SOAPService service = new SOAPService(wsdl, SERVICE_NAME);
assertNotNull(service);
JAXBContext jc = JAXBContext.newInstance("org.apache.hello_world_soap_http.types");
Dispatch<Object> disp = service.createDispatch(PORT_NAME, jc, Service.Mode.PAYLOAD);
SayHi s = new SayHi();
Object response = disp.invoke(s);
assertNotNull(response);
assertTrue(response instanceof SayHiResponse);
}
use of org.apache.cxf.jaxws.MessageReplayObserver in project cxf by apache.
the class DispatchTest method testFindOperationWithSource.
@Test
public void testFindOperationWithSource() throws Exception {
ServiceImpl service = new ServiceImpl(getBus(), getClass().getResource("/wsdl/hello_world.wsdl"), SERVICE_NAME, null);
Dispatch<Source> disp = service.createDispatch(PORT_NAME, Source.class, Service.Mode.MESSAGE);
disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS);
disp.getRequestContext().put("find.dispatch.operation", Boolean.TRUE);
d.setMessageObserver(new MessageReplayObserver("/org/apache/cxf/jaxws/sayHiResponse.xml"));
BindingOperationVerifier bov = new BindingOperationVerifier();
((DispatchImpl<?>) disp).getClient().getOutInterceptors().add(bov);
Document doc = StaxUtils.read(getResourceAsStream("/org/apache/cxf/jaxws/sayHi2.xml"));
DOMSource source = new DOMSource(doc);
Source res = disp.invoke(source);
assertNotNull(res);
BindingOperationInfo boi = bov.getBindingOperationInfo();
assertNotNull(boi);
assertEquals(new QName("http://apache.org/hello_world_soap_http", "sayHi"), boi.getName());
}
use of org.apache.cxf.jaxws.MessageReplayObserver in project cxf by apache.
the class HolderTest method testClient.
@Test
public void testClient() throws Exception {
EndpointInfo ei = new EndpointInfo(null, "http://schemas.xmlsoap.org/soap/http");
ei.setAddress(ADDRESS);
Destination d = localTransport.getDestination(ei, bus);
d.setMessageObserver(new MessageReplayObserver("/org/apache/cxf/jaxws/holder/echoResponse.xml"));
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getClientFactoryBean().setServiceClass(HolderService.class);
factory.getClientFactoryBean().setBus(getBus());
factory.getClientFactoryBean().setAddress(ADDRESS);
HolderService h = (HolderService) factory.create();
Holder<String> holder = new Holder<>();
assertEquals("one", h.echo("one", "two", holder));
assertEquals("two", holder.value);
}
Aggregations