Page 1 of 1

About Question enthuware.ocejws.v6.2.237 :

Posted: Wed Apr 09, 2014 7:33 pm
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);

    }

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

Posted: Thu Apr 10, 2014 2:31 pm
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

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

Posted: Thu Apr 10, 2014 8:45 pm
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.

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

Posted: Thu Apr 10, 2014 10:48 pm
by fjwalraven
Exactly!

Regards,
Frits

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

Posted: Tue Nov 10, 2015 6:54 am
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 ?

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

Posted: Wed Nov 11, 2015 1:59 am
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

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

Posted: Wed Nov 16, 2016 1:36 pm
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?

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

Posted: Wed Nov 16, 2016 2:21 pm
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