Wednesday, 10 December 2014

Webservice

Web services:

1. Type of web services:

A. Jax-RPC
B. Jax-WS

2. Ways of building web services:

A. Contract first
B. Contract Last

3. End point choice:

A. Servlet
B. EJB

5. Message exchanging format:

A. Synchronous request and response format
B. Asynchronous request and response
C. One way invoke or fire and forgot

6. Message Exchanging pattern:

A. Style
        a. RPC
        b.  Document
B. Use
        a. Literal
        b. encode

Web service implementation:


@WebService
public interface Reservation
{
    @WebMethod
    public Ticket doBooking(JourneyInfo jInfo, PassiengerInfo pInfo);
}
--------------------------------------------------------------
@WebService(endpointInterface = "com.ibm.pdc.ephs.ws.Reservation")
public class ReservationImpl implements Reservation
{

    public Ticket doBooking(JourneyInfo jInfo, PassiengerInfo pInfo)
    {
        System.out.println("Passenger information:");
        System.out.println(pInfo.getPassName());
        System.out.println(pInfo.getProof());
        System.out.println(pInfo.getAddress());
        System.out.println(pInfo.getAge());
        System.out.println(pInfo.isSex() ? "Male" : "Female");
       
        System.out.println("Journey Information:");
        System.out.println(jInfo.getFromStation());
        System.out.println(jInfo.getToStation());
       
        Ticket ticket = new Ticket();
        ticket.setBearthNumber("B1");
        ticket.setCoathcNumber("B");
        ticket.setPnrNumber(123456);
        ticket.setDateOfjourny(new Date());
        return ticket;
    }

}
-----------------------------------------------------------------------
public class JourneyInfo
{
    private String fromStation;
    private String toStation;
}
public class PassiengerInfo
{
    private String passName;
    private String proof;
    private String address;
    private Integer age;
    private boolean sex;

}
--------------------------------------------------------------------------------
schema




No comments:

Post a Comment