use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class StaxRoundTripActionTest method createClientProxy.
private Echo createClientProxy() {
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setServiceClass(Echo.class);
proxyFac.setAddress("local://Echo");
proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID);
return (Echo) proxyFac.create();
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class IssueUnitTest method testRetrieveWSMEX.
@org.junit.Test
public void testRetrieveWSMEX() throws Exception {
createBus(getClass().getResource("cxf-client.xml").toString());
// Get Metadata
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setBindingId(SoapBindingConstants.SOAP11_BINDING_ID);
proxyFac.setAddress("https://localhost:" + STSPORT + "/SecurityTokenService/Transport/mex");
MetadataExchange exc = proxyFac.create(MetadataExchange.class);
Metadata metadata = exc.get2004();
// Parse response (as per the STSClient)
Definition definition = null;
// Parse the MetadataSections into WSDL definition + associated schemas
for (MetadataSection s : metadata.getMetadataSection()) {
if ("http://schemas.xmlsoap.org/wsdl/".equals(s.getDialect())) {
definition = bus.getExtension(WSDLManager.class).getDefinition((Element) s.getAny());
}
}
assertNotNull(definition);
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class JaxwsAsyncFailOverTest method testUseFailOverOnClient.
@Test
public void testUseFailOverOnClient() throws Exception {
List<String> serviceList = new ArrayList<>();
serviceList.add("http://localhost:" + PORT + "/SoapContext/GreeterPort");
RandomStrategy strategy = new RandomStrategy();
strategy.setAlternateAddresses(serviceList);
FailoverFeature ff = new FailoverFeature();
ff.setStrategy(strategy);
// setup the feature by using JAXWS front-end API
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
// set a fake address to kick off the failover feature
factory.setAddress("http://localhost:" + PORT2 + "/SoapContext/GreeterPort");
factory.getFeatures().add(ff);
factory.setServiceClass(Greeter.class);
Greeter proxy = factory.create(Greeter.class);
Response<GreetMeResponse> response = proxy.greetMeAsync("cxf");
int waitCount = 0;
while (!response.isDone() && waitCount < 15) {
Thread.sleep(1000);
waitCount++;
}
assertTrue("Response still not received.", response.isDone());
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class BraveTracingTest method createJaxWsService.
private BookStoreService createJaxWsService(final Map<String, List<String>> headers, final Feature feature) {
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.setServiceClass(BookStoreService.class);
factory.setAddress("http://localhost:" + PORT + "/BookStore");
if (feature != null) {
factory.getFeatures().add(feature);
}
final BookStoreService service = (BookStoreService) factory.create();
final Client proxy = ClientProxy.getClient(service);
proxy.getRequestContext().put(Message.PROTOCOL_HEADERS, headers);
return service;
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class OpenTracingTracingTest method createJaxWsService.
private static BookStoreService createJaxWsService(final Map<String, List<String>> headers, final Feature feature) {
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.setServiceClass(BookStoreService.class);
factory.setAddress("http://localhost:" + PORT + "/BookStore");
if (feature != null) {
factory.getFeatures().add(feature);
}
final BookStoreService service = (BookStoreService) factory.create();
final Client proxy = ClientProxy.getClient(service);
proxy.getRequestContext().put(Message.PROTOCOL_HEADERS, headers);
return service;
}
Aggregations