You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Garry Watkins (JIRA)" <ji...@apache.org> on 2007/09/18 14:28:43 UTC

[jira] Created: (CXF-1032) @WebMethod (exclude = true) are not being excluded

@WebMethod (exclude = true)  are not being excluded
---------------------------------------------------

                 Key: CXF-1032
                 URL: https://issues.apache.org/jira/browse/CXF-1032
             Project: CXF
          Issue Type: Bug
          Components: JAXB Databinding
    Affects Versions: 2.0.1
         Environment: Mac OS/X JDK 1.5
            Reporter: Garry Watkins


Methods with @WebMethod(exclude = true) are still being included when bringing in classes that will have WSDL generated.  I have tracked down the issue to the org.apache.cxf.jaxb.JAXBContextInitializer class.

I have included the replacement method here 

    private void walkReferences(Class<?> cls) {
        if (cls.getName().startsWith("java.")
            || cls.getName().startsWith("javax.")) {
            return;
        }
        //walk the public fields/methods to try and find all the classes.  JAXB will only load the 
        //EXACT classes in the fields/methods if they are in a different package.   Thus,
        //subclasses won't be found and the xsi:type stuff won't work at all.
        //We'll grab the public field/method types and then add the ObjectFactory stuff 
        //as well as look for jaxb.index files in those packages.
        
        Field fields[] = cls.getFields();
        for (Field f : fields) {
            addType(f.getGenericType());
        }
        Method methods[] = cls.getMethods();
        for (Method m : methods) {  
                // START The following  lines were added by GW
        	WebMethod wm = m.getAnnotation(WebMethod.class);  
        	if (null != wm){
        		if (wm.exclude()){
        			System.out.println("Skipping method " + m.toString());
        			continue;
        		}
        	}
                //END GW
            addType(m.getGenericReturnType());
            for (Type t : m.getGenericParameterTypes()) {
                addType(t);
            }
        }
    }



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CXF-1032) @WebMethod (exclude = true) are not being excluded

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1032?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp reassigned CXF-1032:
--------------------------------

    Assignee: Daniel Kulp

> @WebMethod (exclude = true)  are not being excluded
> ---------------------------------------------------
>
>                 Key: CXF-1032
>                 URL: https://issues.apache.org/jira/browse/CXF-1032
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 2.0.1
>         Environment: Mac OS/X JDK 1.5
>            Reporter: Garry Watkins
>            Assignee: Daniel Kulp
>
> Methods with @WebMethod(exclude = true) are still being included when bringing in classes that will have WSDL generated.  I have tracked down the issue to the org.apache.cxf.jaxb.JAXBContextInitializer class.
> I have included the replacement method here 
>     private void walkReferences(Class<?> cls) {
>         if (cls.getName().startsWith("java.")
>             || cls.getName().startsWith("javax.")) {
>             return;
>         }
>         //walk the public fields/methods to try and find all the classes.  JAXB will only load the 
>         //EXACT classes in the fields/methods if they are in a different package.   Thus,
>         //subclasses won't be found and the xsi:type stuff won't work at all.
>         //We'll grab the public field/method types and then add the ObjectFactory stuff 
>         //as well as look for jaxb.index files in those packages.
>         
>         Field fields[] = cls.getFields();
>         for (Field f : fields) {
>             addType(f.getGenericType());
>         }
>         Method methods[] = cls.getMethods();
>         for (Method m : methods) {  
>                 // START The following  lines were added by GW
>         	WebMethod wm = m.getAnnotation(WebMethod.class);  
>         	if (null != wm){
>         		if (wm.exclude()){
>         			System.out.println("Skipping method " + m.toString());
>         			continue;
>         		}
>         	}
>                 //END GW
>             addType(m.getGenericReturnType());
>             for (Type t : m.getGenericParameterTypes()) {
>                 addType(t);
>             }
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1032) @WebMethod (exclude = true) are not being excluded

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1032?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12528450 ] 

Daniel Kulp commented on CXF-1032:
----------------------------------


I think I'd have to see a testcase for this.   The @WebMethod stuff is for the JAX-WS SEI interface which should have no bearing on JAXB types.    To ignore stuff in JAXB, it would be an @XmlTransient (which admittedly being ignored here).



> @WebMethod (exclude = true)  are not being excluded
> ---------------------------------------------------
>
>                 Key: CXF-1032
>                 URL: https://issues.apache.org/jira/browse/CXF-1032
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 2.0.1
>         Environment: Mac OS/X JDK 1.5
>            Reporter: Garry Watkins
>
> Methods with @WebMethod(exclude = true) are still being included when bringing in classes that will have WSDL generated.  I have tracked down the issue to the org.apache.cxf.jaxb.JAXBContextInitializer class.
> I have included the replacement method here 
>     private void walkReferences(Class<?> cls) {
>         if (cls.getName().startsWith("java.")
>             || cls.getName().startsWith("javax.")) {
>             return;
>         }
>         //walk the public fields/methods to try and find all the classes.  JAXB will only load the 
>         //EXACT classes in the fields/methods if they are in a different package.   Thus,
>         //subclasses won't be found and the xsi:type stuff won't work at all.
>         //We'll grab the public field/method types and then add the ObjectFactory stuff 
>         //as well as look for jaxb.index files in those packages.
>         
>         Field fields[] = cls.getFields();
>         for (Field f : fields) {
>             addType(f.getGenericType());
>         }
>         Method methods[] = cls.getMethods();
>         for (Method m : methods) {  
>                 // START The following  lines were added by GW
>         	WebMethod wm = m.getAnnotation(WebMethod.class);  
>         	if (null != wm){
>         		if (wm.exclude()){
>         			System.out.println("Skipping method " + m.toString());
>         			continue;
>         		}
>         	}
>                 //END GW
>             addType(m.getGenericReturnType());
>             for (Type t : m.getGenericParameterTypes()) {
>                 addType(t);
>             }
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-1032) @WebMethod (exclude = true) are not being excluded

Posted by "Garry Watkins (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1032?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Garry Watkins updated CXF-1032:
-------------------------------


Sorry, I am not an expert with all of the annotations.  XmlTransient should work per spec, however, when I change the above code it gives me the following:  JAXB annotation is placed on a method that is not a JAXB property this problem is related to the following location:  at @javax.xml.bind.annotation.XmlTransient() ...  So is that a bug in other parts of the code?


> @WebMethod (exclude = true)  are not being excluded
> ---------------------------------------------------
>
>                 Key: CXF-1032
>                 URL: https://issues.apache.org/jira/browse/CXF-1032
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 2.0.1
>         Environment: Mac OS/X JDK 1.5
>            Reporter: Garry Watkins
>
> Methods with @WebMethod(exclude = true) are still being included when bringing in classes that will have WSDL generated.  I have tracked down the issue to the org.apache.cxf.jaxb.JAXBContextInitializer class.
> I have included the replacement method here 
>     private void walkReferences(Class<?> cls) {
>         if (cls.getName().startsWith("java.")
>             || cls.getName().startsWith("javax.")) {
>             return;
>         }
>         //walk the public fields/methods to try and find all the classes.  JAXB will only load the 
>         //EXACT classes in the fields/methods if they are in a different package.   Thus,
>         //subclasses won't be found and the xsi:type stuff won't work at all.
>         //We'll grab the public field/method types and then add the ObjectFactory stuff 
>         //as well as look for jaxb.index files in those packages.
>         
>         Field fields[] = cls.getFields();
>         for (Field f : fields) {
>             addType(f.getGenericType());
>         }
>         Method methods[] = cls.getMethods();
>         for (Method m : methods) {  
>                 // START The following  lines were added by GW
>         	WebMethod wm = m.getAnnotation(WebMethod.class);  
>         	if (null != wm){
>         		if (wm.exclude()){
>         			System.out.println("Skipping method " + m.toString());
>         			continue;
>         		}
>         	}
>                 //END GW
>             addType(m.getGenericReturnType());
>             for (Type t : m.getGenericParameterTypes()) {
>                 addType(t);
>             }
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-1032) @WebMethod (exclude = true) are not being excluded

Posted by "Garry Watkins (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1032?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Garry Watkins updated CXF-1032:
-------------------------------


Here is the rest of the stack trace.  It looks like it is in the sun code.  It did not give me this error when I used @WebMethod(exclude = true).

        at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:66)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:389)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:236)
        at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
        at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:366)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
        at org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContext(JAXBDataBinding.java:348)
        at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:177)

> @WebMethod (exclude = true)  are not being excluded
> ---------------------------------------------------
>
>                 Key: CXF-1032
>                 URL: https://issues.apache.org/jira/browse/CXF-1032
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 2.0.1
>         Environment: Mac OS/X JDK 1.5
>            Reporter: Garry Watkins
>
> Methods with @WebMethod(exclude = true) are still being included when bringing in classes that will have WSDL generated.  I have tracked down the issue to the org.apache.cxf.jaxb.JAXBContextInitializer class.
> I have included the replacement method here 
>     private void walkReferences(Class<?> cls) {
>         if (cls.getName().startsWith("java.")
>             || cls.getName().startsWith("javax.")) {
>             return;
>         }
>         //walk the public fields/methods to try and find all the classes.  JAXB will only load the 
>         //EXACT classes in the fields/methods if they are in a different package.   Thus,
>         //subclasses won't be found and the xsi:type stuff won't work at all.
>         //We'll grab the public field/method types and then add the ObjectFactory stuff 
>         //as well as look for jaxb.index files in those packages.
>         
>         Field fields[] = cls.getFields();
>         for (Field f : fields) {
>             addType(f.getGenericType());
>         }
>         Method methods[] = cls.getMethods();
>         for (Method m : methods) {  
>                 // START The following  lines were added by GW
>         	WebMethod wm = m.getAnnotation(WebMethod.class);  
>         	if (null != wm){
>         		if (wm.exclude()){
>         			System.out.println("Skipping method " + m.toString());
>         			continue;
>         		}
>         	}
>                 //END GW
>             addType(m.getGenericReturnType());
>             for (Type t : m.getGenericParameterTypes()) {
>                 addType(t);
>             }
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-1032) @WebMethod (exclude = true) are not being excluded

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1032?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-1032.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.3


This should now be resolved as part of CXF-1121

> @WebMethod (exclude = true)  are not being excluded
> ---------------------------------------------------
>
>                 Key: CXF-1032
>                 URL: https://issues.apache.org/jira/browse/CXF-1032
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 2.0.1
>         Environment: Mac OS/X JDK 1.5
>            Reporter: Garry Watkins
>            Assignee: Daniel Kulp
>             Fix For: 2.0.3
>
>
> Methods with @WebMethod(exclude = true) are still being included when bringing in classes that will have WSDL generated.  I have tracked down the issue to the org.apache.cxf.jaxb.JAXBContextInitializer class.
> I have included the replacement method here 
>     private void walkReferences(Class<?> cls) {
>         if (cls.getName().startsWith("java.")
>             || cls.getName().startsWith("javax.")) {
>             return;
>         }
>         //walk the public fields/methods to try and find all the classes.  JAXB will only load the 
>         //EXACT classes in the fields/methods if they are in a different package.   Thus,
>         //subclasses won't be found and the xsi:type stuff won't work at all.
>         //We'll grab the public field/method types and then add the ObjectFactory stuff 
>         //as well as look for jaxb.index files in those packages.
>         
>         Field fields[] = cls.getFields();
>         for (Field f : fields) {
>             addType(f.getGenericType());
>         }
>         Method methods[] = cls.getMethods();
>         for (Method m : methods) {  
>                 // START The following  lines were added by GW
>         	WebMethod wm = m.getAnnotation(WebMethod.class);  
>         	if (null != wm){
>         		if (wm.exclude()){
>         			System.out.println("Skipping method " + m.toString());
>         			continue;
>         		}
>         	}
>                 //END GW
>             addType(m.getGenericReturnType());
>             for (Type t : m.getGenericParameterTypes()) {
>                 addType(t);
>             }
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.