@Override @SuppressWarnings("unchecked") protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException { ClientProxyFactoryBean proxyFactoryBean = new ClientProxyFactoryBean(); proxyFactoryBean.setAddress(url.setProtocol("http").toIdentityString()); proxyFactoryBean.setServiceClass(serviceType); proxyFactoryBean.setBus(bus); T ref = (T) proxyFactoryBean.create(); Client proxy = ClientProxy.getClient(ref); HTTPConduit conduit = (HTTPConduit) proxy.getConduit(); HTTPClientPolicy policy = new HTTPClientPolicy(); policy.setConnectionTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT)); policy.setReceiveTimeout(url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT)); conduit.setClient(policy); return ref; }
@Override protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws RpcException { String addr = getAddr(url); HttpServer httpServer = serverMap.get(addr); if (httpServer == null) { httpServer = httpBinder.bind(url, new WebServiceHandler()); serverMap.put(addr, httpServer); } final ServerFactoryBean serverFactoryBean = new ServerFactoryBean(); serverFactoryBean.setAddress(url.getAbsolutePath()); serverFactoryBean.setServiceClass(type); serverFactoryBean.setServiceBean(impl); serverFactoryBean.setBus(bus); serverFactoryBean.setDestinationFactory(transportFactory); serverFactoryBean.create(); return new Runnable() { @Override public void run() { if(serverFactoryBean.getServer()!= null) { serverFactoryBean.getServer().destroy(); } if(serverFactoryBean.getBus()!=null) { serverFactoryBean.getBus().shutdown(true); } } }; }
public void destroy() throws Exception { if (obj != null) { if (obj instanceof Closeable) { ((Closeable)obj).close(); } else { Client c = ClientProxy.getClient(obj); c.destroy(); } obj = null; } } }
serverFactory.setServiceBean(implementor); serverFactory.setServiceClass(ClassHelper.getRealClass(implementor)); serverFactory.setAddress(url); serverFactory.setDataBinding(dataBinding); serverFactory.setBus(getServletBus()); serverFactory.create();
Object obj = super.create(); Service service = getServiceFactory().getService(); if (needWrapperClassInterceptor(service.getServiceInfos().get(0))) { List<Interceptor<? extends Message>> in = super.getInInterceptors(); List<Interceptor<? extends Message>> out = super.getOutInterceptors(); in.add(new WrapperClassInInterceptor()); in.add(new HolderInInterceptor());
public Server create() { ClassLoaderHolder orig = null; try { if (bus != null) { ClassLoader loader = bus.getExtension(ClassLoader.class); if (loader != null) { orig = ClassLoaderUtils.setThreadContextClassloader(loader); } } Server server = super.create(); initializeResourcesAndHandlerChain(server); checkPrivateEndpoint(server.getEndpoint()); return server; } finally { if (orig != null) { orig.reset(); } } }
public void setServiceClass(Class<?> serviceClass) { super.setServiceClass(serviceClass); if (((JaxWsServiceFactoryBean)getServiceFactory()).getJaxWsImplementorInfo() == null) { JaxWsImplementorInfo implInfo = new JaxWsImplementorInfo(serviceClass); ((JaxWsServiceFactoryBean)getServiceFactory()).setJaxWsImplementorInfo(implInfo); } }
public void publish(javax.xml.ws.spi.http.HttpContext context) { ServerFactoryBean sf = getServerFactory(); if (sf.getDestinationFactory() == null) { sf.setDestinationFactory(new JAXWSHttpSpiTransportFactory(context)); } publish(context.getPath()); }
protected String getConfiguredName() { QName name = getEndpointName(); if (name == null) { JaxWsServiceFactoryBean sfb = (JaxWsServiceFactoryBean)getClientFactoryBean().getServiceFactory(); name = sfb.getJaxWsImplementorInfo().getEndpointName(); } return name + ".jaxws-client.proxyFactory"; }
def = bus.getExtension(WSDLManager.class).getDefinition(wsdlLocation); new WSDLGetUtils().updateWSDLPublishedEndpointAddress(def, endpointInfo);
@Override public void setBindingId(String bind) { if (SOAPBinding.SOAP11HTTP_BINDING.equals(bind) || SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bind)) { super.setBindingId("http://schemas.xmlsoap.org/wsdl/soap/"); } else if (SOAPBinding.SOAP12HTTP_BINDING.equals(bind) || SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bind)) { super.setBindingId("http://schemas.xmlsoap.org/wsdl/soap12/"); } else { super.setBindingId(bind); } if (SOAPBinding.SOAP11HTTP_BINDING.equals(bind) || SOAPBinding.SOAP12HTTP_BINDING.equals(bind)) { setBindingConfig(new JaxWsSoapBindingConfiguration((JaxWsServiceFactoryBean)getServiceFactory())); } else if (SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bind) || SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bind)) { setBindingConfig(new JaxWsSoapBindingConfiguration((JaxWsServiceFactoryBean)getServiceFactory())); ((JaxWsSoapBindingConfiguration)getBindingConfig()).setMtomEnabled(true); } }
public void close() throws IOException { super.close(); binding = null; builder = null; }
@Override protected Class<?>[] getImplementingClasses() { Class<?> cls = getClientFactoryBean().getServiceClass(); return new Class[] {cls, BindingProvider.class, Closeable.class, Client.class}; }
public File getOutputFile() { JaxWsImplementorInfo jaxwsImpl = serviceFactory.getJaxWsImplementorInfo(); String wsdlLocation = jaxwsImpl.getWsdlLocation(); if (!StringUtils.isEmpty(wsdlLocation)) { try { URI uri = new URI(wsdlLocation); if ("file".equals(uri.getScheme()) || StringUtils.isEmpty(uri.getScheme())) { File f = new File(uri); if (f.exists()) { return f; } } } catch (Exception e) { //ignore } File f = new File(wsdlLocation); if (f.exists()) { return f; } } return super.getOutputFile(); }
BindingInfo bindingInfo = super.createBindingInfo();
@Override @SuppressWarnings("unchecked") protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException { ClientProxyFactoryBean proxyFactoryBean = new ClientProxyFactoryBean(); proxyFactoryBean.setAddress(url.setProtocol("http").toIdentityString()); proxyFactoryBean.setServiceClass(serviceType); proxyFactoryBean.setBus(bus); T ref = (T) proxyFactoryBean.create(); Client proxy = ClientProxy.getClient(ref); HTTPConduit conduit = (HTTPConduit) proxy.getConduit(); HTTPClientPolicy policy = new HTTPClientPolicy(); policy.setConnectionTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT)); policy.setReceiveTimeout(url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT)); conduit.setClient(policy); return ref; }
@Override protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws RpcException { String addr = getAddr(url); HttpServer httpServer = serverMap.get(addr); if (httpServer == null) { httpServer = httpBinder.bind(url, new WebServiceHandler()); serverMap.put(addr, httpServer); } final ServerFactoryBean serverFactoryBean = new ServerFactoryBean(); serverFactoryBean.setAddress(url.getAbsolutePath()); serverFactoryBean.setServiceClass(type); serverFactoryBean.setServiceBean(impl); serverFactoryBean.setBus(bus); serverFactoryBean.setDestinationFactory(transportFactory); serverFactoryBean.create(); return new Runnable() { @Override public void run() { if(serverFactoryBean.getServer()!= null) { serverFactoryBean.getServer().destroy(); } if(serverFactoryBean.getBus()!=null) { serverFactoryBean.getBus().shutdown(true); } } }; }
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(); }