You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Brecht Yperman (JIRA)" <ji...@apache.org> on 2015/11/06 13:35:27 UTC

[jira] [Comment Edited] (CXF-5407) WSDLManagerImpl.removeDefinition doesn't take effect

    [ https://issues.apache.org/jira/browse/CXF-5407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14993588#comment-14993588 ] 

Brecht Yperman edited comment on CXF-5407 at 11/6/15 12:35 PM:
---------------------------------------------------------------

I'm experiencing the same issue, when trying to dynamically redeploy an existing Endpoint.

It seems to boil down to CacheMap.remove() not actually removing unless the keys are identical.

{code}
@Test
	public void TestCacheMap() {
		Map<Object, Object> definitions = new CacheMap<Object, Object>();
		
		Object putValue = new Object();
		
		String putKey = "test";
		definitions.put(putKey, putValue);
		
		String removeKey = new String("test");
		Object removeValue = definitions.remove(removeKey);
		
		assertEquals(putKey, removeKey);
		assertEquals(putValue, removeValue);
		assertTrue(definitions.isEmpty());
	}
{code}

(this test fails with CXF 3.1.4)


was (Author: brecht.yperman@invenso.com):
I'm experiencing the same issue, when trying to dynamically redeploy an existing Endpoint.

It seems to boil down to CacheMap.remove() not actually removing unless the keys are identical.

{code}
@Test
	public void TestCacheMap() {
		Map<Object, Object> definitions = new CacheMap<Object, Object>();
		
		Object putValue = new Object();
		
		String putKey = "test";
		definitions.put(putKey, putValue);
		
		String removeKey = new String("test");
		Object removeValue = definitions.remove(removeKey);
		
		assertEquals(putKey, removeKey);
		assertEquals(putValue, removeValue);
		assertTrue(definitions.isEmpty());
	}
{code}

> WSDLManagerImpl.removeDefinition doesn't take effect
> ----------------------------------------------------
>
>                 Key: CXF-5407
>                 URL: https://issues.apache.org/jira/browse/CXF-5407
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.6.2
>            Reporter: Bin Zhu
>
> I was trying to invoke WSDLManagerImpl.removeDefinition to remove the WSDL cache in web service client side to avoid the invalid WSDL defination when the WSDL file for web service is server side changed. see more details in https://issues.apache.org/jira/browse/CXF-5216
> I was using following code to to remove the cach:
>             WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);
>             synchronized (wsdlManager) {
>                 Map<Object, Definition> map = wsdlManager.getDefinitions();
>                 if (!map.isEmpty() && url != null && map.containsKey(url.toString())) {
>                     wsdlManager.removeDefinition(wsdlManager.getDefinition(url.toString()));
>                 }
>             }
> But it is found the WSDLcache is not removed as expected later.
> I tried to add more system out info in WSDLManagerImpl.removeDefinition and debug it and find the it didn't removed the WSDL definition definitionsMap.
> This should not be "synchronized" issue since the object id for the defination is the same when I debug it. It should the the same object and it's unreasonalbe that the defination object is still in the definitionsMap after invoking definitionsMap.remove(o). Any ideas?
> The added system out:
>     public void removeDefinition(Definition wsdl) {
>         synchronized (definitionsMap) {
>             List<Object> keys = new ArrayList<Object>();
>             for (Map.Entry<Object, Definition> e : definitionsMap.entrySet()) {
>                 if (e.getValue() == wsdl) {
>                     keys.add(e.getKey());
>                 }
>             }
>             for (Object o : keys) {
>                 // Print contents of definitionsMap before remove the defination.
>             	System.out.println("--WSDLManagerImpl--map before----------->:"+definitionsMap);
> 		// Print removed the defination.               
>  		System.out.println("--WSDLManagerImpl--removed map----------->:"+definitionsMap.remove(o));
>                 // Print the contents of definitionsMap before remove the defination.  
> 		System.out.println("--WSDLManagerImpl--map after----------->:"+definitionsMap);
>                 schemaCacheMap.remove(o);
>             }
>         }
>     }
> Output:
> //There is 1 defination for http://localhost:8010/MTOMTest/MTOMService?wsdl before removing
> --WSDLManagerImpl--map before----------->:{http://localhost:8010/MTOMTest/MTOMService?wsdl=Definition: name={http://MTOMService/}MTOMService targetNamespace=http://MTOMService/
> Types:
> SchemaExtensibilityElement ({http://www.w3.org/2001/XMLSchema}schema):
> required=null
> element=[xs:schema: null]
> Message: name={http://MTOMService/}getAttachment
> Part: name=parameters
> elementName={http://MTOMService/}getAttachment
> Message: name={http://MTOMService/}getAttachmentResponse
> Part: name=parameters
> elementName={http://MTOMService/}getAttachmentResponse
> PortType: name={http://MTOMService/}MTOMInter
> Operation: name=getAttachment
> style=REQUEST_RESPONSE,1
> Input: name=getAttachment
> Message: name={http://MTOMService/}getAttachment
> Part: name=parameters
> elementName={http://MTOMService/}getAttachment
> Output: name=getAttachmentResponse
> Message: name={http://MTOMService/}getAttachmentResponse
> Part: name=parameters
> elementName={http://MTOMService/}getAttachmentResponse
> Binding: name={http://MTOMService/}MTOMServiceSoapBinding
> PortType: name={http://MTOMService/}MTOMInter
> Operation: name=getAttachment
> style=REQUEST_RESPONSE,1
> Input: name=getAttachment
> Message: name={http://MTOMService/}getAttachment
> Part: name=parameters
> elementName={http://MTOMService/}getAttachment
> Output: name=getAttachmentResponse
> Message: name={http://MTOMService/}getAttachmentResponse
> Part: name=parameters
> elementName={http://MTOMService/}getAttachmentResponse
> BindingOperation: name=getAttachment
> BindingInput: name=getAttachment
> SOAPBody ({http://schemas.xmlsoap.org/wsdl/soap/}body):
> required=null
> use=literal
> BindingOutput: name=getAttachmentResponse
> SOAPBody ({http://schemas.xmlsoap.org/wsdl/soap/}body):
> required=null
> use=literal
> SOAPOperation ({http://schemas.xmlsoap.org/wsdl/soap/}operation):
> required=null
> soapActionURI=
> style=document
> SOAPBinding ({http://schemas.xmlsoap.org/wsdl/soap/}binding):
> required=null
> transportURI=http://schemas.xmlsoap.org/soap/http
> style=document
> Service: name={http://MTOMService/}MTOMService
> Port: name=MTOMServicePort
> Binding: name={http://MTOMService/}MTOMServiceSoapBinding
> PortType: name={http://MTOMService/}MTOMInter
> Operation: name=getAttachment
> style=REQUEST_RESPONSE,1
> Input: name=getAttachment
> Message: name={http://MTOMService/}getAttachment
> Part: name=parameters
> elementName={http://MTOMService/}getAttachment
> Output: name=getAttachmentResponse
> Message: name={http://MTOMService/}getAttachmentResponse
> Part: name=parameters
> elementName={http://MTOMService/}getAttachmentResponse
> BindingOperation: name=getAttachment
> BindingInput: name=getAttachment
> SOAPBody ({http://schemas.xmlsoap.org/wsdl/soap/}body):
> required=null
> use=literal
> BindingOutput: name=getAttachmentResponse
> SOAPBody ({http://schemas.xmlsoap.org/wsdl/soap/}body):
> required=null
> use=literal
> SOAPOperation ({http://schemas.xmlsoap.org/wsdl/soap/}operation):
> required=null
> soapActionURI=
> style=document
> SOAPBinding ({http://schemas.xmlsoap.org/wsdl/soap/}binding):
> required=null
> transportURI=http://schemas.xmlsoap.org/soap/http
> style=document
> SOAPAddress ({http://schemas.xmlsoap.org/wsdl/soap/}address):
> required=null
> locationURI=http://localhost:8010/MTOMTest/MTOMService
> UnknownExtensibilityElement ({http://www.w3.org/ns/ws-policy}Policy):
> required=null
> element=[wsp:Policy: null]}
> //Print the removed defination
> --WSDLManagerImpl--removed map----------->:Definition: name={http://MTOMService/}MTOMService targetNamespace=http://MTOMService/
> Types:
> SchemaExtensibilityElement ({http://www.w3.org/2001/XMLSchema}schema):
> required=null
> element=[xs:schema: null]
> Message: name={http://MTOMService/}getAttachment
> Part: name=parameters
> elementName={http://MTOMService/}getAttachment
> Message: name={http://MTOMService/}getAttachmentResponse
> Part: name=parameters
> elementName={http://MTOMService/}getAttachmentResponse
> PortType: name={http://MTOMService/}MTOMInter
> Operation: name=getAttachment
> style=REQUEST_RESPONSE,1
> Input: name=getAttachment
> Message: name={http://MTOMService/}getAttachment
> Part: name=parameters
> elementName={http://MTOMService/}getAttachment
> Output: name=getAttachmentResponse
> Message: name={http://MTOMService/}getAttachmentResponse
> Part: name=parameters
> elementName={http://MTOMService/}getAttachmentResponse
> Binding: name={http://MTOMService/}MTOMServiceSoapBinding
> PortType: name={http://MTOMService/}MTOMInter
> Operation: name=getAttachment
> style=REQUEST_RESPONSE,1
> Input: name=getAttachment
> Message: name={http://MTOMService/}getAttachment
> Part: name=parameters
> elementName={http://MTOMService/}getAttachment
> Output: name=getAttachmentResponse
> Message: name={http://MTOMService/}getAttachmentResponse
> Part: name=parameters
> elementName={http://MTOMService/}getAttachmentResponse
> BindingOperation: name=getAttachment
> BindingInput: name=getAttachment
> SOAPBody ({http://schemas.xmlsoap.org/wsdl/soap/}body):
> required=null
> use=literal
> BindingOutput: name=getAttachmentResponse
> SOAPBody ({http://schemas.xmlsoap.org/wsdl/soap/}body):
> required=null
> use=literal
> SOAPOperation ({http://schemas.xmlsoap.org/wsdl/soap/}operation):
> required=null
> soapActionURI=
> style=document
> SOAPBinding ({http://schemas.xmlsoap.org/wsdl/soap/}binding):
> required=null
> transportURI=http://schemas.xmlsoap.org/soap/http
> style=document
> Service: name={http://MTOMService/}MTOMService
> Port: name=MTOMServicePort
> Binding: name={http://MTOMService/}MTOMServiceSoapBinding
> PortType: name={http://MTOMService/}MTOMInter
> Operation: name=getAttachment
> style=REQUEST_RESPONSE,1
> Input: name=getAttachment
> Message: name={http://MTOMService/}getAttachment
> Part: name=parameters
> elementName={http://MTOMService/}getAttachment
> Output: name=getAttachmentResponse
> Message: name={http://MTOMService/}getAttachmentResponse
> Part: name=parameters
> elementName={http://MTOMService/}getAttachmentResponse
> BindingOperation: name=getAttachment
> BindingInput: name=getAttachment
> SOAPBody ({http://schemas.xmlsoap.org/wsdl/soap/}body):
> required=null
> use=literal
> BindingOutput: name=getAttachmentResponse
> SOAPBody ({http://schemas.xmlsoap.org/wsdl/soap/}body):
> required=null
> use=literal
> SOAPOperation ({http://schemas.xmlsoap.org/wsdl/soap/}operation):
> required=null
> soapActionURI=
> style=document
> SOAPBinding ({http://schemas.xmlsoap.org/wsdl/soap/}binding):
> required=null
> transportURI=http://schemas.xmlsoap.org/soap/http
> style=document
> SOAPAddress ({http://schemas.xmlsoap.org/wsdl/soap/}address):
> required=null
> locationURI=http://localhost:8010/MTOMTest/MTOMService
> UnknownExtensibilityElement ({http://www.w3.org/ns/ws-policy}Policy):
> required=null
> element=[wsp:Policy: null]
> //The WSDL defination for http://localhost:8010/MTOMTest/MTOMService?wsdl still exists after removing.
> --WSDLManagerImpl--map after----------->:{http://localhost:8010/MTOMTest/MTOMService?wsdl=Definition: name={http://MTOMService/}MTOMService targetNamespace=http://MTOMService/
> Types:
> SchemaExtensibilityElement ({http://www.w3.org/2001/XMLSchema}schema):
> required=null
> element=[xs:schema: null]
> Message: name={http://MTOMService/}getAttachment
> Part: name=parameters
> elementName={http://MTOMService/}getAttachment
> Message: name={http://MTOMService/}getAttachmentResponse
> Part: name=parameters
> elementName={http://MTOMService/}getAttachmentResponse
> PortType: name={http://MTOMService/}MTOMInter
> Operation: name=getAttachment
> style=REQUEST_RESPONSE,1
> Input: name=getAttachment
> Message: name={http://MTOMService/}getAttachment
> Part: name=parameters
> elementName={http://MTOMService/}getAttachment
> Output: name=getAttachmentResponse
> Message: name={http://MTOMService/}getAttachmentResponse
> Part: name=parameters
> elementName={http://MTOMService/}getAttachmentResponse
> Binding: name={http://MTOMService/}MTOMServiceSoapBinding
> PortType: name={http://MTOMService/}MTOMInter
> Operation: name=getAttachment
> style=REQUEST_RESPONSE,1
> Input: name=getAttachment
> Message: name={http://MTOMService/}getAttachment
> Part: name=parameters
> elementName={http://MTOMService/}getAttachment
> Output: name=getAttachmentResponse
> Message: name={http://MTOMService/}getAttachmentResponse
> Part: name=parameters
> elementName={http://MTOMService/}getAttachmentResponse
> BindingOperation: name=getAttachment
> BindingInput: name=getAttachment
> SOAPBody ({http://schemas.xmlsoap.org/wsdl/soap/}body):
> required=null
> use=literal
> BindingOutput: name=getAttachmentResponse
> SOAPBody ({http://schemas.xmlsoap.org/wsdl/soap/}body):
> required=null
> use=literal
> SOAPOperation ({http://schemas.xmlsoap.org/wsdl/soap/}operation):
> required=null
> soapActionURI=
> style=document
> SOAPBinding ({http://schemas.xmlsoap.org/wsdl/soap/}binding):
> required=null
> transportURI=http://schemas.xmlsoap.org/soap/http
> style=document
> Service: name={http://MTOMService/}MTOMService
> Port: name=MTOMServicePort
> Binding: name={http://MTOMService/}MTOMServiceSoapBinding
> PortType: name={http://MTOMService/}MTOMInter
> Operation: name=getAttachment
> style=REQUEST_RESPONSE,1
> Input: name=getAttachment
> Message: name={http://MTOMService/}getAttachment
> Part: name=parameters
> elementName={http://MTOMService/}getAttachment
> Output: name=getAttachmentResponse
> Message: name={http://MTOMService/}getAttachmentResponse
> Part: name=parameters
> elementName={http://MTOMService/}getAttachmentResponse
> BindingOperation: name=getAttachment
> BindingInput: name=getAttachment
> SOAPBody ({http://schemas.xmlsoap.org/wsdl/soap/}body):
> required=null
> use=literal
> BindingOutput: name=getAttachmentResponse
> SOAPBody ({http://schemas.xmlsoap.org/wsdl/soap/}body):
> required=null
> use=literal
> SOAPOperation ({http://schemas.xmlsoap.org/wsdl/soap/}operation):
> required=null
> soapActionURI=
> style=document
> SOAPBinding ({http://schemas.xmlsoap.org/wsdl/soap/}binding):
> required=null
> transportURI=http://schemas.xmlsoap.org/soap/http
> style=document
> SOAPAddress ({http://schemas.xmlsoap.org/wsdl/soap/}address):
> required=null
> locationURI=http://localhost:8010/MTOMTest/MTOMService
> UnknownExtensibilityElement ({http://www.w3.org/ns/ws-policy}Policy):
> required=null
> element=[wsp:Policy: null]}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)