About Question enthuware.ocejws.v6.2.237 :

Moderators: Site Manager, fjwalraven

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

About Question enthuware.ocejws.v6.2.237 :

Post by himaiMinh »

I don't fully understand the scenario described this question.
Does it mean the following ?
1. There is an application running on a server that is not written in Java, let's say in C#.
2. The solution is to expose this C# application to EJB as a web service.
3. With this solution, any new clients can connect to this C# application via this EJB web service.
Here may be the code that describe this question.

Code: Select all

  //psudo code
  @WebService
   @Stateless
   public class Compute
    //This is the endpoint where the C# application is published.
   String endpoint = "http://www.CSharpApplication.com/compute"
  
   public int compute(){
       QName serviceName = new QName("myService","");
       QName portName = new QName("myPort","");
       Service service = Service.create(serviceName);
       service.addPort(portName, HTTPBinding.HTTP_BINDING, endpoint);
        //suppose createXMLSource creates an XML request
       DOMSource xmlRequest = createXMLSource();
       Dispatch<DOMSource> dispatch = service.createDispatch(port, DOMSource.class,  Service.Mode.PAYLOAD);
      return dispatch.invoke(xmlRequest);

    }

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

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

Post by fjwalraven »

Well almost.

What is meant is that there is an existing java application (EJB service) with java clients. Now the company that owns the EJB service has bought another company (that doesn't have java applications). The applications (not written in java) can make use of the services that the EJB exposes. However this would only be possible if you connect the two applications via web services.

Does this help?

Regards,
Frits

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

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

Post by himaiMinh »

Hi, Frits. Thanks for the explanation.
So that means the application (not written in Java), let's say in C#, is a client of the EJB service. This C# client may send SOAP requests to the EJB soap-based service or may send XML/JSON/text requests to the EJB Restful service.

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

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

Post by fjwalraven »

Exactly!

Regards,
Frits

ramy6_1
Posts: 124
Joined: Wed Feb 12, 2014 2:44 am
Contact:

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

Post by ramy6_1 »

Hello ,

I came from enthuware.ocejws.v6.2.237.

As Singleton - All requests are served by the same instance, and therefore the answer will be 60.

But if the bean was Stateless the value will be 20 after the fifth invocation , since container will provide difference instance at each service call.

Correct or the value will be undefined ?

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

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

Post by fjwalraven »

It will be undefined because you won't know which EJB will serve you request (the EJB-container just grabs an instance from the pool)

Regards,
Frits

sttaq0442
Posts: 27
Joined: Tue Nov 15, 2016 11:20 am
Contact:

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

Post by sttaq0442 »

fjwalraven wrote:It will be undefined because you won't know which EJB will serve you request (the EJB-container just grabs an instance from the pool)

Regards,
Frits
I think the correct answer should be undefined because "integer" is not a Java type and the code will not compile. Or may be we have to figure it out that it is a typo?

Other than this, is it safe to assume that questions that appear in exam will have correct syntax?

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

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

Post by fjwalraven »

Good catch!! that is a typo.

Fixed it.
Other than this, is it safe to assume that questions that appear in exam will have correct syntax?
Well, I wish I could say yes, but I had a couple of faulty questions on my exam.

Regards,
Frits

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests