use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class CreateSubscriptionServlet method doGet.
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
try {
resp.getWriter().append("<html><body>");
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(EventSourceEndpoint.class);
factory.setAddress("http://localhost:8080/ws_eventing/services/EventSource");
EventSourceEndpoint requestorClient = (EventSourceEndpoint) factory.create();
String expires = null;
if (req.getParameter("expires-set") == null) {
expires = req.getParameter("expires");
} else {
if (!"false".equals(req.getParameter("expires-set"))) {
expires = req.getParameter("expires");
}
}
Subscribe sub = createSubscribeMessage(req.getParameter("targeturl"), req.getParameter("filter-set") == null ? req.getParameter("filter") : null, expires);
resp.getWriter().append("<h3>Subscription request</h3>");
resp.getWriter().append(convertJAXBElementToStringAndEscapeHTML(sub));
SubscribeResponse subscribeResponse = requestorClient.subscribeOp(sub);
resp.getWriter().append("<h3>Response from Event Source</h3>");
resp.getWriter().append(convertJAXBElementToStringAndEscapeHTML(subscribeResponse));
resp.getWriter().append("<br/><a href=\"index.jsp\">Back to main page</a>");
resp.getWriter().append("</body></html>");
} catch (Exception e) {
throw new ServletException(e);
}
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class ClientServiceConfigTest method talkToJaxWsHolder.
@Test
public void talkToJaxWsHolder() throws Exception {
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setDataBinding(new AegisDatabinding());
factory.setAddress("local://JaxWsEcho");
Echo client = factory.create(Echo.class);
Holder<String> sholder = new Holder<>();
client.echo("Channa Doll", sholder);
assertEquals("Channa Doll", sholder.value);
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class ExceptionTest method testJaxws.
@Test(expected = HelloException.class)
public void testJaxws() throws Exception {
JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean();
sfbean.setServiceClass(ExceptionService.class);
setupAegis(sfbean);
sfbean.setAddress("local://ExceptionService4");
Server server = sfbean.create();
Service service = server.getEndpoint().getService();
service.setInvoker(new BeanInvoker(new ExceptionServiceImpl()));
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setAddress("local://ExceptionService4");
proxyFac.setBus(getBus());
setupAegis(proxyFac.getClientFactoryBean());
ExceptionService clientInterface = proxyFac.create(ExceptionService.class);
clientInterface.sayHiWithException();
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class BraveTraceTest method createProxy.
private static MyService createProxy(Feature trace) {
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(MyService.class);
factory.setAddress(ADDRESS);
factory.setFeatures(Arrays.asList(trace));
return (MyService) factory.create();
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class ManagedConnectionImpl method createClientProxy.
private synchronized Object createClientProxy(final CXFConnectionSpec spec) {
if (clientProxy == null) {
validateConnectionSpec(spec);
final ClientProxyFactoryBean factory;
if (EndpointUtils.hasWebServiceAnnotation(spec.getServiceClass())) {
factory = new JaxWsProxyFactoryBean();
} else {
factory = new ClientProxyFactoryBean();
}
factory.setBus(getBus(spec.getBusConfigURL()));
factory.setServiceClass(spec.getServiceClass());
factory.getServiceFactory().setEndpointName(spec.getEndpointName());
factory.getServiceFactory().setServiceName(spec.getServiceName());
factory.getServiceFactory().setWsdlURL(spec.getWsdlURL());
if (spec.getAddress() != null) {
factory.setAddress(spec.getAddress());
}
configureObject(spec.getEndpointName().toString() + ".jaxws-client.proxyFactory", factory);
clientProxy = factory.create();
}
return clientProxy;
}
Aggregations