proxyFac.setWsdlURL(wsdlURL);
private ReportIncidentEndpoint createCXFClient() { // we use CXF to create a client for us as its easier than JAXWS and works JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(ReportIncidentEndpoint.class); factory.setWsdlURL("reportIncident.wsdl"); factory.setAddress(ADDRESS); return (ReportIncidentEndpoint) factory.create(); }
factory.setWsdlURL(wsdlUrl.toExternalForm()); factory.setServiceName(commandServiceQName);
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; } }
@Test public void testGzip() throws Exception { URL wsdl = getWSDLURL(WSDL); JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setBus(bus); factory.setServiceClass(JMSGreeterPortType.class); factory.setWsdlURL(wsdl.toExternalForm()); factory.getFeatures().add(cff); factory.getFeatures().add(new GZIPFeature()); factory.setAddress("jms:queue:test.cxf.jmstransport.queue6"); JMSGreeterPortType greeter = (JMSGreeterPortType)markForClose(factory.create()); for (int idx = 0; idx < 5; idx++) { greeter.greetMeOneWay("test String"); String greeting = greeter.greetMe("Milestone-" + idx); Assert.assertEquals("Hello Milestone-" + idx, greeting); String reply = greeter.sayHi(); Assert.assertEquals("Bonjour", reply); } }
proxyFac.setWsdlURL(wsdlURL);