Page 1 of 1

About Question enthuware.ocejws.v6.2.13 :

Posted: Mon Apr 07, 2014 1:57 pm
by himaiMinh
LogSuper is not annotated by any @WebService, so logParent() is not supposed to be exposed.
Also, if LogService is an explicit SEI, all methods in this SEI will be exposed by the SIB.
But if LogService is an implicit SEI, the method with @WebMethod(exclude=true) won't be exposed.

In NetBean platform, @WebMethod(exclude=true) or false in an SEI won't even compile.

Re: About Question enthuware.ocejws.v6.2.13 :

Posted: Mon Apr 07, 2014 2:18 pm
by fjwalraven
LogSuper is not annotated by any @WebService, so logParent() is not supposed to be exposed.
That annotation is not necessary, from JSR-181:
All methods on the service endpoint interface, including methods inherited from super-interfaces, are mapped to WSDL operations regardless of whether they include a @WebMethod annotation. A method MAY include a @WebMethod annotation to customize the mapping to WSDL, but is not REQUIRED to do so.
and
@WebMethod(exclude=true) or false in an SEI won't even compile.
That is possible, but it is not required by the specs.

Regards,
Frits

Re: About Question enthuware.ocejws.v6.2.13 :

Posted: Mon Apr 07, 2014 9:41 pm
by himaiMinh
Thanks. I got it.
I played with the code by changing all the interface into class like this:

Code: Select all

@WebService
public class LogSuperSuper {
    public void logSuper(String msg) {}
}

Code: Select all

public class LogSuper extends LogSuperSuper{
    public void logParent(String msg){}
}

Code: Select all

@WebService
public class LogService extends LogSuper {
    @Oneway
     public void log(String msg){}
    
    @WebMethod(exclude=true)
    public void logN(String msg){}
}

Code: Select all

@WebService
public class LogImp extends LogService{
   }
When I published the LogImpService, the WSDL shows log, logSuper, logSuperResponse.
Obviously, logParent() is inherited from LogSuper class. But logParent()/LogSuper is not annotated by @WebMethod or @WebService. So, it won't be exposed by LogImp class.

Re: About Question enthuware.ocejws.v6.2.13 :

Posted: Tue Apr 08, 2014 11:24 pm
by fjwalraven
Correct!

Re: About Question enthuware.ocejws.v6.2.13 :

Posted: Thu Nov 24, 2016 12:58 pm
by johnlong
But logParent()/LogSuper is not annotated by @WebMethod or @WebService. So, it won't be exposed by LogImp class.
Is it correct statement?

LogImp inherits logParent() and LogSuper() method, why they are not exposed?

Re: About Question enthuware.ocejws.v6.2.13 :

Posted: Thu Nov 24, 2016 1:40 pm
by fjwalraven
Yes, you might want to read the explanation of a similar question here: viewtopic.php?f=40&t=4084&p=15887#p15887

Regards,
Frits

Re: About Question enthuware.ocejws.v6.2.13 :

Posted: Fri Nov 25, 2016 12:54 pm
by johnlong
Surprisingly I tried to emulate this behavior in GlassFish4

Code: Select all

class SuperC2{
	
	public String superC2M(){
		return null;
	}
}

class superC extends SuperC2 {
	
	public String superCM(){
		return null;
	}
}
@WebService
public class inhClasses extends superC {
	
	public String inhClass(){
		return null;
	}
}
and I got all methods exposed

Code: Select all

<portType name="inhClasses">
<operation name="inhClass">
    <input wsam:Action="http://classes.inheritance.com/inhClasses/inhClassRequest" message="tns:inhClass"/>
    <output wsam:Action="http://classes.inheritance.com/inhClasses/inhClassResponse" message="tns:inhClassResponse"/>
</operation>
<operation name="superCM">
   <input wsam:Action="http://classes.inheritance.com/inhClasses/superCMRequest" message="tns:superCM"/>
   <output wsam:Action="http://classes.inheritance.com/inhClasses/superCMResponse" message="tns:superCMResponse"/>
</operation>
<operation name="superC2M">
   <input wsam:Action="http://classes.inheritance.com/inhClasses/superC2MRequest" message="tns:superC2M"/>
   <output wsam:Action="http://classes.inheritance.com/inhClasses/superC2MResponse" message="tns:superC2MResponse"/>
</operation>
</portType>

Re: About Question enthuware.ocejws.v6.2.13 :

Posted: Fri Nov 25, 2016 1:06 pm
by fjwalraven
That is indeed surprising!

Conclusion: Glassfish doesn't follow the specs here.

Note: for the exam: follow the specs.

Regards,
Frits