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

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

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

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 » Thu Apr 10, 2014 10:48 pm

Exactly!

Regards,
Frits

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

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

Post by ramy6_1 » Tue Nov 10, 2015 6:54 am

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

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

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

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 2 guests