Java Code Examples for org.apache.cxf.endpoint.Client#destroy()
The following examples show how to use
org.apache.cxf.endpoint.Client#destroy() .
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: ManagedConnectionImpl.java From cxf with Apache License 2.0 | 5 votes |
public void destroy() throws ResourceException { if (LOG.isLoggable(Level.FINER)) { LOG.finer("destroy"); } Client client = ClientProxy.getClient(clientProxy); client.destroy(); handles.clear(); isClosed = false; bus = null; connReqInfo = null; }
Example 2
Source File: DynamicClientEndpointCreationLoop.java From cxf with Apache License 2.0 | 5 votes |
private void iteration() throws URISyntaxException { URL wsdl = getClass().getResource("/wsdl/others/dynamic_client_base64.wsdl"); String wsdlUrl = null; wsdlUrl = wsdl.toURI().toString(); DynamicClientFactory dynamicClientFactory = DynamicClientFactory.newInstance(bus); Client client = dynamicClientFactory.createClient(wsdlUrl); client.destroy(); }
Example 3
Source File: JaxWsProxyFactoryBeanDefinitionParser.java From cxf with Apache License 2.0 | 5 votes |
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; } }
Example 4
Source File: ClientProxyFactoryBeanDefinitionParser.java From cxf with Apache License 2.0 | 5 votes |
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; } }
Example 5
Source File: FaultTest.java From cxf with Apache License 2.0 | 4 votes |
@org.junit.Test public void testSoap12Dispatch() throws Exception { createBus(); BusFactory.setDefaultBus(getBus()); URL wsdl = FaultTest.class.getResource("DoubleItFault.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItSoap12DispatchPort"); Dispatch<DOMSource> dispatch = service.createDispatch(portQName, DOMSource.class, Service.Mode.PAYLOAD); // Creating a DOMSource Object for the request DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document requestDoc = db.newDocument(); Element root = requestDoc.createElementNS("http://www.example.org/schema/DoubleIt", "ns2:DoubleIt"); root.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:ns2", "http://www.example.org/schema/DoubleIt"); Element number = requestDoc.createElementNS(null, "numberToDouble"); number.setTextContent("25"); root.appendChild(number); requestDoc.appendChild(root); DOMSource request = new DOMSource(requestDoc); // Add WS-Security configuration Client client = ((DispatchImpl<DOMSource>) dispatch).getClient(); client.getRequestContext().put( SecurityConstants.CALLBACK_HANDLER, "org.apache.cxf.systest.ws.common.KeystorePasswordCallback" ); client.getRequestContext().put( SecurityConstants.ENCRYPT_PROPERTIES, "bob.properties" ); client.getRequestContext().put(SecurityConstants.ENCRYPT_USERNAME, "bob"); updateAddressPort(dispatch, PORT); // Make a successful request client.getRequestContext().put(SecurityConstants.USERNAME, "alice"); DOMSource response = dispatch.invoke(request); assertNotNull(response); // Now make an invocation using another username client.getRequestContext().put(SecurityConstants.USERNAME, "bob"); client.getRequestContext().put("security.password", "password"); try { dispatch.invoke(request); fail("Expected failure on bob"); } catch (Exception ex) { assertTrue(ex.getMessage().contains("This is a fault")); } client.destroy(); }