本文整理汇总了Java中org.apache.cxf.jaxws.JaxWsProxyFactoryBean类的典型用法代码示例。如果您正苦于以下问题:Java JaxWsProxyFactoryBean类的具体用法?Java JaxWsProxyFactoryBean怎么用?Java JaxWsProxyFactoryBean使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JaxWsProxyFactoryBean类属于org.apache.cxf.jaxws包,在下文中一共展示了JaxWsProxyFactoryBean类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: helloWorldjaxWsProxyFactoryBean
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; //导入依赖的package包/类
@Bean(name = "helloWorldJaxWsProxyBean")
public HelloWorldPortType helloWorldjaxWsProxyFactoryBean() {
JaxWsProxyFactoryBean jaxWsProxyFactoryBean = new JaxWsProxyFactoryBean();
jaxWsProxyFactoryBean.setServiceClass(HelloWorldPortType.class);
jaxWsProxyFactoryBean.setAddress(environment
.getProperty("helloworld.address"));
jaxWsProxyFactoryBean.setBus(bus());
// set the user name for basic authentication
jaxWsProxyFactoryBean.setUsername(environment
.getProperty("client.username"));
// set the password for basic authentication
jaxWsProxyFactoryBean.setPassword(environment
.getProperty("client.password"));
return (HelloWorldPortType) jaxWsProxyFactoryBean.create();
}
示例2: init
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; //导入依赖的package包/类
@Before
public void init() {
Map<String, Object> props = new HashMap<String, Object>();
props.put("mtom-enabled", Boolean.TRUE);
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(SoapDocumentSignatureService.class);
factory.setProperties(props);
factory.setAddress(getBaseCxf() + CXFConfig.SOAP_SIGNATURE_ONE_DOCUMENT);
soapClient = (SoapDocumentSignatureService) factory.create();
JaxWsProxyFactoryBean factory2 = new JaxWsProxyFactoryBean();
factory2.setServiceClass(SoapMultipleDocumentsSignatureService.class);
factory2.setProperties(props);
factory2.setAddress(getBaseCxf() + CXFConfig.SOAP_SIGNATURE_MULTIPLE_DOCUMENTS);
soapMultiDocsClient = (SoapMultipleDocumentsSignatureService) factory2.create();
}
示例3: ticketAgentProxy
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; //导入依赖的package包/类
@Bean(name = "ticketAgentProxy")
public TicketAgent ticketAgentProxy() {
JaxWsProxyFactoryBean jaxWsProxyFactoryBean =
new JaxWsProxyFactoryBean();
jaxWsProxyFactoryBean.setServiceClass(TicketAgent.class);
jaxWsProxyFactoryBean.setAddress(address);
// add an interceptor to log the outgoing request messages
jaxWsProxyFactoryBean.getOutInterceptors()
.add(loggingOutInterceptor());
// add an interceptor to log the incoming response messages
jaxWsProxyFactoryBean.getInInterceptors()
.add(loggingInInterceptor());
// add an interceptor to log the incoming fault messages
jaxWsProxyFactoryBean.getInFaultInterceptors()
.add(loggingInInterceptor());
return (TicketAgent) jaxWsProxyFactoryBean.create();
}
示例4: testInvokingServiceFromCXFClient
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; //导入依赖的package包/类
@Test
public void testInvokingServiceFromCXFClient() throws Exception {
JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(ADDRESS);
clientBean.setServiceClass(MyOrderEndpoint.class);
MyOrderEndpoint client = (MyOrderEndpoint) proxyFactory.create();
Holder<String> strPart = new Holder<String>();
strPart.value = "parts";
Holder<String> strCustomer = new Holder<String>();
strCustomer.value = "";
String result = client.myOrder(strPart, 2, strCustomer);
assertEquals("Get a wrong order result", "Ordered ammount 2", result);
assertEquals("Get a wrong parts", "parts", strPart.value);
assertEquals("Get a wrong customer", "newCustomer", strCustomer.value);
}
示例5: executePoll
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; //导入依赖的package包/类
/**
* Poll a query using local transport.
*/
protected QueryResults executePoll(Poll poll) throws ImplementationExceptionResponse,
QueryTooComplexExceptionResponse, QueryTooLargeExceptionResponse, SecurityExceptionResponse,
ValidationExceptionResponse, NoSuchNameExceptionResponse, QueryParameterExceptionResponse {
// we use CXF's local transport feature here
// EPCglobalEPCISService service = new EPCglobalEPCISService();
// QName portName = new QName("urn:epcglobal:epcis:wsdl:1", "EPCglobalEPCISServicePortLocal");
// service.addPort(portName, "http://schemas.xmlsoap.org/soap/", "local://query");
// EPCISServicePortType servicePort = service.getPort(portName, EPCISServicePortType.class);
// the same using CXF API
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setAddress("local://query");
factory.setServiceClass(EPCISServicePortType.class);
EPCISServicePortType servicePort = (EPCISServicePortType)
factory.create();
return servicePort.poll(poll);
}
示例6: ticketAgent
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; //导入依赖的package包/类
@Bean(name = "ticketAgentProxyBean")
public TicketAgent ticketAgent() {
JaxWsProxyFactoryBean jaxWsProxyFactoryBean =
new JaxWsProxyFactoryBean();
jaxWsProxyFactoryBean.setServiceClass(TicketAgent.class);
jaxWsProxyFactoryBean.setAddress(address);
// add the WSS4J OUT interceptor to sign the request message
jaxWsProxyFactoryBean.getOutInterceptors().add(clientWssOut());
// add the WSS4J IN interceptor to verify the signature on the response message
jaxWsProxyFactoryBean.getInInterceptors().add(clientWssIn());
// log the request and response messages
jaxWsProxyFactoryBean.getInInterceptors()
.add(loggingInInterceptor());
jaxWsProxyFactoryBean.getOutInterceptors()
.add(loggingOutInterceptor());
return (TicketAgent) jaxWsProxyFactoryBean.create();
}
示例7: main
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; //导入依赖的package包/类
public static void main(String[] args){
// You just need to set the address with JMS URI
String address = "jms:jndi:dynamicQueues/EmployeeQueue"
+ "?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ "&jndiConnectionFactoryName=ConnectionFactory"
+ "&jndiURL=tcp://localhost:61616";
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
// And specify the transport ID with SOAP over JMS specification
factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICATION_TRANSPORTID);
factory.setServiceClass(EmployeeWebService.class);
factory.setAddress(address);
EmployeeWebService client = (EmployeeWebService)factory.create();
client.changePositionAsync(1,1);
System.out.println("changed");
System.exit(0);
}
示例8: getServiceProxy
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; //导入依赖的package包/类
public static JaxWsProxyFactoryBean getServiceProxy(BindingProvider servicePort, String serviceAddr) {
JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
if(serviceAddr != null)
proxyFactory.setAddress(serviceAddr);
proxyFactory.setServiceClass(servicePort.getClass());
proxyFactory.getOutInterceptors().add(new LoggingOutInterceptor());
SoapBindingConfiguration config = new SoapBindingConfiguration();
config.setVersion(Soap12.getInstance());
proxyFactory.setBindingConfig(config);
Client deviceClient = ClientProxy.getClient(servicePort);
HTTPConduit http = (HTTPConduit) deviceClient.getConduit();
// AuthorizationPolicy authPolicy = new AuthorizationPolicy();
// authPolicy.setUserName(username);
// authPolicy.setPassword(password);
// authPolicy.setAuthorizationType("Basic");
// http.setAuthorization(authPolicy);
HTTPClientPolicy httpClientPolicy = http.getClient();
httpClientPolicy.setConnectionTimeout(36000);
httpClientPolicy.setReceiveTimeout(32000);
httpClientPolicy.setAllowChunking(false);
return proxyFactory;
}
示例9: createCXFClient
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; //导入依赖的package包/类
protected static ReportIncidentEndpoint createCXFClient(String url) {
List<Interceptor<? extends Message>> outInterceptors = new ArrayList<Interceptor<? extends Message>>();
// Define WSS4j properties for flow outgoing
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put("action", "UsernameToken Timestamp");
outProps.put("passwordType", "PasswordDigest");
outProps.put("user", "charles");
outProps.put("passwordCallbackClass", "org.apache.camel.example.reportincident.UTPasswordCallback");
WSS4JOutInterceptor wss4j = new WSS4JOutInterceptor(outProps);
// Add LoggingOutInterceptor
LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor();
outInterceptors.add(wss4j);
outInterceptors.add(loggingOutInterceptor);
// we use CXF to create a client for us as its easier than JAXWS and works
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setOutInterceptors(outInterceptors);
factory.setServiceClass(ReportIncidentEndpoint.class);
factory.setAddress(url);
return (ReportIncidentEndpoint) factory.create();
}
示例10: testWSAddressing
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; //导入依赖的package包/类
@Test
public void testWSAddressing() throws Exception {
JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(getClientAddress());
clientBean.setServiceClass(Greeter.class);
SpringBusFactory bf = new SpringBusFactory();
URL cxfConfig = null;
if (getCxfClientConfig() != null) {
cxfConfig = ClassLoaderUtils.getResource(getCxfClientConfig(), this.getClass());
}
proxyFactory.setBus(bf.createBus(cxfConfig));
Greeter client = (Greeter) proxyFactory.create();
String result = client.greetMe("world!");
assertEquals("Get a wrong response", "Hello world!", result);
}
示例11: testWSAddressing
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; //导入依赖的package包/类
@Test
public void testWSAddressing() throws Exception {
JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(getClientAddress());
clientBean.setServiceClass(HelloWorld.class);
clientBean.setWsdlURL(WSRMTest.class.getResource("/HelloWorld.wsdl").toString());
SpringBusFactory bf = new SpringBusFactory();
URL cxfConfig = null;
if (getCxfClientConfig() != null) {
cxfConfig = ClassLoaderUtils.getResource(getCxfClientConfig(), this.getClass());
}
proxyFactory.setBus(bf.createBus(cxfConfig));
proxyFactory.getOutInterceptors().add(new MessageLossSimulator());
HelloWorld client = (HelloWorld) proxyFactory.create();
String result = client.sayHi("world!");
assertEquals("Get a wrong response", "Hello world!", result);
}
示例12: testInvokingServiceFromCXFClient
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; //导入依赖的package包/类
@Test
public void testInvokingServiceFromCXFClient() throws Exception {
JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(ROUTER_ADDRESS);
clientBean.setServiceClass(Greeter.class);
Greeter client = (Greeter) proxyFactory.create();
try {
client.pingMe();
fail("Expect to get an exception here");
} catch (PingMeFault expected) {
assertEquals(MESSAGE, expected.getMessage());
} catch (Throwable t) {
t.printStackTrace();
fail("The CXF client did not manage to map the client exception "
+ t.getClass().getName() + " to a " + PingMeFault.class.getName()
+ ": " + t.getMessage());
}
}
示例13: initializeRemoteServiceRegistry
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; //导入依赖的package包/类
protected ServiceRegistry initializeRemoteServiceRegistry() {
String registryBootstrapUrl = ConfigContext.getCurrentContextConfig().getProperty(KSBConstants.Config.REGISTRY_SERVICE_URL);
if (StringUtils.isBlank(registryBootstrapUrl)) {
throw new RiceRuntimeException("Failed to load registry bootstrap service from url: " + registryBootstrapUrl);
}
ClientProxyFactoryBean clientFactory = new JaxWsProxyFactoryBean();
clientFactory.setServiceClass(ServiceRegistry.class);
clientFactory.setBus(cxfBus);
clientFactory.setAddress(registryBootstrapUrl);
boolean registrySecurity = ConfigContext.getCurrentContextConfig().getBooleanProperty(SERVICE_REGISTRY_SECURITY_CONFIG, true);
// Set security interceptors
clientFactory.getOutInterceptors().add(new CXFWSS4JOutInterceptor(registrySecurity));
clientFactory.getInInterceptors().add(new CXFWSS4JInInterceptor(registrySecurity));
//Set transformation interceptors
clientFactory.getInInterceptors().add(new ImmutableCollectionsInInterceptor());
Object service = clientFactory.create();
if (!(service instanceof ServiceRegistry)) {
throw new RiceRuntimeException("Endpoint to service registry at URL '" + registryBootstrapUrl + "' was not an instance of ServiceRegistry, instead was: " + service);
}
return (ServiceRegistry)service;
}
示例14: createCXFClient
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; //导入依赖的package包/类
protected static OrderEndpoint createCXFClient(String url, String user, String passwordCallbackClass) {
List<Interceptor<? extends Message>> outInterceptors = new ArrayList();
// Define WSS4j properties for flow outgoing
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put("action", "UsernameToken Timestamp");
outProps.put("user", user);
outProps.put("passwordCallbackClass", passwordCallbackClass);
WSS4JOutInterceptor wss4j = new WSS4JOutInterceptor(outProps);
// Add LoggingOutInterceptor
LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor();
outInterceptors.add(wss4j);
outInterceptors.add(loggingOutInterceptor);
// we use CXF to create a client for us as its easier than JAXWS and works
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setOutInterceptors(outInterceptors);
factory.setServiceClass(OrderEndpoint.class);
factory.setAddress(url);
return (OrderEndpoint) factory.create();
}
示例15: getProxy
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; //导入依赖的package包/类
/**
* @return the proxy object. if null, display the connect dialog.
*/
protected Object getProxy() throws FosstrakAleClientException {
if (null == m_proxy) {
// display the connect dialog
String address = FosstrakAleClient.instance().showConnectDialog(m_endpointKey);
// create the proxy object.
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(m_clzz);
factory.setAddress(address);
m_proxy = factory.create();
// we try to perform a test method call.
// if that call fails, we assume the connection to be daad.
try {
m_testMethod.invoke(m_proxy, m_testMethodParameter);
} catch (Exception e) {
m_proxy = null;
throw new FosstrakAleClientServiceDownException(e);
}
}
return m_proxy;
}