Showing posts with label Web Service. Show all posts
Showing posts with label Web Service. Show all posts

Wednesday, December 12, 2012

REST Service Client Tool : Beginner's Way

REST means Representational state transfer one of the mechanism of writing web service . After writing web service we need to write a client for it for testing purpose .But by using simple tool we can save our time of writing a client to test our server side service even it is 10 min. There is a chrome browser named Simple REST Client which we can use to serve our purpose.
We can download it from :Chrome Extension (Simple REST Client). We will find an icon in our chrome as indicated in picture after installing it in our chrome browser.



If we click the icon previously mentioned we will get a UI (user interface) like :


Instruction to use it :
URL : put your service url hear , example : https://www.example.com/restService/payment
Method : depends on your endpoint . in case of us POST
Header : Content-Type: text/html;charset=utf-8 or Content-Type: text/xml;charset=utf-8 this define the request message type expected by service end.In case of us (Content-Type: text/html;charset=utf-8).
Data : If you put service url in URL then this Data section will appear.In this section we will put actual client request message such as :


  CC
  John
  Doe
  1234 Street
  WA
  123
  US
  v
  4100111111111111
  0115
  123
  usd
 
     
  123
  Fall 2013
  123
  BBA
 
 
  example description
           12/12/2012
 
 
 
      
  TYPE
  tuition
  2
  2
  1

 
 
  TYPE
  Late Fee
  1
  2
  1
 


Previous request message (xml) taken from a real world scenario so i changed the real information to dummy information.

Now , we just need to hit send button , it will send the request to service end and show us response as desired by client. Response example : :

1
1
This transaction has been approved.
9DJEXW
Y
2180716417
4.00
CC
billing first name
billing last name
dhaka dhaka 1229 bangladesh 2 XXXX1111 Visa

This extension will work as a REST client . That's all. Apart from it we can use SOAP UI but this is much more easier for beginner and later on SOPA UI can be used . Wish to write on SOAP UI how to later.

Thursday, June 07, 2012

REST with Java (JAX-RS) using Jersey in five minutes


Simple Root Resource Class :
package com.hello.demo;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;


@Path("/hello")
public class Hello  {

 @POST
 @Path("/test")
 @Consumes(MediaType.TEXT_XML)
 @Produces(MediaType.TEXT_XML)
 public String consumeTest (String requestMessage) {
   return requestMessage;
    
 } 
}


Testing this service using Simple REST Client found as chrome extension :
That's it. Try and enjoy.

Sunday, December 18, 2011

Introduction to Web Service

Web service is a well known and popular term now a days in web application world. Sometimes we are puzzled with the actual definition of WS. But www.w3.org/ resolve the issue by giving the formal definition of web service.

Web Services (WS) are software systems that support interoperable machine-to-machine interactions over a network. They provide a universal glue between different applications within the enterprise, or between different companies and they enable fast development of distributed applications in heterogeneous systems.