'Rest'에 해당되는 글 3건

  1. rest framework 종류들.. 2010/07/14
  2. 간단한 SOAP 메시지 콜 2010/05/26
  3. url 표현의 알흠다움(?) (2) 2010/05/20

rest framework 종류들..

from Tools 2010/07/14 16:08
rest 기반의 웹 서비스를 쉽게 만들기 위한 framework 도입을 위해서 대충 알아보니, 아래와 같은 framework들이 존재하네요.. 흠, 몰 써야 할까요?? 모르겠넹.. ^^;;

* Restlet is a lightweight REST framework for Java

* Jersey is the open source (under dual CDDL+GPL license), production quality, JAX-RS  (JSR 311) Reference Implementation for building RESTful Web services. But, it is also more than the Reference Implementation. Jersey provides an API  so that developers may extend Jersey to suite their needs.

* JAX-RS: CXF has an implementation of JAX-RS 1.0 (JSR-311): Java API for RESTful Web Services. This provides a more standard way to build RESTful services in JAVA.

JBoss RESTEasy is a JBoss project that provides various frameworks to help you build RESTful Web Services and RESTful Java applications. It strives to be standards based wherever possible, but to also innovate when appropriate.
저작자 표시

'Tools' 카테고리의 다른 글

text 원하는 용량으로 잘라주기  (0) 2010/07/20
HTTP4e Rest Client  (0) 2010/07/15
rest framework 종류들..  (0) 2010/07/14
web framework 종류들..  (0) 2010/07/14
Java Code Coverage Tool  (0) 2010/07/12

간단한 SOAP 메시지 콜

from Java 2010/05/26 15:34

아래처럼 SAAJ를 이용해서 SOAP 1.1 버전의 메소드를 호출해서 사용할 수 있다..
흠.. soap 보다는 json with rest 방식으로.. ^^;;

import java.io.ByteArrayInputStream;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPHeaderElement;
import javax.xml.transform.dom.DOMSource;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class SoapClient implements IClient  {
 
 public static String soapActionUrl = "http://localhost/soap_http/test.asmx?op=GetPurchaseListWBC";
 
 private SoapClient(){};
 
 public static SoapClient newInstance() {
  return new SoapClient();
 }
 
 public static String getRequestMessage(int serviceCode, int uuid) {
  String query = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
   + "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
   +  "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" "
   +  "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" >\n"
   //+  "xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\">\n"
   + " <soap:Body>\n"
   + "  <GetPurchaseListWBC xmlns=\"http://tempuri.org/\">\n"
      + "   <serviceCode>"+String.valueOf(serviceCode)+"</serviceCode>\n"
      + "    <uuid>"+ String.valueOf(uuid) +"</uuid>\n"
      + "   </GetPurchaseListWBC>\n"
   + " </soap:Body>\n"
   + "</soap:Envelope>";  
  return query;
 } 

 public SOAPMessage request(String soapActionUrl) throws Exception {
  Document doc = null;
  DocumentBuilder docBuilder = null;
  DOMSource domSource = null;
  SOAPConnection connection = null;
  
  SOAPMessage resultMessage = null;
  
  try {
   docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
   doc = docBuilder.parse(new ByteArrayInputStream(getRequestMessage(1,2).getBytes()));
   domSource = new DOMSource(doc);
   
   SOAPMessage message = MessageFactory.newInstance().createMessage();  
   message.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, "utf-8");
   message.setProperty(SOAPMessage.WRITE_XML_DECLARATION, "true");
   message.getSOAPPart().setContent(domSource);
   message.getMimeHeaders().addHeader("SOAPAction", "http://tempuri.org/GetPurchaseListWBC");

   //String url = "http://localhost:1351/test.asmx?op=GetPurchaseListWBC";
   connection = SOAPConnectionFactory.newInstance().createConnection();
   resultMessage = connection.call(message, soapActionUrl);
   
   NodeList nodes = resultMessage.getSOAPBody().getChildNodes();
   
   for (int i = 0; i < nodes.getLength() ; i++) {
    Node node  = nodes.item(i);
    this.traverse(node);
   }

  } finally {
   connection.close();
  }
  
  return resultMessage;
 }
 
 public void traverse (Node node) {
  String nodeName = node.getNodeName();
     String nodeValue = node.getNodeValue();
    
     if(!"#text".equals(nodeName))
      System.out.println("<" + nodeName +">");

     if (node.hasChildNodes()) {
      NodeList nodes= node.getChildNodes();
      for (int i=0; i<nodes.getLength(); i++) {
       traverse (nodes.item(i));
      }
     } else {
      System.out.println(nodeValue);
     }
    
     if(!"#text".equals(nodeName))
      System.out.println ("</" + nodeName +">");
 } 
 
}

 

'Java' 카테고리의 다른 글

#ifdef #ifndef in Java  (0) 2010/06/15
멀티쓰레드 프로그램 평가기준  (0) 2010/06/01
간단한 SOAP 메시지 콜  (0) 2010/05/26
garbage collector  (0) 2010/04/29
Circular Dependency Problem  (0) 2010/03/26
Tag // json, Rest, saaj, SOAP

url 표현의 알흠다움(?)

from Web 2010/05/20 13:22
모든 웹 서비스는 url로 접근을 합니다..
제가 즐겨보는 다음 만화, 네이버 만화도 url로 접근을 하죠..
근데,, 갑자기 눈에 거슬리는 get방식의 파라미터 들...

다음 만화 주소형태
http://cartoon.media.daum.net/series/view/zusun/10

네이버 만화 주소형태
http://comic.naver.com/webtoon/detail.nhn?titleId=22027&no=220&weekday=wed

아..
REST 방식의 다음 만화 주소가 알흠답게 보이네요.. ^^
다음편 보기도 편하구. ^^

'Web' 카테고리의 다른 글

url 표현의 알흠다움(?)  (2) 2010/05/20
HTTP 1.1 메쏘드(Method)들  (0) 2010/02/03
HTTP 1.0 메쏘드(Method)들  (2) 2009/08/13
HTTP(Hyper Text Transfer Protocol) 에러 메세지 ..  (0) 2008/08/13
Tag // Rest, url