[ 
https://issues.apache.org/jira/browse/CXF-5407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Kulp resolved CXF-5407.
------------------------------
       Resolution: Fixed
         Assignee: Daniel Kulp
    Fix Version/s: 3.1.12
                   3.2.0

> WSDLManagerImpl.removeDefinition doesn't take effect
> ----------------------------------------------------
>
>                 Key: CXF-5407
>                 URL: https://issues.apache.org/jira/browse/CXF-5407
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.6.2
>            Reporter: Bin Zhu
>            Assignee: Daniel Kulp
>             Fix For: 3.2.0, 3.1.12
>
>
> 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.15#6346)

Reply via email to