JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setAddress("http://admin:password@localhost:8080/services/MyService"); factory.setServiceClass(ITest.class); ITest client = (ITest) factory.create(); client.test();
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(); }
public JAXWSClient() { JaxWsProxyFactoryBean cfb = new JaxWsProxyFactoryBean(); cfb.setServiceClass(BookStore.class); cfb.setAddress("http://localhost:" + System.getProperty("soapEndpointPort") + "/soap"); bookStore = (BookStore) cfb.create(); }
@Bean public OpiService opiService() { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(OpiService.class); factory.setAddress(webServiceURL); return (OpiService) factory.create(); }
public CxfClient(String url) { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setAddress(url); factory.setServiceClass(BookingServiceSoap.class); bookingService = (BookingServiceSoap) factory.create(); }
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(); } }
/** * */ public void init() { JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean(); factoryBean.setAddress(this.remoteURL); factoryBean.setServiceClass(RemoteCheckerService.class); this.remoteCheckerClient = (RemoteCheckerService) factoryBean.create(); // TODO set the connection timeout! }
private <T extends Getter> T createGetterService(final Class<T> serviceClass) { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setAddress("http://localhost:" + PORT + "/" + serviceClass.getSimpleName()); factory.getInInterceptors().add(new LoggingInInterceptor()); factory.getOutInterceptors().add(new LoggingOutInterceptor()); return factory.create(serviceClass); }
private static void initClient() { JaxWsProxyFactoryBean clientFactory = new JaxWsProxyFactoryBean(); clientFactory.setServiceClass(AttachmentService.class); clientFactory.setAddress(ADDRESS); client = (AttachmentService) clientFactory.create(); //enable MTOM in client BindingProvider bp = (BindingProvider) client; SOAPBinding binding = (SOAPBinding) bp.getBinding(); binding.setMTOMEnabled(true); } }
private Greeter createGreeterProxy() throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setBus(bus); factory.getFeatures().add(cff); factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICATION_TRANSPORTID); factory.setServiceClass(Greeter.class); factory.setAddress(SERVICE_ADDRESS); return (Greeter)markForClose(factory.create()); }
@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"); }
private CreateResponse createRemotely(Create body, ResourceReference ref) { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(ResourceFactory.class); factory.setAddress(ref.getResourceURL() + TransferConstants.RESOURCE_REMOTE_SUFFIX); ResourceFactory client = (ResourceFactory) factory.create(); CreateResponse response = client.create(body); // Adding of endpoint address to the response. response.getResourceCreated().setAddress(new AttributedURIType()); response.getResourceCreated().getAddress().setValue(ref.getResourceURL()); return response; } }
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 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"); }
private void specNoWsdlService(String messageType) throws Exception { String address = SERVICE_ADDRESS + ((messageType != null) ? "&messageType=" + messageType : ""); JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setBus(bus); factory.getFeatures().add(cff); factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICATION_TRANSPORTID); factory.setServiceClass(Hello.class); factory.setAddress(address); Hello client = (Hello)markForClose(factory.create()); String reply = client.sayHi(" HI"); Assert.assertEquals("get HI", reply); }
@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()); }
@Test public void testQualifiedPair() 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(); int ret = service.getQualifiedPair(new Pair<Integer, String>(111, "ffang")); assertEquals(111, ret); }
@Test public void testEndpoint() throws Exception { JaxWsProxyFactoryBean pf = new JaxWsProxyFactoryBean(); pf.setServiceClass(Greeter.class); pf.setAddress(add11); pf.setBus(bus); Greeter greeter = (Greeter) pf.create(); assertEquals("sayHi", greeter.sayHi("test")); assertEquals("sayHi2", greeter.sayHi2("test")); }
@Test public void testClientProxyFactory() { JaxWsProxyFactoryBean cf = new JaxWsProxyFactoryBean(); cf.setAddress("http://localhost:" + PORT + "/test"); cf.setServiceClass(Greeter.class); cf.setBus(getBus()); Configurer c = getBus().getExtension(Configurer.class); c.configureBean("client.proxyFactory", cf); Greeter greeter = (Greeter) cf.create(); Client client = ClientProxy.getClient(greeter); checkAddressInterceptors(client.getInInterceptors()); }
@Test public void testSoap12Endpoint() throws Exception { JaxWsProxyFactoryBean pf = new JaxWsProxyFactoryBean(); pf.setServiceClass(Greeter.class); pf.setAddress(add12); SoapBindingConfiguration config = new SoapBindingConfiguration(); config.setVersion(Soap12.getInstance()); pf.setBindingConfig(config); pf.setBus(bus); Greeter greeter = (Greeter) pf.create(); assertEquals("sayHi", greeter.sayHi("test")); assertEquals("sayHi2", greeter.sayHi2("test")); }