Sunday, November 30, 2014

REST & SOAP

REpresentational State Transfer (REST).

REST provides you with abilities that are similar (such as making a stateless request and receiving an XML response) to typical web services but with less overhead on the server than standard SOAP calls. This means that if you have a heavy load on the server, throughput can be faster. In addition, because REST behaves like a regular web request except that you are returning XML strings, implementing REST can be easier for non-SOAP-experienced developers.

Of course, all of this does have a cost. REST requires clients to do more work in receiving the XML because they have to parse it themselves. In contrast, SOAP has Web Services Description Language (WSDL) and XML Schema Definition (XSD) for strong typing to generate the client code.

My only gripe with RESTful services is that everyone seems to implement them slightly differently. There seems to be a textbook definition of how to use them; the URI has a hierarchy describing what it is you are looking for. The user can then use that hierarchy while sending over different types of requests (for example, GET, DELETE). Those requests will determine what the code does. For example, you could send over /address/123 Main St with the DELETE request, and it would tell the server to delete the address 123 Main St. Then an XML response would be returned. In this example, the response would probably be some sort of confirmation. However, not many RESTful components seem to use this method of calling.

 The request should be a totally stateless request, and the URL you are sending over does not care about what was previously sent or any session. The URL is sent to the server, a request is made, and an XML response is returned. 

Thursday, November 27, 2014

SQL Developer Shotcuts

  1. ctrl-enter : executes the current statement(s)
  2. F5 : executes the current code as a script (think SQL*Plus)
  3. ctrl-space : invokes code insight on demand
  4. ctrl-Up/Dn : replaces worksheet with previous/next SQL from SQL History
  5. ctrl-shift+Up/Dn : same as above but appends instead of replaces
  6. shift+F4 : opens a Describe window for current object at cursor
  7. ctrl+F7 : format SQL
  8. ctrl+/ : toggles line commenting
  9. ctrl+e : incremental search

--

Configuring Keyboard Shortcuts in SQL Developer

Tools > Preferences > Shortcut Keys

Wednesday, November 26, 2014

Making webservice client using command


Before executing the command, we need to go to the Java Home location. IN windows command window, java path can be found by the command path. After that we will have to execute the command as below format:

wsimport  <Service URL in WSDL> -d <destination folder location> -keep


Example of command as : 
wsimport http://10.54.170.81:8080/CoreServices/TxnService?wsdl -d d:\test -keep

This command will make the webservice client at specified location.


Monday, November 24, 2014

Seam’s Integration with the MVC

Most frameworks integrate directly by having you call their framework-specific servlets to
integrate with the architecture. Seam is different; it controls items by adding listeners and
life cycles into the request. This allows us to maintain the normal life cycle of a JSF
request. You saw this already earlier in the chapter when I presented Seam’s basic configuration.
Here I will explain it in a bit more detail.
Before I start explaining how Seam integrates with the various areas, you need to be
aware of a central class: org.jboss.seam.context.Lifecyle. This is the class that will keep
our contexts straight. Contexts will handle state in the web tier in a more advanced way
than a standard request and session object.
As you may recall, in the web.xml a listener (org.jboss.seam.servlet.SeamListener) was
added. You also see this listener being the first thing called in our sequence diagram. This
listener is called only at the start of a new session. This will set ServletContext and Session
to the Lifecycle object for manipulation later.
Now you see the next object called is SeamPhaseListener. The SeamPhaseListener object
is called in connection with FacesServlet. As you saw in faces-config.xml earlier, the
SeamPhaseListener is part of the life cycle for FacesServlet. This again is used to control
much of the context and to store the request state. This listener is needed to help move
the data from the presentation to the business logic tier. In a typical JSF life cycle, you
would use backing beans. Now instead of having to worry about your backing beans
needing to translate the data and call EJBs, Seam will handle this directly for us.


Copied from: Beginnign JBoss Seam by Joseph Faisal Nusairat

Inversion of Control in Seam

Inversion of control, also known by many as dependency injection, takes the need to
instantiate objects away from the normal user calls. Instead, you allow the container to
handle the creation of the component and its subcomponents. Seam is no different in
using dependency injection to inject objects. However, Seam takes it to the next step by
allowing the injection to go both ways.

IoC is needed because of the nature of Seam. Because we don’t use any JSF action
classes to translate our presentation tier requests into objects and then set them on the
EJB and call the EJB, we have to use IoC to make up for it. This helps us save time and
space by letting the container manage the objects.

The usage of IoC in Seam is often referred to as bijection, because the injection is
two-way (injection and “outjection”). You can specify the direction of the components.
However, bijection is so much more in Seam than it is in most typical IoC patterns. Seam
takes IoC and expands it by making it dynamic, contextual, and bidirectional, and allowing
assembly by the container.

So where can you use bijection? Bijection can be used on any object that is a Seam
object. Remember, a Seam object is any object that you have defined with an @Name annotation
on the class. You can then biject your Seam objects into any SB or JavaBean.
However, you cannot biject objects into your EB. This is because the domain model
should be independent of business logic and because EBs are instantiated at the application
level and Seam could not intercept them anyway.

Seam performs bijection by dividing it into two areas: one going into the system and
one going out. As I have said, these are more commonly defined as injection and outjection,
and we use @In and @Out for these, respectively.