org.apache.cxf.jaxws.JaxWsProxyFactoryBean Java Examples
The following examples show how to use
org.apache.cxf.jaxws.JaxWsProxyFactoryBean.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SoapClient.java From document-management-software with GNU Lesser General Public License v3.0 | 7 votes |
/** * Standard service initialization. Concrete implementations can change the * client initialization logic */ @SuppressWarnings("unchecked") protected void initClient(Class<T> serviceClass, int gzipThreshold, boolean log) { // Needed to get rig of CXF exception // "Cannot create a secure XMLInputFactory" System.setProperty("org.apache.cxf.stax.allowInsecureParser", "true"); JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); if (log) { factory.getInInterceptors().add(new LoggingInInterceptor()); factory.getOutInterceptors().add(new LoggingOutInterceptor()); } if (gzipThreshold >= 0) { factory.getInInterceptors().add(new GZIPInInterceptor()); factory.getOutInterceptors().add(new GZIPOutInterceptor(gzipThreshold)); } factory.setServiceClass(serviceClass); factory.setAddress(endpoint); client = (T) factory.create(); }
Example #2
Source File: IntegrationBaseTest.java From cxf with Apache License 2.0 | 6 votes |
protected Resource createClient(ReferenceParametersType refParams) { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); Map<String, Object> props = factory.getProperties(); if (props == null) { props = new HashMap<>(); } props.put("jaxb.additionalContextClasses", ExpressionType.class); factory.setProperties(props); factory.setBus(bus); factory.setServiceClass(Resource.class); factory.setAddress(RESOURCE_ADDRESS); Resource proxy = (Resource) factory.create(); // Add reference parameters AddressingProperties addrProps = new AddressingProperties(); EndpointReferenceType endpoint = new EndpointReferenceType(); endpoint.setReferenceParameters(refParams); endpoint.setAddress(ContextUtils.getAttributedURI(RESOURCE_ADDRESS)); addrProps.setTo(endpoint); ((BindingProvider) proxy).getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps); return proxy; }
Example #3
Source File: CxfTest.java From java-specialagent with Apache License 2.0 | 6 votes |
@Test public void testWs(final MockTracer tracer) { final String msg = "hello"; // prepare server final JaxWsServerFactoryBean serverFactory = new JaxWsServerFactoryBean(); serverFactory.setServiceClass(Echo.class); serverFactory.setAddress(BASE_URI); serverFactory.setServiceBean(new EchoImpl()); final Server server = serverFactory.create(); // prepare client final JaxWsProxyFactoryBean clientFactory = new JaxWsProxyFactoryBean(); clientFactory.setServiceClass(Echo.class); clientFactory.setAddress(BASE_URI); final Echo echo = (Echo)clientFactory.create(); final String response = echo.echo(msg); assertEquals(msg, response); assertEquals(2, tracer.finishedSpans().size()); server.destroy(); serverFactory.getBus().shutdown(true); }
Example #4
Source File: StudentTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testReturnMap() throws Exception { JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(); sf.setServiceClass(StudentService.class); sf.setServiceBean(new StudentServiceImpl()); sf.setAddress("local://StudentService"); setupAegis(sf); Server server = sf.create(); server.start(); JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setAddress("local://StudentService"); proxyFac.setBus(getBus()); setupAegis(proxyFac.getClientFactoryBean()); StudentService clientInterface = proxyFac.create(StudentService.class); Map<Long, Student> fullMap = clientInterface.getStudentsMap(); assertNotNull(fullMap); Student one = fullMap.get(Long.valueOf(1)); assertNotNull(one); assertEquals("Student1", one.getName()); Map<String, ?> wildMap = clientInterface.getWildcardMap(); assertEquals("valuestring", wildMap.get("keystring")); }
Example #5
Source File: OpenTracingTracingTest.java From cxf with Apache License 2.0 | 6 votes |
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; }
Example #6
Source File: ClientConfig.java From cxf-jaxws with MIT License | 6 votes |
@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(); }
Example #7
Source File: ExceptionTest.java From cxf with Apache License 2.0 | 6 votes |
@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(); }
Example #8
Source File: ClientConfig.java From cxf-jaxws with MIT License | 6 votes |
@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(); }
Example #9
Source File: SoapChannel.java From BIMserver with GNU Affero General Public License v3.0 | 6 votes |
public void connect(TokenHolder tokenHolder) { for (Class<? extends PublicInterface> interface1 : interfaces) { JaxWsProxyFactoryBean cpfb = new JaxWsProxyFactoryBean(); cpfb.setServiceClass(interface1); cpfb.setAddress(address + "/" + interface1.getSimpleName()); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("mtom-enabled", Boolean.TRUE); cpfb.setProperties(properties); PublicInterface serviceInterface = (PublicInterface) cpfb.create(); client = ClientProxy.getClient(serviceInterface); HTTPConduit http = (HTTPConduit) client.getConduit(); http.getClient().setConnectionTimeout(360000); http.getClient().setAllowChunking(false); http.getClient().setReceiveTimeout(320000); if (!useSoapHeaderSessions) { ((BindingProvider) serviceInterface).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE); } add(interface1.getName(), serviceInterface); } tokenHolder.registerTokenChangeListener(this); notifyOfConnect(); }
Example #10
Source File: SpringBeansTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testClientFromFactory() throws Exception { AbstractFactoryBeanDefinitionParser.setFactoriesAreAbstract(false); ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] {"/org/apache/cxf/jaxws/spring/clients.xml"}); JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); Greeter g = factory.create(Greeter.class); ClientImpl c = (ClientImpl)ClientProxy.getClient(g); for (Interceptor<? extends Message> i : c.getInInterceptors()) { if (i instanceof LoggingInInterceptor) { ctx.close(); return; } } ctx.close(); fail("Did not configure the client"); }
Example #11
Source File: PerUserPerServiceClientFactory.java From yes-cart with Apache License 2.0 | 6 votes |
protected PerUserPerServiceClientFactory(final NodeService nodeService, final Class<T> serviceInterface, final String userName, final String password, final String url, final long timeout) { this.userName = userName; this.password = password; this.url = url; this.timeout = timeout; this.factory = new JaxWsProxyFactoryBean(); this.factory.setServiceClass(serviceInterface); this.factory.setAddress(this.url); final Slf4JLoggingInInterceptor loggingInInterceptor = new Slf4JLoggingInInterceptor(nodeService); loggingInInterceptor.setPrettyLogging(false); final Slf4JLoggingOutInterceptor loggingOutInterceptor = new Slf4JLoggingOutInterceptor(nodeService); loggingOutInterceptor.setPrettyLogging(false); this.factory.getInInterceptors().add(loggingInInterceptor); this.factory.getInFaultInterceptors().add(loggingInInterceptor); this.factory.getOutInterceptors().add(loggingOutInterceptor); this.factory.getOutFaultInterceptors().add(loggingOutInterceptor); }
Example #12
Source File: Client.java From servicemix with Apache License 2.0 | 6 votes |
public void sendRequest() throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(HelloWorld.class); factory.setAddress("http://localhost:8181/cxf/HelloWorldSecurity"); HelloWorld client = (HelloWorld) factory.create(); Map<String, Object> outProps = new HashMap<String, Object>(); outProps.put("action", "UsernameToken"); //add a CustomerSecurityInterceptor for client side to init wss4j staff //retrieve and set user/password, users can easily add this interceptor //through spring configuration also ClientProxy.getClient(client).getOutInterceptors().add(new CustomerSecurityInterceptor()); ClientProxy.getClient(client).getOutInterceptors().add(new WSS4JOutInterceptor()); String ret = client.sayHi("ffang"); System.out.println(ret); }
Example #13
Source File: Client.java From servicemix with Apache License 2.0 | 6 votes |
public void sendRequest() throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(HelloWorld.class); factory.setAddress("http://localhost:8181/cxf/HelloWorldSecurity"); HelloWorld client = (HelloWorld) factory.create(); Map<String, Object> outProps = new HashMap<String, Object>(); outProps.put("action", "UsernameToken"); //add a CustomerSecurityInterceptor for client side to init wss4j staff //retrieve and set user/password, users can easily add this interceptor //through spring configuration also ClientProxy.getClient(client).getOutInterceptors().add(new CustomerSecurityInterceptor()); ClientProxy.getClient(client).getOutInterceptors().add(new WSS4JOutInterceptor()); String ret = client.sayHi("ffang"); System.out.println(ret); }
Example #14
Source File: AttributeTest.java From cxf with Apache License 2.0 | 6 votes |
private void setupClientAndRhino(String clientProxyFactoryBeanId) throws IOException { testUtilities.setBus(getBean(Bus.class, "cxf")); testUtilities.initializeRhino(); testUtilities.readResourceIntoRhino("/org/apache/cxf/javascript/cxf-utils.js"); clientProxyFactory = getBean(JaxWsProxyFactoryBean.class, clientProxyFactoryBeanId); client = clientProxyFactory.getClientFactoryBean().create(); serviceInfos = client.getEndpoint().getService().getServiceInfos(); // there can only be one. assertEquals(1, serviceInfos.size()); ServiceInfo serviceInfo = serviceInfos.get(0); schemata = serviceInfo.getSchemas(); nameManager = BasicNameManager.newNameManager(serviceInfo); NamespacePrefixAccumulator prefixAccumulator = new NamespacePrefixAccumulator(serviceInfo.getXmlSchemaCollection()); for (SchemaInfo schema : schemata) { SchemaJavascriptBuilder builder = new SchemaJavascriptBuilder(serviceInfo .getXmlSchemaCollection(), prefixAccumulator, nameManager); String allThatJavascript = builder.generateCodeForSchema(schema.getSchema()); assertNotNull(allThatJavascript); testUtilities.readStringIntoRhino(allThatJavascript, schema.toString() + ".js"); } }
Example #15
Source File: ClientMtomXopWithJMSTest.java From cxf with Apache License 2.0 | 6 votes |
private static <T> T createPort(QName serviceName, QName portName, Class<T> serviceEndpointInterface, boolean enableMTOM) throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setBus(bus); factory.setServiceName(serviceName); factory.setServiceClass(serviceEndpointInterface); factory.setWsdlURL(ClientMtomXopTest.class.getResource("/wsdl/mtom_xop.wsdl").toExternalForm()); factory.setFeatures(Collections.singletonList(cff)); factory.getInInterceptors().add(new TestMultipartMessageInterceptor()); factory.getOutInterceptors().add(new TestAttachmentOutInterceptor()); @SuppressWarnings("unchecked") T proxy = (T)factory.create(); BindingProvider bp = (BindingProvider)proxy; SOAPBinding binding = (SOAPBinding)bp.getBinding(); binding.setMTOMEnabled(true); return proxy; }
Example #16
Source File: SerializationTest.java From cxf with Apache License 2.0 | 6 votes |
private void setupClientAndRhino(String clientProxyFactoryBeanId) throws IOException { testUtilities.setBus(getBean(Bus.class, "cxf")); testUtilities.initializeRhino(); testUtilities.readResourceIntoRhino("/org/apache/cxf/javascript/cxf-utils.js"); clientProxyFactory = getBean(JaxWsProxyFactoryBean.class, clientProxyFactoryBeanId); client = clientProxyFactory.getClientFactoryBean().create(); serviceInfos = client.getEndpoint().getService().getServiceInfos(); // there can only be one. assertEquals(1, serviceInfos.size()); ServiceInfo serviceInfo = serviceInfos.get(0); schemata = serviceInfo.getSchemas(); nameManager = BasicNameManager.newNameManager(serviceInfo); NamespacePrefixAccumulator prefixAccumulator = new NamespacePrefixAccumulator(serviceInfo.getXmlSchemaCollection()); for (SchemaInfo schema : schemata) { SchemaJavascriptBuilder builder = new SchemaJavascriptBuilder(serviceInfo .getXmlSchemaCollection(), prefixAccumulator, nameManager); String allThatJavascript = builder.generateCodeForSchema(schema.getSchema()); assertNotNull(allThatJavascript); testUtilities.readStringIntoRhino(allThatJavascript, schema.toString() + ".js"); } }
Example #17
Source File: AegisClientServerTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testCollection() throws Exception { AegisDatabinding aegisBinding = new AegisDatabinding(); JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean(); proxyFactory.setDataBinding(aegisBinding); proxyFactory.setServiceClass(SportsService.class); proxyFactory.setWsdlLocation("http://localhost:" + PORT + "/jaxwsAndAegisSports?wsdl"); proxyFactory.getInInterceptors().add(new LoggingInInterceptor()); proxyFactory.getOutInterceptors().add(new LoggingOutInterceptor()); SportsService service = (SportsService) proxyFactory.create(); Collection<Team> teams = service.getTeams(); assertEquals(1, teams.size()); assertEquals("Patriots", teams.iterator().next().getName()); //CXF-1251 String s = service.testForMinOccurs0("A", null, "b"); assertEquals("Anullb", s); }
Example #18
Source File: AegisClientServerTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testComplexMapResult() throws Exception { AegisDatabinding aegisBinding = new AegisDatabinding(); JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean(); proxyFactory.setDataBinding(aegisBinding); proxyFactory.setServiceClass(SportsService.class); proxyFactory.setAddress("http://localhost:" + PORT + "/jaxwsAndAegisSports"); proxyFactory.getInInterceptors().add(new LoggingInInterceptor()); proxyFactory.getOutInterceptors().add(new LoggingOutInterceptor()); SportsService service = (SportsService) proxyFactory.create(); Map<String, Map<Integer, Integer>> result = service.testComplexMapResult(); assertEquals(result.size(), 1); assertTrue(result.containsKey("key1")); assertNotNull(result.get("key1")); assertEquals(result.toString(), "{key1={1=3}}"); }
Example #19
Source File: CXFITest.java From java-specialagent with Apache License 2.0 | 6 votes |
public static void main(final String[] args) { final String msg = "hello"; final JaxWsServerFactoryBean serverFactory = new JaxWsServerFactoryBean(); serverFactory.setAddress(BASE_URI); serverFactory.setServiceBean(new EchoImpl()); final Server server = serverFactory.create(); final JaxWsProxyFactoryBean clientFactory = new JaxWsProxyFactoryBean(); clientFactory.setServiceClass(Echo.class); clientFactory.setAddress(BASE_URI); final Echo echo = (Echo)clientFactory.create(); echo.echo(msg); // CXF Tracing span has no "component" tag, cannot use TestUtil.checkSpan() checkSpans(2); server.destroy(); serverFactory.getBus().shutdown(true); }
Example #20
Source File: EventSinkInterfaceNotificationTask.java From cxf with Apache License 2.0 | 6 votes |
protected Object getProxy(Class<?> sinkInterface, Class<?>... extraClasses) { //needed SOAP handlers ReferenceParametersAddingHandler handler = new ReferenceParametersAddingHandler( target.getNotificationReferenceParams()); JaxWsProxyFactoryBean service = new JaxWsProxyFactoryBean(); service.getOutInterceptors().add(new LoggingOutInterceptor()); service.setServiceClass(sinkInterface); service.setAddress(target.getTargetURL()); service.getHandlers().add(handler); // do we need to apply a filter? if (target.getFilter() != null && target.getFilter().getContent().size() > 0) { service.getOutInterceptors().add(new FilteringInterceptor(target.getFilter())); } if (extraClasses != null && extraClasses.length > 0) { Map<String, Object> props = new HashMap<>(); props.put("jaxb.additionalContextClasses", extraClasses); service.getClientFactoryBean().getServiceFactory().setProperties(props); } return service.create(); }
Example #21
Source File: JAXWSBPNamespaceHandler.java From cxf with Apache License 2.0 | 5 votes |
public Metadata parse(Element element, ParserContext context) { String s = element.getLocalName(); if ("endpoint".equals(s)) { return new EndpointDefinitionParser().parse(element, context); } else if ("server".equals(s)) { return new ServerFactoryBeanDefinitionParser(BPJaxWsServerFactoryBean.class) .parse(element, context); } else if ("client".equals(s)) { return new ClientProxyFactoryBeanDefinitionParser(JaxWsProxyFactoryBean.class) .parse(element, context); } return null; }
Example #22
Source File: XKMSClientFactory.java From cxf with Apache License 2.0 | 5 votes |
public static XKMSPortType create(String endpointAddress, Bus bus) { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setBus(bus); factory.setServiceClass(XKMSPortType.class); factory.setAddress(endpointAddress); Map<String, Object> properties = new HashMap<>(); properties.put("jaxb.additionalContextClasses", new Class[] {ResultDetails.class}); factory.setProperties(properties); return (XKMSPortType)factory.create(); }
Example #23
Source File: CxfClientPluginIT.java From glowroot with Apache License 2.0 | 5 votes |
@Override public void executeApp() throws Exception { int port = getAvailablePort(); Endpoint.publish("http://localhost:" + port + "/cxf/helloWorld", new HelloWorldImpl()); JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(HelloWorld.class); factory.setAddress("http://localhost:" + port + "/cxf/helloWorld"); client = (HelloWorld) factory.create(); transactionMarker(); }
Example #24
Source File: WSAFeatureTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testClientProxyFactory() { JaxWsProxyFactoryBean cf = new JaxWsProxyFactoryBean(); cf.setAddress("http://localhost:" + PORT + "/test"); cf.getFeatures().add(new WSAddressingFeature()); cf.setServiceClass(Greeter.class); Greeter greeter = (Greeter) cf.create(); Client client = ClientProxy.getClient(greeter); checkAddressInterceptors(client.getInInterceptors()); }
Example #25
Source File: NoSpringServletClientTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testHelloService() throws Exception { JaxWsProxyFactoryBean cpfb = new JaxWsProxyFactoryBean(); String address = serviceURL + "Hello"; cpfb.setServiceClass(Hello.class); cpfb.setAddress(address); Hello hello = (Hello) cpfb.create(); String reply = hello.sayHi(" Willem"); assertEquals("Get the wrongreply ", reply, "get Willem"); }
Example #26
Source File: InvokeCounter.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
public static void main(String[] args) { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.getInInterceptors().add(new LoggingInInterceptor()); factory.getOutInterceptors().add(new LoggingOutInterceptor()); factory.setServiceClass(Counter.class); factory.setAddress("http://localhost:12345/counter"); Counter counter = (Counter) factory.create(); counter.inc(); counter.inc(); counter.inc(); counter.inc(); counter.inc(); System.out.println(counter.getCount()); }
Example #27
Source File: JaxwsAsyncFailOverTest.java From cxf with Apache License 2.0 | 5 votes |
@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()); }
Example #28
Source File: StaxToDOMSamlTest.java From cxf with Apache License 2.0 | 5 votes |
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(); }
Example #29
Source File: WSAClientServerTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testNoWsaFeature() throws Exception { ByteArrayOutputStream input = setupInLogging(); ByteArrayOutputStream output = setupOutLogging(); JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(AddNumbersPortType.class); factory.setAddress("http://localhost:" + PORT + "/jaxws/add"); AddNumbersPortType port = (AddNumbersPortType) factory.create(); assertEquals(3, port.addNumbers(1, 2)); assertLogNotContains(output.toString(), "//wsa:Address"); assertLogNotContains(input.toString(), "//wsa:RelatesTo"); }
Example #30
Source File: LeaveWebServiceBusinessTest.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
/** * 不需要总经理审批 * @throws ParseException */ @Test public void testFalse() throws ParseException { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.getInInterceptors().add(new LoggingInInterceptor()); factory.getOutInterceptors().add(new LoggingOutInterceptor()); factory.setServiceClass(LeaveWebService.class); factory.setAddress(LeaveWebserviceUtil.WEBSERVICE_URL); LeaveWebService leaveWebService = (LeaveWebService) factory.create(); boolean audit = leaveWebService.generalManagerAudit("2013-01-01 09:00", "2013-01-04 17:30"); assertFalse(audit); }