You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Julio Arias <ju...@rbxglobal.com> on 2007/07/13 01:07:31 UTC

Exposing methods

The dependencies setters from my service impl are getting expose in  
the WSDL even though I'm specifying the endpoint interface in the  
implementor. How can I hide this methods?

I have the following code and config:

+ UserWebService.java

@WebService(name = "UserService")
public interface UserWebService {
	@WebMethod
	User getUserById(@WebParam(name = "id") Long id);
}

+ UserWebServiceImpl.java

@WebService(endpointInterface =  
"com.rbx.test.webservices.UserWebService", name = "UserService")
public class UserWebServiceImpl implements UserWebService {

	private UserManager userManager;

	public void setUserManager(UserManager userManager) {
		this.userManager = userManager;
	}
		
	public User getUserById(Long id) {
		return userManager.getUser(id);
	}
}

+ Endpoint config:

<jaxws:endpoint id="userService" address="/UserService">
	<jaxws:implementor>
		<bean class="com.rbx.test.webservices.UserWebServiceImpl">
			<property name="userManager" ref="userManager"/>
		</bean>
	</jaxws:implementor>		
</jaxws:endpoint>




Julio Arias
Java Developer
Roundbox Global : enterprise : technology : genius
---------------------------------------------------------------------
Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
email: julio.arias@rbxglobal.com | www.rbxglobal.com
---------------------------------------------------------------------


Re: Exposing methods

Posted by Dan Diephouse <da...@envoisolutions.com>.
I went ahead and created a JIRA issue for this:

https://issues.apache.org/jira/browse/CXF-789

- Dan

On 7/13/07, Liu, Jervis <jl...@iona.com> wrote:
>
> Hi, I actually believe this is a bug in CXF. What happened in CXF is that
> we first reflect impl class, all methods defined in impl class become
> potential candidates for publishing. Then we check interface, if the method
> under consideration does not exist in the interface, we will fall back to
> the impl class to do a further check . This is wrong. According to the spec,
> if the interface is found, we should not look for any information from impl
> class:  " if the WebService annotation on the class under consideration has
> an endpointInterface element, then the interface referredby this element is
> for all purposes the SEI associated with the class."
>
> Cheers,
> Jervis
>
>
> -----Original Message-----
> From: Willem Jiang [mailto:ning.jiang@iona.com]
> Sent: 2007?7?13? 14:14
> To: cxf-user@incubator.apache.org
> Subject: Re: Exposing methods
>
>
> Hi,
>
> I just dug the code,  here is the code in the JaxWsServiceConfiguration
> to tell which method is the WebMethod.
>
> @Override
>     public Boolean isOperation(Method method) {
>         Method origMethod = method;
>         method = getDeclaredMethod(method);
>         if (method.getReturnType().equals(Future.class)
>             || method.getReturnType().equals(Response.class)) {
>             return false;
>         }
>
>         if (method != null) {
>             WebMethod wm = method.getAnnotation(WebMethod.class);
>             if (wm != null) {
>                 if (wm.exclude()) {
>                     return Boolean.FALSE;
>                 } else {
>                     return Boolean.TRUE;
>                 }
>             } else {
>                 if (method.getDeclaringClass().isInterface()) {
>                     return hasWebServiceAnnotation(method)
>                         ||  hasWebServiceAnnotation(origMethod);
>                 }
>                 return hasWebServiceAnnotation(method);
>             }
>         }
>         return Boolean.FALSE;
>     }
>
>     private boolean hasWebServiceAnnotation(Method method) {
>         return
> method.getDeclaringClass().getAnnotation(WebService.class) != null;
>     }
>
> And there are some descriptions of the WebMethod definition can explain
> the code.
> JAX-WS 2.0 specification (Final Release April 19, 2006)
> Chapter 3 "Java to WSDL 1.1 Mapping" P30.
>
> " In order to allow for a separation between Web service interface and
> implementation, if the WebService
> annotation on the class under consideration has a endpointInterface
> element, then the interface referred
> by this element is for all purposes the SEI associated with the class.
>
> Otherwise, the class implicitly defines a service endpoint interface
> (SEI) which comprises all of the public
> methods that satisfy one of the following conditions:
> 1. They are annotated with the javax.jws.WebMethod annotation with the
> exclude element set to
> false or missing (since false is the default for this annotation element).
> 2. They are not annotated with the javax.jws.WebMethod annotation but
> their declaring class has a
> javax.jws.WebService annotation.
>
> For mapping purposes, this implicit SEI and its methods are considered
> to be annotated with the same Web
> service-related annotations that the original class and its methods have.
> *In pratice*, in order to exclude a public method of a class annotated
> with WebService and not directly
> specifying a endpointInterface from the implicitly defined SEI, it is
> necessary to annotate the method
> with a WebMethod annotation with the exclude element set to true."
>
> And Jim's suggestion is right , you just need to  add the @WebMethod
> (exclude=true)  annotation to the method that you do not want to export
> as a WebMethod.
>
>
> Cheers,
>
> Willem.
>
>
> Jim Ma wrote:
> > Yes . It's the normal behavior. The runtime will reflect every method
> > in impl class and expose it unless the
> > method is annotated with exclude WebMethod .
> > CXF also can support publishing a service with a pojo class without
> > implementing any interface :
> >
> > @WebService
> > public class UserWebServiceImpl {
> >
> >    private UserManager userManager;
> >   @WebMethod (exclude=true)
> >    public void setUserManager(UserManager userManager) {
> >        this.userManager = userManager;
> >    }
> >   @WebMethod
> >    public User getUserById(Long id) {
> >        return userManager.getUser(id);
> >    }
> > }
> >
> > Cheers
> >
> > Jim
> >
> > Julio Arias wrote:
> >> Hi Jim,
> >>
> >> Thanks I found that property for the @WebMethod annotation too and it
> >> works fine. But is this a normal behavior to expose everything in the
> >> implementor, I thought it would only expose the methods on my
> interface.
> >>
> >> On Jul 12, 2007, at 9:05 PM, Jim Ma wrote:
> >>
> >>> Hi Julio,
> >>>
> >>> I think you can add @WebMethod(exclude=true)  for the setter method.
> >>>
> >>>    @WebMethod (exclude=true)
> >>>     setUserManager(UserManager userManager)
> >>>
> >>> Cheers
> >>>
> >>> Jim
> >>>
> >>>
> >>> Julio Arias wrote:
> >>>> The dependencies setters from my service impl are getting expose in
> >>>> the WSDL even though I'm specifying the endpoint interface in the
> >>>> implementor. How can I hide this methods?
> >>>>
> >>>> I have the following code and config:
> >>>>
> >>>> + UserWebService.java
> >>>>
> >>>> @WebService(name = "UserService")
> >>>> public interface UserWebService {
> >>>>     @WebMethod
> >>>>     User getUserById(@WebParam(name = "id") Long id);
> >>>> }
> >>>>
> >>>> + UserWebServiceImpl.java
> >>>>
> >>>> @WebService(endpointInterface =
> >>>> "com.rbx.test.webservices.UserWebService", name = "UserService")
> >>>> public class UserWebServiceImpl implements UserWebService {
> >>>>
> >>>>     private UserManager userManager;
> >>>>
> >>>>     public void setUserManager(UserManager userManager) {
> >>>>         this.userManager = userManager;
> >>>>     }
> >>>>            public User getUserById(Long id) {
> >>>>         return userManager.getUser(id);
> >>>>     }
> >>>> }
> >>>>
> >>>> + Endpoint config:
> >>>>
> >>>> <jaxws:endpoint id="userService" address="/UserService">
> >>>>     <jaxws:implementor>
> >>>>         <bean class="com.rbx.test.webservices.UserWebServiceImpl">
> >>>>             <property name="userManager" ref="userManager"/>
> >>>>         </bean>
> >>>>     </jaxws:implementor>       </jaxws:endpoint>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> Julio Arias
> >>>> Java Developer
> >>>> Roundbox Global : enterprise : technology : genius
> >>>> ---------------------------------------------------------------------
> >>>> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
> >>>> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
> >>>> email: julio.arias@rbxglobal.com | www.rbxglobal.com
> >>>> ---------------------------------------------------------------------
> >>>>
> >>>>
> >>
> >>
> >>
> >>
> >> Julio Arias
> >> Java Developer
> >> Roundbox Global : enterprise : technology : genius
> >> ---------------------------------------------------------------------
> >> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
> >> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
> >> email: julio.arias@rbxglobal.com | www.rbxglobal.com
> >> ---------------------------------------------------------------------
> >>
> >>
> >
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
>



-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

RE: Exposing methods

Posted by "Liu, Jervis" <jl...@iona.com>.
Hi, I actually believe this is a bug in CXF. What happened in CXF is that we first reflect impl class, all methods defined in impl class become potential candidates for publishing. Then we check interface, if the method under consideration does not exist in the interface, we will fall back to the impl class to do a further check . This is wrong. According to the spec, if the interface is found, we should not look for any information from impl class:  " if the WebService annotation on the class under consideration has an endpointInterface element, then the interface referredby this element is for all purposes the SEI associated with the class."

Cheers,
Jervis


-----Original Message-----
From: Willem Jiang [mailto:ning.jiang@iona.com]
Sent: 2007?7?13? 14:14
To: cxf-user@incubator.apache.org
Subject: Re: Exposing methods


Hi,

I just dug the code,  here is the code in the JaxWsServiceConfiguration 
to tell which method is the WebMethod.

@Override
    public Boolean isOperation(Method method) {
        Method origMethod = method;
        method = getDeclaredMethod(method);
        if (method.getReturnType().equals(Future.class)
            || method.getReturnType().equals(Response.class)) {
            return false;
        }
       
        if (method != null) {
            WebMethod wm = method.getAnnotation(WebMethod.class);
            if (wm != null) {
                if (wm.exclude()) {
                    return Boolean.FALSE;
                } else {
                    return Boolean.TRUE;
                }
            } else {
                if (method.getDeclaringClass().isInterface()) {
                    return hasWebServiceAnnotation(method)
                        ||  hasWebServiceAnnotation(origMethod);
                }
                return hasWebServiceAnnotation(method);             
            }
        }
        return Boolean.FALSE;
    }
   
    private boolean hasWebServiceAnnotation(Method method) {
        return 
method.getDeclaringClass().getAnnotation(WebService.class) != null;
    }

And there are some descriptions of the WebMethod definition can explain 
the code.
JAX-WS 2.0 specification (Final Release April 19, 2006)
Chapter 3 "Java to WSDL 1.1 Mapping" P30.

" In order to allow for a separation between Web service interface and 
implementation, if the WebService
annotation on the class under consideration has a endpointInterface 
element, then the interface referred
by this element is for all purposes the SEI associated with the class.

Otherwise, the class implicitly defines a service endpoint interface 
(SEI) which comprises all of the public
methods that satisfy one of the following conditions:
1. They are annotated with the javax.jws.WebMethod annotation with the 
exclude element set to
false or missing (since false is the default for this annotation element).
2. They are not annotated with the javax.jws.WebMethod annotation but 
their declaring class has a
javax.jws.WebService annotation.

For mapping purposes, this implicit SEI and its methods are considered 
to be annotated with the same Web
service-related annotations that the original class and its methods have.
*In pratice*, in order to exclude a public method of a class annotated 
with WebService and not directly
specifying a endpointInterface from the implicitly defined SEI, it is 
necessary to annotate the method
with a WebMethod annotation with the exclude element set to true."

And Jim's suggestion is right , you just need to  add the @WebMethod 
(exclude=true)  annotation to the method that you do not want to export 
as a WebMethod.


Cheers,

Willem.


Jim Ma wrote:
> Yes . It's the normal behavior. The runtime will reflect every method 
> in impl class and expose it unless the
> method is annotated with exclude WebMethod .
> CXF also can support publishing a service with a pojo class without 
> implementing any interface :
>
> @WebService
> public class UserWebServiceImpl {
>
>    private UserManager userManager;
>   @WebMethod (exclude=true)
>    public void setUserManager(UserManager userManager) {
>        this.userManager = userManager;
>    }
>   @WebMethod
>    public User getUserById(Long id) {
>        return userManager.getUser(id);
>    }
> }
>
> Cheers
>
> Jim
>
> Julio Arias wrote:
>> Hi Jim,
>>
>> Thanks I found that property for the @WebMethod annotation too and it 
>> works fine. But is this a normal behavior to expose everything in the 
>> implementor, I thought it would only expose the methods on my interface.
>>
>> On Jul 12, 2007, at 9:05 PM, Jim Ma wrote:
>>
>>> Hi Julio,
>>>
>>> I think you can add @WebMethod(exclude=true)  for the setter method.
>>>
>>>    @WebMethod (exclude=true)
>>>     setUserManager(UserManager userManager)
>>>
>>> Cheers
>>>
>>> Jim
>>>
>>>
>>> Julio Arias wrote:
>>>> The dependencies setters from my service impl are getting expose in 
>>>> the WSDL even though I'm specifying the endpoint interface in the 
>>>> implementor. How can I hide this methods?
>>>>
>>>> I have the following code and config:
>>>>
>>>> + UserWebService.java
>>>>
>>>> @WebService(name = "UserService")
>>>> public interface UserWebService {
>>>>     @WebMethod
>>>>     User getUserById(@WebParam(name = "id") Long id);
>>>> }
>>>>
>>>> + UserWebServiceImpl.java
>>>>
>>>> @WebService(endpointInterface = 
>>>> "com.rbx.test.webservices.UserWebService", name = "UserService")
>>>> public class UserWebServiceImpl implements UserWebService {
>>>>
>>>>     private UserManager userManager;
>>>>
>>>>     public void setUserManager(UserManager userManager) {
>>>>         this.userManager = userManager;
>>>>     }
>>>>            public User getUserById(Long id) {
>>>>         return userManager.getUser(id);
>>>>     }
>>>> }
>>>>
>>>> + Endpoint config:
>>>>
>>>> <jaxws:endpoint id="userService" address="/UserService">
>>>>     <jaxws:implementor>
>>>>         <bean class="com.rbx.test.webservices.UserWebServiceImpl">
>>>>             <property name="userManager" ref="userManager"/>
>>>>         </bean>
>>>>     </jaxws:implementor>       </jaxws:endpoint>
>>>>
>>>>
>>>>
>>>>
>>>> Julio Arias
>>>> Java Developer
>>>> Roundbox Global : enterprise : technology : genius
>>>> ---------------------------------------------------------------------
>>>> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
>>>> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
>>>> email: julio.arias@rbxglobal.com | www.rbxglobal.com
>>>> ---------------------------------------------------------------------
>>>>
>>>>
>>
>>
>>
>>
>> Julio Arias
>> Java Developer
>> Roundbox Global : enterprise : technology : genius
>> ---------------------------------------------------------------------
>> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
>> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
>> email: julio.arias@rbxglobal.com | www.rbxglobal.com
>> ---------------------------------------------------------------------
>>
>>
>

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Re: Exposing methods

Posted by Willem Jiang <ni...@iona.com>.
Hi,

I just dug the code,  here is the code in the JaxWsServiceConfiguration 
to tell which method is the WebMethod.

@Override
    public Boolean isOperation(Method method) {
        Method origMethod = method;
        method = getDeclaredMethod(method);
        if (method.getReturnType().equals(Future.class)
            || method.getReturnType().equals(Response.class)) {
            return false;
        }
       
        if (method != null) {
            WebMethod wm = method.getAnnotation(WebMethod.class);
            if (wm != null) {
                if (wm.exclude()) {
                    return Boolean.FALSE;
                } else {
                    return Boolean.TRUE;
                }
            } else {
                if (method.getDeclaringClass().isInterface()) {
                    return hasWebServiceAnnotation(method)
                        ||  hasWebServiceAnnotation(origMethod);
                }
                return hasWebServiceAnnotation(method);             
            }
        }
        return Boolean.FALSE;
    }
   
    private boolean hasWebServiceAnnotation(Method method) {
        return 
method.getDeclaringClass().getAnnotation(WebService.class) != null;
    }

And there are some descriptions of the WebMethod definition can explain 
the code.
JAX-WS 2.0 specification (Final Release April 19, 2006)
Chapter 3 "Java to WSDL 1.1 Mapping" P30.

" In order to allow for a separation between Web service interface and 
implementation, if the WebService
annotation on the class under consideration has a endpointInterface 
element, then the interface referred
by this element is for all purposes the SEI associated with the class.

Otherwise, the class implicitly defines a service endpoint interface 
(SEI) which comprises all of the public
methods that satisfy one of the following conditions:
1. They are annotated with the javax.jws.WebMethod annotation with the 
exclude element set to
false or missing (since false is the default for this annotation element).
2. They are not annotated with the javax.jws.WebMethod annotation but 
their declaring class has a
javax.jws.WebService annotation.

For mapping purposes, this implicit SEI and its methods are considered 
to be annotated with the same Web
service-related annotations that the original class and its methods have.
*In pratice*, in order to exclude a public method of a class annotated 
with WebService and not directly
specifying a endpointInterface from the implicitly defined SEI, it is 
necessary to annotate the method
with a WebMethod annotation with the exclude element set to true."

And Jim's suggestion is right , you just need to  add the @WebMethod 
(exclude=true)  annotation to the method that you do not want to export 
as a WebMethod.


Cheers,

Willem.


Jim Ma wrote:
> Yes . It's the normal behavior. The runtime will reflect every method 
> in impl class and expose it unless the
> method is annotated with exclude WebMethod .
> CXF also can support publishing a service with a pojo class without 
> implementing any interface :
>
> @WebService
> public class UserWebServiceImpl {
>
>    private UserManager userManager;
>   @WebMethod (exclude=true)
>    public void setUserManager(UserManager userManager) {
>        this.userManager = userManager;
>    }
>   @WebMethod
>    public User getUserById(Long id) {
>        return userManager.getUser(id);
>    }
> }
>
> Cheers
>
> Jim
>
> Julio Arias wrote:
>> Hi Jim,
>>
>> Thanks I found that property for the @WebMethod annotation too and it 
>> works fine. But is this a normal behavior to expose everything in the 
>> implementor, I thought it would only expose the methods on my interface.
>>
>> On Jul 12, 2007, at 9:05 PM, Jim Ma wrote:
>>
>>> Hi Julio,
>>>
>>> I think you can add @WebMethod(exclude=true)  for the setter method.
>>>
>>>    @WebMethod (exclude=true)
>>>     setUserManager(UserManager userManager)
>>>
>>> Cheers
>>>
>>> Jim
>>>
>>>
>>> Julio Arias wrote:
>>>> The dependencies setters from my service impl are getting expose in 
>>>> the WSDL even though I'm specifying the endpoint interface in the 
>>>> implementor. How can I hide this methods?
>>>>
>>>> I have the following code and config:
>>>>
>>>> + UserWebService.java
>>>>
>>>> @WebService(name = "UserService")
>>>> public interface UserWebService {
>>>>     @WebMethod
>>>>     User getUserById(@WebParam(name = "id") Long id);
>>>> }
>>>>
>>>> + UserWebServiceImpl.java
>>>>
>>>> @WebService(endpointInterface = 
>>>> "com.rbx.test.webservices.UserWebService", name = "UserService")
>>>> public class UserWebServiceImpl implements UserWebService {
>>>>
>>>>     private UserManager userManager;
>>>>
>>>>     public void setUserManager(UserManager userManager) {
>>>>         this.userManager = userManager;
>>>>     }
>>>>            public User getUserById(Long id) {
>>>>         return userManager.getUser(id);
>>>>     }
>>>> }
>>>>
>>>> + Endpoint config:
>>>>
>>>> <jaxws:endpoint id="userService" address="/UserService">
>>>>     <jaxws:implementor>
>>>>         <bean class="com.rbx.test.webservices.UserWebServiceImpl">
>>>>             <property name="userManager" ref="userManager"/>
>>>>         </bean>
>>>>     </jaxws:implementor>       </jaxws:endpoint>
>>>>
>>>>
>>>>
>>>>
>>>> Julio Arias
>>>> Java Developer
>>>> Roundbox Global : enterprise : technology : genius
>>>> ---------------------------------------------------------------------
>>>> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
>>>> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
>>>> email: julio.arias@rbxglobal.com | www.rbxglobal.com
>>>> ---------------------------------------------------------------------
>>>>
>>>>
>>
>>
>>
>>
>> Julio Arias
>> Java Developer
>> Roundbox Global : enterprise : technology : genius
>> ---------------------------------------------------------------------
>> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
>> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
>> email: julio.arias@rbxglobal.com | www.rbxglobal.com
>> ---------------------------------------------------------------------
>>
>>
>

Re: Exposing methods

Posted by Jim Ma <em...@iona.com>.
Yes . It's the normal behavior. The runtime will reflect every method in 
impl class and expose it unless the
method is annotated with exclude WebMethod .
CXF also can support publishing a service with a pojo class without 
implementing any interface :

@WebService
public class UserWebServiceImpl {

    private UserManager userManager;
   @WebMethod (exclude=true)
    public void setUserManager(UserManager userManager) {
        this.userManager = userManager;
    }
   @WebMethod
    public User getUserById(Long id) {
        return userManager.getUser(id);
    }
}

Cheers

Jim

Julio Arias wrote:
> Hi Jim,
>
> Thanks I found that property for the @WebMethod annotation too and it 
> works fine. But is this a normal behavior to expose everything in the 
> implementor, I thought it would only expose the methods on my interface.
>
> On Jul 12, 2007, at 9:05 PM, Jim Ma wrote:
>
>> Hi Julio,
>>
>> I think you can add @WebMethod(exclude=true)  for the setter method.
>>
>>    @WebMethod (exclude=true)
>>     setUserManager(UserManager userManager)
>>
>> Cheers
>>
>> Jim
>>
>>
>> Julio Arias wrote:
>>> The dependencies setters from my service impl are getting expose in 
>>> the WSDL even though I'm specifying the endpoint interface in the 
>>> implementor. How can I hide this methods?
>>>
>>> I have the following code and config:
>>>
>>> + UserWebService.java
>>>
>>> @WebService(name = "UserService")
>>> public interface UserWebService {
>>>     @WebMethod
>>>     User getUserById(@WebParam(name = "id") Long id);
>>> }
>>>
>>> + UserWebServiceImpl.java
>>>
>>> @WebService(endpointInterface = 
>>> "com.rbx.test.webservices.UserWebService", name = "UserService")
>>> public class UserWebServiceImpl implements UserWebService {
>>>
>>>     private UserManager userManager;
>>>
>>>     public void setUserManager(UserManager userManager) {
>>>         this.userManager = userManager;
>>>     }
>>>            public User getUserById(Long id) {
>>>         return userManager.getUser(id);
>>>     }
>>> }
>>>
>>> + Endpoint config:
>>>
>>> <jaxws:endpoint id="userService" address="/UserService">
>>>     <jaxws:implementor>
>>>         <bean class="com.rbx.test.webservices.UserWebServiceImpl">
>>>             <property name="userManager" ref="userManager"/>
>>>         </bean>
>>>     </jaxws:implementor>       </jaxws:endpoint>
>>>
>>>
>>>
>>>
>>> Julio Arias
>>> Java Developer
>>> Roundbox Global : enterprise : technology : genius
>>> ---------------------------------------------------------------------
>>> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
>>> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
>>> email: julio.arias@rbxglobal.com | www.rbxglobal.com
>>> ---------------------------------------------------------------------
>>>
>>>
>
>
>
>
> Julio Arias
> Java Developer
> Roundbox Global : enterprise : technology : genius
> ---------------------------------------------------------------------
> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
> email: julio.arias@rbxglobal.com | www.rbxglobal.com
> ---------------------------------------------------------------------
>
>

RE: Exposing methods

Posted by "Liu, Jervis" <jl...@iona.com>.
Hi Julio, if exclude=true did work, this proved that your endpointInterface class didnt get loaded by CXF. The logic behind the scene is that CXF will try to load endpointInterface class using @WebService(endpointInterface ="") annotation, if it successfully gets the interface loaded, only methods defined in the interface marked with @WebMethod get published into WSDL. If CXF can not load endpointInterface class, all methods in the impl class will be published into WSDL unless there is an "exclude".

Cheers,
Jervis

-----Original Message-----
From: Julio Arias [mailto:julio.arias@rbxglobal.com]
Sent: 2007?7?13? 11:41
To: cxf-user@incubator.apache.org
Subject: Re: Exposing methods


Hi Jim,

Thanks I found that property for the @WebMethod annotation too and it  
works fine. But is this a normal behavior to expose everything in the  
implementor, I thought it would only expose the methods on my interface.

On Jul 12, 2007, at 9:05 PM, Jim Ma wrote:

> Hi Julio,
>
> I think you can add @WebMethod(exclude=true)  for the setter method.
>
>    @WebMethod (exclude=true)
>     setUserManager(UserManager userManager)
>
> Cheers
>
> Jim
>
>
> Julio Arias wrote:
>> The dependencies setters from my service impl are getting expose  
>> in the WSDL even though I'm specifying the endpoint interface in  
>> the implementor. How can I hide this methods?
>>
>> I have the following code and config:
>>
>> + UserWebService.java
>>
>> @WebService(name = "UserService")
>> public interface UserWebService {
>>     @WebMethod
>>     User getUserById(@WebParam(name = "id") Long id);
>> }
>>
>> + UserWebServiceImpl.java
>>
>> @WebService(endpointInterface =  
>> "com.rbx.test.webservices.UserWebService", name = "UserService")
>> public class UserWebServiceImpl implements UserWebService {
>>
>>     private UserManager userManager;
>>
>>     public void setUserManager(UserManager userManager) {
>>         this.userManager = userManager;
>>     }
>>            public User getUserById(Long id) {
>>         return userManager.getUser(id);
>>     }
>> }
>>
>> + Endpoint config:
>>
>> <jaxws:endpoint id="userService" address="/UserService">
>>     <jaxws:implementor>
>>         <bean class="com.rbx.test.webservices.UserWebServiceImpl">
>>             <property name="userManager" ref="userManager"/>
>>         </bean>
>>     </jaxws:implementor>       </jaxws:endpoint>
>>
>>
>>
>>
>> Julio Arias
>> Java Developer
>> Roundbox Global : enterprise : technology : genius
>> ---------------------------------------------------------------------
>> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
>> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
>> email: julio.arias@rbxglobal.com | www.rbxglobal.com
>> ---------------------------------------------------------------------
>>
>>




Julio Arias
Java Developer
Roundbox Global : enterprise : technology : genius
---------------------------------------------------------------------
Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
email: julio.arias@rbxglobal.com | www.rbxglobal.com
---------------------------------------------------------------------

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Re: Exposing methods

Posted by Julio Arias <ju...@rbxglobal.com>.
Hi Jim,

Thanks I found that property for the @WebMethod annotation too and it  
works fine. But is this a normal behavior to expose everything in the  
implementor, I thought it would only expose the methods on my interface.

On Jul 12, 2007, at 9:05 PM, Jim Ma wrote:

> Hi Julio,
>
> I think you can add @WebMethod(exclude=true)  for the setter method.
>
>    @WebMethod (exclude=true)
>     setUserManager(UserManager userManager)
>
> Cheers
>
> Jim
>
>
> Julio Arias wrote:
>> The dependencies setters from my service impl are getting expose  
>> in the WSDL even though I'm specifying the endpoint interface in  
>> the implementor. How can I hide this methods?
>>
>> I have the following code and config:
>>
>> + UserWebService.java
>>
>> @WebService(name = "UserService")
>> public interface UserWebService {
>>     @WebMethod
>>     User getUserById(@WebParam(name = "id") Long id);
>> }
>>
>> + UserWebServiceImpl.java
>>
>> @WebService(endpointInterface =  
>> "com.rbx.test.webservices.UserWebService", name = "UserService")
>> public class UserWebServiceImpl implements UserWebService {
>>
>>     private UserManager userManager;
>>
>>     public void setUserManager(UserManager userManager) {
>>         this.userManager = userManager;
>>     }
>>            public User getUserById(Long id) {
>>         return userManager.getUser(id);
>>     }
>> }
>>
>> + Endpoint config:
>>
>> <jaxws:endpoint id="userService" address="/UserService">
>>     <jaxws:implementor>
>>         <bean class="com.rbx.test.webservices.UserWebServiceImpl">
>>             <property name="userManager" ref="userManager"/>
>>         </bean>
>>     </jaxws:implementor>       </jaxws:endpoint>
>>
>>
>>
>>
>> Julio Arias
>> Java Developer
>> Roundbox Global : enterprise : technology : genius
>> ---------------------------------------------------------------------
>> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
>> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
>> email: julio.arias@rbxglobal.com | www.rbxglobal.com
>> ---------------------------------------------------------------------
>>
>>




Julio Arias
Java Developer
Roundbox Global : enterprise : technology : genius
---------------------------------------------------------------------
Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
email: julio.arias@rbxglobal.com | www.rbxglobal.com
---------------------------------------------------------------------


Re: Exposing methods

Posted by Jim Ma <em...@iona.com>.
Hi Julio,

I think you can add @WebMethod(exclude=true)  for the setter method.

    @WebMethod (exclude=true)
     setUserManager(UserManager userManager)

Cheers

Jim


Julio Arias wrote:
> The dependencies setters from my service impl are getting expose in 
> the WSDL even though I'm specifying the endpoint interface in the 
> implementor. How can I hide this methods?
>
> I have the following code and config:
>
> + UserWebService.java
>
> @WebService(name = "UserService")
> public interface UserWebService {
>     @WebMethod
>     User getUserById(@WebParam(name = "id") Long id);
> }
>
> + UserWebServiceImpl.java
>
> @WebService(endpointInterface = 
> "com.rbx.test.webservices.UserWebService", name = "UserService")
> public class UserWebServiceImpl implements UserWebService {
>
>     private UserManager userManager;
>
>     public void setUserManager(UserManager userManager) {
>         this.userManager = userManager;
>     }
>        
>     public User getUserById(Long id) {
>         return userManager.getUser(id);
>     }
> }
>
> + Endpoint config:
>
> <jaxws:endpoint id="userService" address="/UserService">
>     <jaxws:implementor>
>         <bean class="com.rbx.test.webservices.UserWebServiceImpl">
>             <property name="userManager" ref="userManager"/>
>         </bean>
>     </jaxws:implementor>       
> </jaxws:endpoint>
>
>
>
>
> Julio Arias
> Java Developer
> Roundbox Global : enterprise : technology : genius
> ---------------------------------------------------------------------
> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
> email: julio.arias@rbxglobal.com | www.rbxglobal.com
> ---------------------------------------------------------------------
>
>

Re: Exposing methods

Posted by Willem Jiang <ni...@iona.com>.
Hi Julio,

I am not sure that I get you point.
Do you mean that you don't want to specify the endpoint interface in the 
implementor in the annotation ?

Even the SEI ( Service Endpoint Interface) is generated by wsdl , you 
still need to specify it in the implementor class.

Your Endpoint Spring description is not mention the wsdlLocation so CXF 
will try to build the Service Model from java class, and the WebService 
annotation is very important for the Service Model building.

Can you tell me more about you concern of hiding this method 
(endpointInterface = *) ?

BTW
Here are some notes about the Service Model
http://cwiki.apache.org/CXF20DOC/cxf-architecture.html#CXFArchitecture-TheServiceModel

Cheers,

Willem.

Julio Arias wrote:
> The dependencies setters from my service impl are getting expose in 
> the WSDL even though I'm specifying the endpoint interface in the 
> implementor. How can I hide this methods?
>
> I have the following code and config:
>
> + UserWebService.java
>
> @WebService(name = "UserService")
> public interface UserWebService {
>     @WebMethod
>     User getUserById(@WebParam(name = "id") Long id);
> }
>
> + UserWebServiceImpl.java
>
> @WebService(endpointInterface = 
> "com.rbx.test.webservices.UserWebService", name = "UserService")
> public class UserWebServiceImpl implements UserWebService {
>
>     private UserManager userManager;
>
>     public void setUserManager(UserManager userManager) {
>         this.userManager = userManager;
>     }
>        
>     public User getUserById(Long id) {
>         return userManager.getUser(id);
>     }
> }
>
> + Endpoint config:
>
> <jaxws:endpoint id="userService" address="/UserService">
>     <jaxws:implementor>
>         <bean class="com.rbx.test.webservices.UserWebServiceImpl">
>             <property name="userManager" ref="userManager"/>
>         </bean>
>     </jaxws:implementor>       
> </jaxws:endpoint>
>
>
>
>
> Julio Arias
> Java Developer
> Roundbox Global : enterprise : technology : genius
> ---------------------------------------------------------------------
> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
> email: julio.arias@rbxglobal.com | www.rbxglobal.com
> ---------------------------------------------------------------------
>
>

RE: Exposing methods

Posted by "Liu, Jervis" <jl...@iona.com>.
Hi Julio, this should work. But sometimes it can happen if the CXF runtime can not load  the endpoint class specified by endpointInterface =  "com.rbx.test.webservices.UserWebService", in that case, CXF will use impl class (i.e., the UserWebServiceImpl ) to build a service model. And if this does happen, all the methods you defined in your impl class will get into your WSDL. So could you please check whether or not you have specified your endpointInterface correctly, for example, the package name etc.

Hope this helps,

Jervis


-----Original Message-----
From: Julio Arias [mailto:julio.arias@rbxglobal.com]
Sent: 2007?7?13? 7:08
To: cxf-user@incubator.apache.org
Subject: Exposing methods


The dependencies setters from my service impl are getting expose in  
the WSDL even though I'm specifying the endpoint interface in the  
implementor. How can I hide this methods?

I have the following code and config:

+ UserWebService.java

@WebService(name = "UserService")
public interface UserWebService {
	@WebMethod
	User getUserById(@WebParam(name = "id") Long id);
}

+ UserWebServiceImpl.java

@WebService(endpointInterface =  
"com.rbx.test.webservices.UserWebService", name = "UserService")
public class UserWebServiceImpl implements UserWebService {

	private UserManager userManager;

	public void setUserManager(UserManager userManager) {
		this.userManager = userManager;
	}
		
	public User getUserById(Long id) {
		return userManager.getUser(id);
	}
}

+ Endpoint config:

<jaxws:endpoint id="userService" address="/UserService">
	<jaxws:implementor>
		<bean class="com.rbx.test.webservices.UserWebServiceImpl">
			<property name="userManager" ref="userManager"/>
		</bean>
	</jaxws:implementor>		
</jaxws:endpoint>




Julio Arias
Java Developer
Roundbox Global : enterprise : technology : genius
---------------------------------------------------------------------
Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
email: julio.arias@rbxglobal.com | www.rbxglobal.com
---------------------------------------------------------------------

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland