本文整理汇总了Java中org.apache.cxf.frontend.ClientProxyFactoryBean.getClientFactoryBean方法的典型用法代码示例。如果您正苦于以下问题:Java ClientProxyFactoryBean.getClientFactoryBean方法的具体用法?Java ClientProxyFactoryBean.getClientFactoryBean怎么用?Java ClientProxyFactoryBean.getClientFactoryBean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.frontend.ClientProxyFactoryBean
的用法示例。
在下文中一共展示了ClientProxyFactoryBean.getClientFactoryBean方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testInvokingServiceFromCXFClient
import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
@Test
public void testInvokingServiceFromCXFClient() throws Exception {
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(routerAddress);
clientBean.setServiceClass(HelloService.class);
clientBean.setBus(bus);
HelloService client = (HelloService) proxyFactory.create();
try {
client.echo("hello world");
fail("Expect to get an exception here");
} catch (Exception e) {
assertEquals("Expect to get right exception message", EXCEPTION_MESSAGE, e.getMessage());
assertTrue("Exception is not instance of SoapFault", e instanceof SoapFault);
assertEquals("Expect to get right detail message", DETAIL_TEXT, ((SoapFault)e).getDetail().getTextContent());
//In CXF 2.1.2 , the fault code is per spec , the below fault-code is for SOAP 1.1
assertEquals("Expect to get right fault-code", "{http://schemas.xmlsoap.org/soap/envelope/}Client", ((SoapFault)e).getFaultCode().toString());
}
}
示例2: testInvokingServiceFromCXFClient
import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
@Test
public void testInvokingServiceFromCXFClient() throws Exception {
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(simpleEndpointAddress);
clientBean.setServiceClass(HelloService.class);
clientBean.setBus(BusFactory.getDefaultBus());
HelloService client = (HelloService) proxyFactory.create();
assertNotNull(client);
String result = client.echo(TEST_MESSAGE);
assertEquals("We should get the echo string result from router", result, "echo " + TEST_MESSAGE);
Boolean bool = client.echoBoolean(Boolean.TRUE);
assertNotNull("The result should not be null", bool);
assertEquals("We should get the echo boolean result from router ", bool.toString(), "true");
int beforeCallingPing = pingCounter;
client.ping();
int afterCallingPing = pingCounter;
assertTrue("The ping operation doesn't be called", afterCallingPing - beforeCallingPing == 1);
}
示例3: execTest
import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
private void execTest(int size) throws Exception {
buildTestMessage(size);
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(simpleEndpointAddress);
clientBean.setServiceClass(HelloService.class);
clientBean.setBus(BusFactory.getDefaultBus());
HelloService client = (HelloService) proxyFactory.create();
String result = client.echo(testMessage);
assertEquals("We should get the echo string result from router", "echo Hello World!", result);
//check received requests
assertEquals("Lengths of testMessage and receiveMessage should be equal (conversion body to String),", testMessage.length(), receivedMessageStringApplyingXPath.length());
assertEquals("Lengths of receivedMessageByDom and receivedMessageCxfPayloadApplyingXPath should be equal", receivedMessageCxfPayloadApplyingXPath.length(), receivedMessageByDom.length());
assertEquals("Lengths of testMessage and receiveMessage should be equal (body is CxfPayload),", testMessage.length(), receivedMessageCxfPayloadApplyingXPath.length());
}
示例4: testInvokingServiceFromCXFClient
import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
@Test
public void testInvokingServiceFromCXFClient() throws Exception {
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(SIMPLE_ENDPOINT_ADDRESS);
clientBean.setServiceClass(HelloService.class);
clientBean.setBus(BusFactory.newInstance().createBus());
HelloService client = (HelloService) proxyFactory.create();
String result = client.echo(TEST_MESSAGE);
assertEquals("We should get the echo string result from router", result, "echo " + TEST_MESSAGE);
Boolean bool = client.echoBoolean(Boolean.TRUE);
assertNotNull("The result should not be null", bool);
assertEquals("We should get the echo boolean result from router ", bool.toString(), "true");
}
示例5: testInvokingServiceFromClient
import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
@Test
public void testInvokingServiceFromClient() throws Exception {
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(simpleEndpointAddress);
clientBean.setServiceClass(HelloService.class);
clientBean.setBus(BusFactory.getDefaultBus());
HelloService client = (HelloService) proxyFactory.create();
String result = client.echo(TEST_MESSAGE);
assertEquals("We should get the echo string result from router", result, "echo " + TEST_MESSAGE);
Boolean bool = client.echoBoolean(Boolean.TRUE);
assertNotNull("The result should not be null", bool);
assertEquals("We should get the echo boolean result from router ", bool.toString(), "true");
}
示例6: getProxy
import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
public static LoanBrokerWS getProxy(String address) {
// Now we use the simple front API to create the client proxy
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(address);
clientBean.setServiceClass(LoanBrokerWS.class);
// just create a new bus for use
clientBean.setBus(BusFactory.newInstance().createBus());
return (LoanBrokerWS) proxyFactory.create();
}
示例7: testInvokingServiceFromCXFClient
import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
@Test
public void testInvokingServiceFromCXFClient() throws Exception {
LoggingOutInterceptor logInterceptor = null;
for (Interceptor<?> interceptor
: context.getEndpoint("cxf:bean:serviceEndpoint", CxfSpringEndpoint.class)
.getOutInterceptors()) {
if (interceptor instanceof LoggingOutInterceptor) {
logInterceptor = LoggingOutInterceptor.class.cast(interceptor);
break;
}
}
assertNotNull(logInterceptor);
// StringPrintWriter writer = new StringPrintWriter();
// Unfortunately, LoggingOutInterceptor does not have a setter for writer so
// we can't capture the output to verify.
// logInterceptor.setPrintWriter(writer);
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(ROUTER_ADDRESS);
clientBean.setServiceClass(HelloService.class);
HelloService client = (HelloService) proxyFactory.create();
String result = client.echo("hello world");
assertEquals("we should get the right answer from router", result, "echo hello world");
//assertTrue(writer.getString().indexOf("hello world") > 0);
}
示例8: getCXFClient
import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
protected HelloService getCXFClient() throws Exception {
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(getRouterAddress());
clientBean.setServiceClass(HelloService.class);
HelloService client = (HelloService) proxyFactory.create();
return client;
}
示例9: getCXFClient
import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
protected HelloService getCXFClient() throws Exception {
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(ROUTER_ADDRESS);
clientBean.setServiceClass(HelloService.class);
clientBean.setBindingId(getBindingId());
HelloService client = (HelloService) proxyFactory.create();
return client;
}
示例10: getCXFClient
import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
protected HelloService getCXFClient() throws Exception {
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(getRouterAddress());
clientBean.setServiceClass(HelloService.class);
clientBean.getServiceFactory().setWrapped(false);
HelloService client = (HelloService) proxyFactory.create();
return client;
}
示例11: getCXFClient
import org.apache.cxf.frontend.ClientProxyFactoryBean; //导入方法依赖的package包/类
protected HelloService getCXFClient() throws Exception {
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(ROUTER_ADDRESS);
clientBean.setServiceClass(HelloService.class);
clientBean.setBus(BusFactory.newInstance().createBus());
HelloService client = (HelloService) proxyFactory.create();
return client;
}