JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean(); proxyFactory.setServiceClass(MyService.class); proxyFactory.setWsdlLocation("/wsdl/MyService.wsdl");
final QName qname = new QName(Settings.MAIN_SCAN_SERVICE_SOAP_URL.get().toString(), "PortName"); final String wsdlUrl = Settings.MAIN_SCAN_SERVICE_WSDL_URL.get().toString(); final JaxWsProxyFactoryBean jaxWsProxyFactoryBean = new JaxWsProxyFactoryBean(); jaxWsProxyFactoryBean.setAddress(Settings.MAIN_SCAN_SERVICE_SOAP_URL.get().toString()); jaxWsProxyFactoryBean.setEndpointName(qname); jaxWsProxyFactoryBean.setServiceName(new QName(wsdlUrl, "PortName")); jaxWsProxyFactoryBean.setWsdlLocation(wsdlUrl); jaxWsProxyFactoryBean.setServiceClass(PortImpl.class); this.portImpl = (PortImpl) jaxWsProxyFactoryBean.create();
jaxWs.setServiceClass(SokVagvalsInfoInterface.class); jaxWs.setAddress(takEndpoint); jaxWs.setWsdlLocation(SokVagvalsServiceSoap11LitDocService.WSDL_LOCATION.toExternalForm());
private void setupForTest(boolean specifyWsdl) throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(AegisJaxWsWsdlNs.class); if (specifyWsdl) { factory.setServiceName(new QName("http://v1_1_2.rtf2pdf.doc.ws.daisy.marbes.cz", "AegisJaxWsWsdlNsImplService")); factory.setWsdlLocation("http://localhost:" + PORT + "/aegisJaxWsWSDLNS?wsdl"); } factory.getServiceFactory().setDataBinding(new AegisDatabinding()); factory.setAddress("http://localhost:" + PORT + "/aegisJaxWsWSDLNS"); client = (AegisJaxWsWsdlNs)factory.create(); }
@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); }
@Test public void testSwa() throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setWsdlLocation("classpath:/swa-mime_jms.wsdl"); factory.setTransportId(SoapJMSConstants.SOAP_JMS_SPECIFICIATION_TRANSPORTID); factory.setServiceName(new QName("http://cxf.apache.org/swa", "SwAService"));
@Test(expected = SOAPFaultException.class) public void testReplyAndReplyToDestinations() throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setWsdlLocation("classpath:/wsdl/jms_test.wsdl"); factory.setServiceName(new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldService")); factory.setEndpointName(new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldPort")); factory.setAddress("jms://"); JMSConfigFeature feature = new JMSConfigFeature(); JMSConfiguration config = new JMSConfiguration(); config.setConnectionFactory(new ActiveMQConnectionFactory(broker.getBrokerURL())); config.setRequestURI("test.jmstransport.text"); config.setTargetDestination("test.jmstransport.text"); // replyDestination and replyToDestination intentionally differ in this test scenario // replyDestination = Destination name to listen on for reply messages config.setReplyDestination("test.jmstransport.text.reply"); // replyToDestination = Destination name to send out as replyTo address in the message config.setReplyToDestination("test.jmstransport.text.replyTo"); config.setReceiveTimeout(1000L); feature.setJmsConfig(config); factory.getFeatures().add(feature); HelloWorldPortType greeter = factory.create(HelloWorldPortType.class); try { greeter.greetMe("FooBar"); // Timeout exception should be thrown } finally { ((java.io.Closeable)greeter).close(); } }