About Question enthuware.ocejws.v6.2.13 :

Moderators: Site Manager, fjwalraven

Post Reply
himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

About Question enthuware.ocejws.v6.2.13 :

Post 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.

fjwalraven
Posts: 429
Joined: Tue Jul 24, 2012 2:43 am
Contact:

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

Post 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

himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

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

Post 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.

fjwalraven
Posts: 429
Joined: Tue Jul 24, 2012 2:43 am
Contact:

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

Post by fjwalraven »

Correct!

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

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

Post 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?

fjwalraven
Posts: 429
Joined: Tue Jul 24, 2012 2:43 am
Contact:

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

Post 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

johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

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

Post 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>

fjwalraven
Posts: 429
Joined: Tue Jul 24, 2012 2:43 am
Contact:

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

Post by fjwalraven »

That is indeed surprising!

Conclusion: Glassfish doesn't follow the specs here.

Note: for the exam: follow the specs.

Regards,
Frits

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests