Standards on Web Services, Open APIs &...
Transcript of Standards on Web Services, Open APIs &...
Standards on Web Services
Open APIs amp Mashups
2011 4
Park Chang-Sup
Dept of Computer Science Dongduk Womenrsquos Univ
Agenda
World Wide Web Overview
Web Services
ndash Concept
ndash Core Technologies
XML SOAP WSDL UDDI
ndash Architecture
ndash Usage Scenario
Open APIs amp Mashups
ndash SOAP vs REST
ndash Examples
Flickr Open API
Naver Open API
World Wide Web
모든 컴퓨터가 웹 브라우저 및 웹 서버를 이용해서 HTML과 HTTP
를 지원할 수 있음
ndash Any operation system hardware platform programming language
많은 기업들이 정보와 서비스를 제공하기 위해 그들 자신의 웹
사이트를 운영하고 있음
World Wide Web
Human-centric Web
ndash WWW의 주 사용 목적은 사람이 문서와 어플리케이션들에 대해
대화식으로 접근할 수 있도록 하는 것
World Wide Web
Application-centric Web
ndash Next Generation of Web
ndash 더 자동화된 웹
예) 호텔과 항공사에 접속 및 검색하여 자동으로 예약 수행
ndash 어플리케이션들 사이의 쉬운 연결 방법 지원
XML for Data Exchange (instead of HTML)
Description for Applications
Discovery for Applications
Morehellip
World Wide Web
Main goal of Human-centric Web
ndash 분산된 문서들의 공유
Technologies
ndash (TCPIP DNS) HTTP URL HTML
World Wide Web
Main goal of Application-centric Web
ndash 분산된 서비스들의 공유
Technologies
ndash (TCPIP DNS) HTTP URL XML SOAP WSDL UDDI
Web Service란
Definition
ndash 네트워크로 연결된 컴퓨터들 사이에 상호운영 가능한 연동방법을
제공하도록 설계된 소프트웨어 시스템
ndash XML Application
ndash 컴퓨터가 처리가능한 형식(WSDL)으로 기술되는 인터페이스를 가짐
ndash SOAP 메시지를 사용하여 통신 및 연동
ndash Service-Oriented Architecture (SOA) 기반 애플리케이션 개발 지원
Web Service란
이종(heterogeneous) 애플리케이션들 사이의 연동 및 통합을 위한
수단
Web Service as Distributed Computing
Architecture
웹 서비스는 다른 분산 컴퓨팅 수단들과 많은 유사성을 가짐
ndash WSDL vs CORBA IDL
ndash SOAP vs JSONXML-RPC
웹의 장점을 이용하기 위해서는 기존 분산 컴퓨팅 방식이
변화되어야 함
ndash 웹은 비연결형(connection-less)
단방향 또는 비동기화된 메시지 이용
기존 기술들은 더 밀결합된(tightly coupled) 시스템을 가정함
ndash 웹은 시스템들이 서로에 대한 사전 지식 없이 연결될 수 있음을
가정함
Web Service의 특징
ndash Open-standard
Supporting organization for standardization W3C OASIS
Supporting software vendors Microsoft IBM Oracle HP Sun
SAP BEA
ndash Go across the Firewalls
Using independent transfer protocol HTTPS SMTP
ndash Service Registry
ndash 플랫폼과 프로그래밍 언어에 독립적
Using XML
ndash Web Service는 CORBA DCOM 등 기존 분산 컴퓨팅 수단들과
유사성을 가지나 Web 기술을 이용하여 기존 애플리케이션들을
느슨하게 결합된(loosely coupled) 형태로 연동 가능케 함
Web Service as Distributed Computing
Architecture
W3C Web Service Activity
8 Working Groups 1 Interest Group
ndash XML Protocol WG (SOAP) (20008 ~)
ndash Web Services Architecture WG (20021 ~ 20041)
ndash Web Services Description WG (WSDL) (20021 ~ 20076)
ndash Web Services Choreography WG (20031 ~)
ndash Semantic Web Services IG (200310 ~)
ndash Web Services Addressing WG (200410 ~)
ndash XML Schema Patterns for Data Binding WG (20053 ~)
ndash Semantic Annotations for WSDL WG (20063 ~)
ndash Web Services Policy WG (20066 ~)
Web Service Core Technologies
XML (Extensible Markup Language)
SOAP (SOAPXML Protocol)
WSDL (Web Services Description Language)
UDDI (Universal Description Discovery and Integration)
HTTP SMTP FTP etc
WS-SecurityWS-Reliable
Messaging
WS-Transactions
WS-Coordination
SOAP
WSDL DAML-S Policy Inspection
WSCI WSCL BPEL4WS
UDDI ebXML
DAML-S OWL-S
Transport
Encoding amp Messaging
Quality of Service
Service Description
Publication amp Discovery
Service Choreography
Semantic Web Service
XML
XML (eXtensible Markup Language)
ndash de facto standard language for data representation and
interchange over the Internet
ndash eXtensible
누구나 새로운 마크업(mark-up)을 정의할 수 있음
ndash Markup Language
문서의 내용(content)에 부가적인 정보를 추가할 수 있는 언어
Main properties of XML
ndash 의미적으로 구조화됨 (semantically structured)
ndash self-describing
XML
Markups in HTML
ndash stylistic markup
eg ltFONTgt ltBgt in HTML
ndash structural markup
eg ltPgt in HTML
ndash semantic markup
eg ltTITLEgt ltBODYgt in HTML
XML에서 markup은 문서의 출력 형식(display format)이 아니라 문서의
구조와 의미를 정의하기 위해 사용됨
XML
XML vs HTML
ltdlgt
ltdtgtCalifornia love
ltddgtby Tupac
ltulgt
ltligtpublisher R record
ltligtlength 430
ltligtdate 19991010
ltulgt
ltdlgt
ltsonggt
lttitlegtCalifornia lovelttitlegt
ltartistgtTupacltartistgt
ltpublishergtR recordltpublishergt
ltlengthgt430ltlengthgt
ltdategt19991010ltdategt
ltsonggt
XML 문서의 구조와 의미를 지정하
기 위해 사용자가 직접 태그를 정의
해서 사용
HTML 화면 출력 모양을 지정하기
위해 미리 정의된 태그를 이용
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Agenda
World Wide Web Overview
Web Services
ndash Concept
ndash Core Technologies
XML SOAP WSDL UDDI
ndash Architecture
ndash Usage Scenario
Open APIs amp Mashups
ndash SOAP vs REST
ndash Examples
Flickr Open API
Naver Open API
World Wide Web
모든 컴퓨터가 웹 브라우저 및 웹 서버를 이용해서 HTML과 HTTP
를 지원할 수 있음
ndash Any operation system hardware platform programming language
많은 기업들이 정보와 서비스를 제공하기 위해 그들 자신의 웹
사이트를 운영하고 있음
World Wide Web
Human-centric Web
ndash WWW의 주 사용 목적은 사람이 문서와 어플리케이션들에 대해
대화식으로 접근할 수 있도록 하는 것
World Wide Web
Application-centric Web
ndash Next Generation of Web
ndash 더 자동화된 웹
예) 호텔과 항공사에 접속 및 검색하여 자동으로 예약 수행
ndash 어플리케이션들 사이의 쉬운 연결 방법 지원
XML for Data Exchange (instead of HTML)
Description for Applications
Discovery for Applications
Morehellip
World Wide Web
Main goal of Human-centric Web
ndash 분산된 문서들의 공유
Technologies
ndash (TCPIP DNS) HTTP URL HTML
World Wide Web
Main goal of Application-centric Web
ndash 분산된 서비스들의 공유
Technologies
ndash (TCPIP DNS) HTTP URL XML SOAP WSDL UDDI
Web Service란
Definition
ndash 네트워크로 연결된 컴퓨터들 사이에 상호운영 가능한 연동방법을
제공하도록 설계된 소프트웨어 시스템
ndash XML Application
ndash 컴퓨터가 처리가능한 형식(WSDL)으로 기술되는 인터페이스를 가짐
ndash SOAP 메시지를 사용하여 통신 및 연동
ndash Service-Oriented Architecture (SOA) 기반 애플리케이션 개발 지원
Web Service란
이종(heterogeneous) 애플리케이션들 사이의 연동 및 통합을 위한
수단
Web Service as Distributed Computing
Architecture
웹 서비스는 다른 분산 컴퓨팅 수단들과 많은 유사성을 가짐
ndash WSDL vs CORBA IDL
ndash SOAP vs JSONXML-RPC
웹의 장점을 이용하기 위해서는 기존 분산 컴퓨팅 방식이
변화되어야 함
ndash 웹은 비연결형(connection-less)
단방향 또는 비동기화된 메시지 이용
기존 기술들은 더 밀결합된(tightly coupled) 시스템을 가정함
ndash 웹은 시스템들이 서로에 대한 사전 지식 없이 연결될 수 있음을
가정함
Web Service의 특징
ndash Open-standard
Supporting organization for standardization W3C OASIS
Supporting software vendors Microsoft IBM Oracle HP Sun
SAP BEA
ndash Go across the Firewalls
Using independent transfer protocol HTTPS SMTP
ndash Service Registry
ndash 플랫폼과 프로그래밍 언어에 독립적
Using XML
ndash Web Service는 CORBA DCOM 등 기존 분산 컴퓨팅 수단들과
유사성을 가지나 Web 기술을 이용하여 기존 애플리케이션들을
느슨하게 결합된(loosely coupled) 형태로 연동 가능케 함
Web Service as Distributed Computing
Architecture
W3C Web Service Activity
8 Working Groups 1 Interest Group
ndash XML Protocol WG (SOAP) (20008 ~)
ndash Web Services Architecture WG (20021 ~ 20041)
ndash Web Services Description WG (WSDL) (20021 ~ 20076)
ndash Web Services Choreography WG (20031 ~)
ndash Semantic Web Services IG (200310 ~)
ndash Web Services Addressing WG (200410 ~)
ndash XML Schema Patterns for Data Binding WG (20053 ~)
ndash Semantic Annotations for WSDL WG (20063 ~)
ndash Web Services Policy WG (20066 ~)
Web Service Core Technologies
XML (Extensible Markup Language)
SOAP (SOAPXML Protocol)
WSDL (Web Services Description Language)
UDDI (Universal Description Discovery and Integration)
HTTP SMTP FTP etc
WS-SecurityWS-Reliable
Messaging
WS-Transactions
WS-Coordination
SOAP
WSDL DAML-S Policy Inspection
WSCI WSCL BPEL4WS
UDDI ebXML
DAML-S OWL-S
Transport
Encoding amp Messaging
Quality of Service
Service Description
Publication amp Discovery
Service Choreography
Semantic Web Service
XML
XML (eXtensible Markup Language)
ndash de facto standard language for data representation and
interchange over the Internet
ndash eXtensible
누구나 새로운 마크업(mark-up)을 정의할 수 있음
ndash Markup Language
문서의 내용(content)에 부가적인 정보를 추가할 수 있는 언어
Main properties of XML
ndash 의미적으로 구조화됨 (semantically structured)
ndash self-describing
XML
Markups in HTML
ndash stylistic markup
eg ltFONTgt ltBgt in HTML
ndash structural markup
eg ltPgt in HTML
ndash semantic markup
eg ltTITLEgt ltBODYgt in HTML
XML에서 markup은 문서의 출력 형식(display format)이 아니라 문서의
구조와 의미를 정의하기 위해 사용됨
XML
XML vs HTML
ltdlgt
ltdtgtCalifornia love
ltddgtby Tupac
ltulgt
ltligtpublisher R record
ltligtlength 430
ltligtdate 19991010
ltulgt
ltdlgt
ltsonggt
lttitlegtCalifornia lovelttitlegt
ltartistgtTupacltartistgt
ltpublishergtR recordltpublishergt
ltlengthgt430ltlengthgt
ltdategt19991010ltdategt
ltsonggt
XML 문서의 구조와 의미를 지정하
기 위해 사용자가 직접 태그를 정의
해서 사용
HTML 화면 출력 모양을 지정하기
위해 미리 정의된 태그를 이용
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
World Wide Web
모든 컴퓨터가 웹 브라우저 및 웹 서버를 이용해서 HTML과 HTTP
를 지원할 수 있음
ndash Any operation system hardware platform programming language
많은 기업들이 정보와 서비스를 제공하기 위해 그들 자신의 웹
사이트를 운영하고 있음
World Wide Web
Human-centric Web
ndash WWW의 주 사용 목적은 사람이 문서와 어플리케이션들에 대해
대화식으로 접근할 수 있도록 하는 것
World Wide Web
Application-centric Web
ndash Next Generation of Web
ndash 더 자동화된 웹
예) 호텔과 항공사에 접속 및 검색하여 자동으로 예약 수행
ndash 어플리케이션들 사이의 쉬운 연결 방법 지원
XML for Data Exchange (instead of HTML)
Description for Applications
Discovery for Applications
Morehellip
World Wide Web
Main goal of Human-centric Web
ndash 분산된 문서들의 공유
Technologies
ndash (TCPIP DNS) HTTP URL HTML
World Wide Web
Main goal of Application-centric Web
ndash 분산된 서비스들의 공유
Technologies
ndash (TCPIP DNS) HTTP URL XML SOAP WSDL UDDI
Web Service란
Definition
ndash 네트워크로 연결된 컴퓨터들 사이에 상호운영 가능한 연동방법을
제공하도록 설계된 소프트웨어 시스템
ndash XML Application
ndash 컴퓨터가 처리가능한 형식(WSDL)으로 기술되는 인터페이스를 가짐
ndash SOAP 메시지를 사용하여 통신 및 연동
ndash Service-Oriented Architecture (SOA) 기반 애플리케이션 개발 지원
Web Service란
이종(heterogeneous) 애플리케이션들 사이의 연동 및 통합을 위한
수단
Web Service as Distributed Computing
Architecture
웹 서비스는 다른 분산 컴퓨팅 수단들과 많은 유사성을 가짐
ndash WSDL vs CORBA IDL
ndash SOAP vs JSONXML-RPC
웹의 장점을 이용하기 위해서는 기존 분산 컴퓨팅 방식이
변화되어야 함
ndash 웹은 비연결형(connection-less)
단방향 또는 비동기화된 메시지 이용
기존 기술들은 더 밀결합된(tightly coupled) 시스템을 가정함
ndash 웹은 시스템들이 서로에 대한 사전 지식 없이 연결될 수 있음을
가정함
Web Service의 특징
ndash Open-standard
Supporting organization for standardization W3C OASIS
Supporting software vendors Microsoft IBM Oracle HP Sun
SAP BEA
ndash Go across the Firewalls
Using independent transfer protocol HTTPS SMTP
ndash Service Registry
ndash 플랫폼과 프로그래밍 언어에 독립적
Using XML
ndash Web Service는 CORBA DCOM 등 기존 분산 컴퓨팅 수단들과
유사성을 가지나 Web 기술을 이용하여 기존 애플리케이션들을
느슨하게 결합된(loosely coupled) 형태로 연동 가능케 함
Web Service as Distributed Computing
Architecture
W3C Web Service Activity
8 Working Groups 1 Interest Group
ndash XML Protocol WG (SOAP) (20008 ~)
ndash Web Services Architecture WG (20021 ~ 20041)
ndash Web Services Description WG (WSDL) (20021 ~ 20076)
ndash Web Services Choreography WG (20031 ~)
ndash Semantic Web Services IG (200310 ~)
ndash Web Services Addressing WG (200410 ~)
ndash XML Schema Patterns for Data Binding WG (20053 ~)
ndash Semantic Annotations for WSDL WG (20063 ~)
ndash Web Services Policy WG (20066 ~)
Web Service Core Technologies
XML (Extensible Markup Language)
SOAP (SOAPXML Protocol)
WSDL (Web Services Description Language)
UDDI (Universal Description Discovery and Integration)
HTTP SMTP FTP etc
WS-SecurityWS-Reliable
Messaging
WS-Transactions
WS-Coordination
SOAP
WSDL DAML-S Policy Inspection
WSCI WSCL BPEL4WS
UDDI ebXML
DAML-S OWL-S
Transport
Encoding amp Messaging
Quality of Service
Service Description
Publication amp Discovery
Service Choreography
Semantic Web Service
XML
XML (eXtensible Markup Language)
ndash de facto standard language for data representation and
interchange over the Internet
ndash eXtensible
누구나 새로운 마크업(mark-up)을 정의할 수 있음
ndash Markup Language
문서의 내용(content)에 부가적인 정보를 추가할 수 있는 언어
Main properties of XML
ndash 의미적으로 구조화됨 (semantically structured)
ndash self-describing
XML
Markups in HTML
ndash stylistic markup
eg ltFONTgt ltBgt in HTML
ndash structural markup
eg ltPgt in HTML
ndash semantic markup
eg ltTITLEgt ltBODYgt in HTML
XML에서 markup은 문서의 출력 형식(display format)이 아니라 문서의
구조와 의미를 정의하기 위해 사용됨
XML
XML vs HTML
ltdlgt
ltdtgtCalifornia love
ltddgtby Tupac
ltulgt
ltligtpublisher R record
ltligtlength 430
ltligtdate 19991010
ltulgt
ltdlgt
ltsonggt
lttitlegtCalifornia lovelttitlegt
ltartistgtTupacltartistgt
ltpublishergtR recordltpublishergt
ltlengthgt430ltlengthgt
ltdategt19991010ltdategt
ltsonggt
XML 문서의 구조와 의미를 지정하
기 위해 사용자가 직접 태그를 정의
해서 사용
HTML 화면 출력 모양을 지정하기
위해 미리 정의된 태그를 이용
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
World Wide Web
Human-centric Web
ndash WWW의 주 사용 목적은 사람이 문서와 어플리케이션들에 대해
대화식으로 접근할 수 있도록 하는 것
World Wide Web
Application-centric Web
ndash Next Generation of Web
ndash 더 자동화된 웹
예) 호텔과 항공사에 접속 및 검색하여 자동으로 예약 수행
ndash 어플리케이션들 사이의 쉬운 연결 방법 지원
XML for Data Exchange (instead of HTML)
Description for Applications
Discovery for Applications
Morehellip
World Wide Web
Main goal of Human-centric Web
ndash 분산된 문서들의 공유
Technologies
ndash (TCPIP DNS) HTTP URL HTML
World Wide Web
Main goal of Application-centric Web
ndash 분산된 서비스들의 공유
Technologies
ndash (TCPIP DNS) HTTP URL XML SOAP WSDL UDDI
Web Service란
Definition
ndash 네트워크로 연결된 컴퓨터들 사이에 상호운영 가능한 연동방법을
제공하도록 설계된 소프트웨어 시스템
ndash XML Application
ndash 컴퓨터가 처리가능한 형식(WSDL)으로 기술되는 인터페이스를 가짐
ndash SOAP 메시지를 사용하여 통신 및 연동
ndash Service-Oriented Architecture (SOA) 기반 애플리케이션 개발 지원
Web Service란
이종(heterogeneous) 애플리케이션들 사이의 연동 및 통합을 위한
수단
Web Service as Distributed Computing
Architecture
웹 서비스는 다른 분산 컴퓨팅 수단들과 많은 유사성을 가짐
ndash WSDL vs CORBA IDL
ndash SOAP vs JSONXML-RPC
웹의 장점을 이용하기 위해서는 기존 분산 컴퓨팅 방식이
변화되어야 함
ndash 웹은 비연결형(connection-less)
단방향 또는 비동기화된 메시지 이용
기존 기술들은 더 밀결합된(tightly coupled) 시스템을 가정함
ndash 웹은 시스템들이 서로에 대한 사전 지식 없이 연결될 수 있음을
가정함
Web Service의 특징
ndash Open-standard
Supporting organization for standardization W3C OASIS
Supporting software vendors Microsoft IBM Oracle HP Sun
SAP BEA
ndash Go across the Firewalls
Using independent transfer protocol HTTPS SMTP
ndash Service Registry
ndash 플랫폼과 프로그래밍 언어에 독립적
Using XML
ndash Web Service는 CORBA DCOM 등 기존 분산 컴퓨팅 수단들과
유사성을 가지나 Web 기술을 이용하여 기존 애플리케이션들을
느슨하게 결합된(loosely coupled) 형태로 연동 가능케 함
Web Service as Distributed Computing
Architecture
W3C Web Service Activity
8 Working Groups 1 Interest Group
ndash XML Protocol WG (SOAP) (20008 ~)
ndash Web Services Architecture WG (20021 ~ 20041)
ndash Web Services Description WG (WSDL) (20021 ~ 20076)
ndash Web Services Choreography WG (20031 ~)
ndash Semantic Web Services IG (200310 ~)
ndash Web Services Addressing WG (200410 ~)
ndash XML Schema Patterns for Data Binding WG (20053 ~)
ndash Semantic Annotations for WSDL WG (20063 ~)
ndash Web Services Policy WG (20066 ~)
Web Service Core Technologies
XML (Extensible Markup Language)
SOAP (SOAPXML Protocol)
WSDL (Web Services Description Language)
UDDI (Universal Description Discovery and Integration)
HTTP SMTP FTP etc
WS-SecurityWS-Reliable
Messaging
WS-Transactions
WS-Coordination
SOAP
WSDL DAML-S Policy Inspection
WSCI WSCL BPEL4WS
UDDI ebXML
DAML-S OWL-S
Transport
Encoding amp Messaging
Quality of Service
Service Description
Publication amp Discovery
Service Choreography
Semantic Web Service
XML
XML (eXtensible Markup Language)
ndash de facto standard language for data representation and
interchange over the Internet
ndash eXtensible
누구나 새로운 마크업(mark-up)을 정의할 수 있음
ndash Markup Language
문서의 내용(content)에 부가적인 정보를 추가할 수 있는 언어
Main properties of XML
ndash 의미적으로 구조화됨 (semantically structured)
ndash self-describing
XML
Markups in HTML
ndash stylistic markup
eg ltFONTgt ltBgt in HTML
ndash structural markup
eg ltPgt in HTML
ndash semantic markup
eg ltTITLEgt ltBODYgt in HTML
XML에서 markup은 문서의 출력 형식(display format)이 아니라 문서의
구조와 의미를 정의하기 위해 사용됨
XML
XML vs HTML
ltdlgt
ltdtgtCalifornia love
ltddgtby Tupac
ltulgt
ltligtpublisher R record
ltligtlength 430
ltligtdate 19991010
ltulgt
ltdlgt
ltsonggt
lttitlegtCalifornia lovelttitlegt
ltartistgtTupacltartistgt
ltpublishergtR recordltpublishergt
ltlengthgt430ltlengthgt
ltdategt19991010ltdategt
ltsonggt
XML 문서의 구조와 의미를 지정하
기 위해 사용자가 직접 태그를 정의
해서 사용
HTML 화면 출력 모양을 지정하기
위해 미리 정의된 태그를 이용
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
World Wide Web
Application-centric Web
ndash Next Generation of Web
ndash 더 자동화된 웹
예) 호텔과 항공사에 접속 및 검색하여 자동으로 예약 수행
ndash 어플리케이션들 사이의 쉬운 연결 방법 지원
XML for Data Exchange (instead of HTML)
Description for Applications
Discovery for Applications
Morehellip
World Wide Web
Main goal of Human-centric Web
ndash 분산된 문서들의 공유
Technologies
ndash (TCPIP DNS) HTTP URL HTML
World Wide Web
Main goal of Application-centric Web
ndash 분산된 서비스들의 공유
Technologies
ndash (TCPIP DNS) HTTP URL XML SOAP WSDL UDDI
Web Service란
Definition
ndash 네트워크로 연결된 컴퓨터들 사이에 상호운영 가능한 연동방법을
제공하도록 설계된 소프트웨어 시스템
ndash XML Application
ndash 컴퓨터가 처리가능한 형식(WSDL)으로 기술되는 인터페이스를 가짐
ndash SOAP 메시지를 사용하여 통신 및 연동
ndash Service-Oriented Architecture (SOA) 기반 애플리케이션 개발 지원
Web Service란
이종(heterogeneous) 애플리케이션들 사이의 연동 및 통합을 위한
수단
Web Service as Distributed Computing
Architecture
웹 서비스는 다른 분산 컴퓨팅 수단들과 많은 유사성을 가짐
ndash WSDL vs CORBA IDL
ndash SOAP vs JSONXML-RPC
웹의 장점을 이용하기 위해서는 기존 분산 컴퓨팅 방식이
변화되어야 함
ndash 웹은 비연결형(connection-less)
단방향 또는 비동기화된 메시지 이용
기존 기술들은 더 밀결합된(tightly coupled) 시스템을 가정함
ndash 웹은 시스템들이 서로에 대한 사전 지식 없이 연결될 수 있음을
가정함
Web Service의 특징
ndash Open-standard
Supporting organization for standardization W3C OASIS
Supporting software vendors Microsoft IBM Oracle HP Sun
SAP BEA
ndash Go across the Firewalls
Using independent transfer protocol HTTPS SMTP
ndash Service Registry
ndash 플랫폼과 프로그래밍 언어에 독립적
Using XML
ndash Web Service는 CORBA DCOM 등 기존 분산 컴퓨팅 수단들과
유사성을 가지나 Web 기술을 이용하여 기존 애플리케이션들을
느슨하게 결합된(loosely coupled) 형태로 연동 가능케 함
Web Service as Distributed Computing
Architecture
W3C Web Service Activity
8 Working Groups 1 Interest Group
ndash XML Protocol WG (SOAP) (20008 ~)
ndash Web Services Architecture WG (20021 ~ 20041)
ndash Web Services Description WG (WSDL) (20021 ~ 20076)
ndash Web Services Choreography WG (20031 ~)
ndash Semantic Web Services IG (200310 ~)
ndash Web Services Addressing WG (200410 ~)
ndash XML Schema Patterns for Data Binding WG (20053 ~)
ndash Semantic Annotations for WSDL WG (20063 ~)
ndash Web Services Policy WG (20066 ~)
Web Service Core Technologies
XML (Extensible Markup Language)
SOAP (SOAPXML Protocol)
WSDL (Web Services Description Language)
UDDI (Universal Description Discovery and Integration)
HTTP SMTP FTP etc
WS-SecurityWS-Reliable
Messaging
WS-Transactions
WS-Coordination
SOAP
WSDL DAML-S Policy Inspection
WSCI WSCL BPEL4WS
UDDI ebXML
DAML-S OWL-S
Transport
Encoding amp Messaging
Quality of Service
Service Description
Publication amp Discovery
Service Choreography
Semantic Web Service
XML
XML (eXtensible Markup Language)
ndash de facto standard language for data representation and
interchange over the Internet
ndash eXtensible
누구나 새로운 마크업(mark-up)을 정의할 수 있음
ndash Markup Language
문서의 내용(content)에 부가적인 정보를 추가할 수 있는 언어
Main properties of XML
ndash 의미적으로 구조화됨 (semantically structured)
ndash self-describing
XML
Markups in HTML
ndash stylistic markup
eg ltFONTgt ltBgt in HTML
ndash structural markup
eg ltPgt in HTML
ndash semantic markup
eg ltTITLEgt ltBODYgt in HTML
XML에서 markup은 문서의 출력 형식(display format)이 아니라 문서의
구조와 의미를 정의하기 위해 사용됨
XML
XML vs HTML
ltdlgt
ltdtgtCalifornia love
ltddgtby Tupac
ltulgt
ltligtpublisher R record
ltligtlength 430
ltligtdate 19991010
ltulgt
ltdlgt
ltsonggt
lttitlegtCalifornia lovelttitlegt
ltartistgtTupacltartistgt
ltpublishergtR recordltpublishergt
ltlengthgt430ltlengthgt
ltdategt19991010ltdategt
ltsonggt
XML 문서의 구조와 의미를 지정하
기 위해 사용자가 직접 태그를 정의
해서 사용
HTML 화면 출력 모양을 지정하기
위해 미리 정의된 태그를 이용
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
World Wide Web
Main goal of Human-centric Web
ndash 분산된 문서들의 공유
Technologies
ndash (TCPIP DNS) HTTP URL HTML
World Wide Web
Main goal of Application-centric Web
ndash 분산된 서비스들의 공유
Technologies
ndash (TCPIP DNS) HTTP URL XML SOAP WSDL UDDI
Web Service란
Definition
ndash 네트워크로 연결된 컴퓨터들 사이에 상호운영 가능한 연동방법을
제공하도록 설계된 소프트웨어 시스템
ndash XML Application
ndash 컴퓨터가 처리가능한 형식(WSDL)으로 기술되는 인터페이스를 가짐
ndash SOAP 메시지를 사용하여 통신 및 연동
ndash Service-Oriented Architecture (SOA) 기반 애플리케이션 개발 지원
Web Service란
이종(heterogeneous) 애플리케이션들 사이의 연동 및 통합을 위한
수단
Web Service as Distributed Computing
Architecture
웹 서비스는 다른 분산 컴퓨팅 수단들과 많은 유사성을 가짐
ndash WSDL vs CORBA IDL
ndash SOAP vs JSONXML-RPC
웹의 장점을 이용하기 위해서는 기존 분산 컴퓨팅 방식이
변화되어야 함
ndash 웹은 비연결형(connection-less)
단방향 또는 비동기화된 메시지 이용
기존 기술들은 더 밀결합된(tightly coupled) 시스템을 가정함
ndash 웹은 시스템들이 서로에 대한 사전 지식 없이 연결될 수 있음을
가정함
Web Service의 특징
ndash Open-standard
Supporting organization for standardization W3C OASIS
Supporting software vendors Microsoft IBM Oracle HP Sun
SAP BEA
ndash Go across the Firewalls
Using independent transfer protocol HTTPS SMTP
ndash Service Registry
ndash 플랫폼과 프로그래밍 언어에 독립적
Using XML
ndash Web Service는 CORBA DCOM 등 기존 분산 컴퓨팅 수단들과
유사성을 가지나 Web 기술을 이용하여 기존 애플리케이션들을
느슨하게 결합된(loosely coupled) 형태로 연동 가능케 함
Web Service as Distributed Computing
Architecture
W3C Web Service Activity
8 Working Groups 1 Interest Group
ndash XML Protocol WG (SOAP) (20008 ~)
ndash Web Services Architecture WG (20021 ~ 20041)
ndash Web Services Description WG (WSDL) (20021 ~ 20076)
ndash Web Services Choreography WG (20031 ~)
ndash Semantic Web Services IG (200310 ~)
ndash Web Services Addressing WG (200410 ~)
ndash XML Schema Patterns for Data Binding WG (20053 ~)
ndash Semantic Annotations for WSDL WG (20063 ~)
ndash Web Services Policy WG (20066 ~)
Web Service Core Technologies
XML (Extensible Markup Language)
SOAP (SOAPXML Protocol)
WSDL (Web Services Description Language)
UDDI (Universal Description Discovery and Integration)
HTTP SMTP FTP etc
WS-SecurityWS-Reliable
Messaging
WS-Transactions
WS-Coordination
SOAP
WSDL DAML-S Policy Inspection
WSCI WSCL BPEL4WS
UDDI ebXML
DAML-S OWL-S
Transport
Encoding amp Messaging
Quality of Service
Service Description
Publication amp Discovery
Service Choreography
Semantic Web Service
XML
XML (eXtensible Markup Language)
ndash de facto standard language for data representation and
interchange over the Internet
ndash eXtensible
누구나 새로운 마크업(mark-up)을 정의할 수 있음
ndash Markup Language
문서의 내용(content)에 부가적인 정보를 추가할 수 있는 언어
Main properties of XML
ndash 의미적으로 구조화됨 (semantically structured)
ndash self-describing
XML
Markups in HTML
ndash stylistic markup
eg ltFONTgt ltBgt in HTML
ndash structural markup
eg ltPgt in HTML
ndash semantic markup
eg ltTITLEgt ltBODYgt in HTML
XML에서 markup은 문서의 출력 형식(display format)이 아니라 문서의
구조와 의미를 정의하기 위해 사용됨
XML
XML vs HTML
ltdlgt
ltdtgtCalifornia love
ltddgtby Tupac
ltulgt
ltligtpublisher R record
ltligtlength 430
ltligtdate 19991010
ltulgt
ltdlgt
ltsonggt
lttitlegtCalifornia lovelttitlegt
ltartistgtTupacltartistgt
ltpublishergtR recordltpublishergt
ltlengthgt430ltlengthgt
ltdategt19991010ltdategt
ltsonggt
XML 문서의 구조와 의미를 지정하
기 위해 사용자가 직접 태그를 정의
해서 사용
HTML 화면 출력 모양을 지정하기
위해 미리 정의된 태그를 이용
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
World Wide Web
Main goal of Application-centric Web
ndash 분산된 서비스들의 공유
Technologies
ndash (TCPIP DNS) HTTP URL XML SOAP WSDL UDDI
Web Service란
Definition
ndash 네트워크로 연결된 컴퓨터들 사이에 상호운영 가능한 연동방법을
제공하도록 설계된 소프트웨어 시스템
ndash XML Application
ndash 컴퓨터가 처리가능한 형식(WSDL)으로 기술되는 인터페이스를 가짐
ndash SOAP 메시지를 사용하여 통신 및 연동
ndash Service-Oriented Architecture (SOA) 기반 애플리케이션 개발 지원
Web Service란
이종(heterogeneous) 애플리케이션들 사이의 연동 및 통합을 위한
수단
Web Service as Distributed Computing
Architecture
웹 서비스는 다른 분산 컴퓨팅 수단들과 많은 유사성을 가짐
ndash WSDL vs CORBA IDL
ndash SOAP vs JSONXML-RPC
웹의 장점을 이용하기 위해서는 기존 분산 컴퓨팅 방식이
변화되어야 함
ndash 웹은 비연결형(connection-less)
단방향 또는 비동기화된 메시지 이용
기존 기술들은 더 밀결합된(tightly coupled) 시스템을 가정함
ndash 웹은 시스템들이 서로에 대한 사전 지식 없이 연결될 수 있음을
가정함
Web Service의 특징
ndash Open-standard
Supporting organization for standardization W3C OASIS
Supporting software vendors Microsoft IBM Oracle HP Sun
SAP BEA
ndash Go across the Firewalls
Using independent transfer protocol HTTPS SMTP
ndash Service Registry
ndash 플랫폼과 프로그래밍 언어에 독립적
Using XML
ndash Web Service는 CORBA DCOM 등 기존 분산 컴퓨팅 수단들과
유사성을 가지나 Web 기술을 이용하여 기존 애플리케이션들을
느슨하게 결합된(loosely coupled) 형태로 연동 가능케 함
Web Service as Distributed Computing
Architecture
W3C Web Service Activity
8 Working Groups 1 Interest Group
ndash XML Protocol WG (SOAP) (20008 ~)
ndash Web Services Architecture WG (20021 ~ 20041)
ndash Web Services Description WG (WSDL) (20021 ~ 20076)
ndash Web Services Choreography WG (20031 ~)
ndash Semantic Web Services IG (200310 ~)
ndash Web Services Addressing WG (200410 ~)
ndash XML Schema Patterns for Data Binding WG (20053 ~)
ndash Semantic Annotations for WSDL WG (20063 ~)
ndash Web Services Policy WG (20066 ~)
Web Service Core Technologies
XML (Extensible Markup Language)
SOAP (SOAPXML Protocol)
WSDL (Web Services Description Language)
UDDI (Universal Description Discovery and Integration)
HTTP SMTP FTP etc
WS-SecurityWS-Reliable
Messaging
WS-Transactions
WS-Coordination
SOAP
WSDL DAML-S Policy Inspection
WSCI WSCL BPEL4WS
UDDI ebXML
DAML-S OWL-S
Transport
Encoding amp Messaging
Quality of Service
Service Description
Publication amp Discovery
Service Choreography
Semantic Web Service
XML
XML (eXtensible Markup Language)
ndash de facto standard language for data representation and
interchange over the Internet
ndash eXtensible
누구나 새로운 마크업(mark-up)을 정의할 수 있음
ndash Markup Language
문서의 내용(content)에 부가적인 정보를 추가할 수 있는 언어
Main properties of XML
ndash 의미적으로 구조화됨 (semantically structured)
ndash self-describing
XML
Markups in HTML
ndash stylistic markup
eg ltFONTgt ltBgt in HTML
ndash structural markup
eg ltPgt in HTML
ndash semantic markup
eg ltTITLEgt ltBODYgt in HTML
XML에서 markup은 문서의 출력 형식(display format)이 아니라 문서의
구조와 의미를 정의하기 위해 사용됨
XML
XML vs HTML
ltdlgt
ltdtgtCalifornia love
ltddgtby Tupac
ltulgt
ltligtpublisher R record
ltligtlength 430
ltligtdate 19991010
ltulgt
ltdlgt
ltsonggt
lttitlegtCalifornia lovelttitlegt
ltartistgtTupacltartistgt
ltpublishergtR recordltpublishergt
ltlengthgt430ltlengthgt
ltdategt19991010ltdategt
ltsonggt
XML 문서의 구조와 의미를 지정하
기 위해 사용자가 직접 태그를 정의
해서 사용
HTML 화면 출력 모양을 지정하기
위해 미리 정의된 태그를 이용
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Web Service란
Definition
ndash 네트워크로 연결된 컴퓨터들 사이에 상호운영 가능한 연동방법을
제공하도록 설계된 소프트웨어 시스템
ndash XML Application
ndash 컴퓨터가 처리가능한 형식(WSDL)으로 기술되는 인터페이스를 가짐
ndash SOAP 메시지를 사용하여 통신 및 연동
ndash Service-Oriented Architecture (SOA) 기반 애플리케이션 개발 지원
Web Service란
이종(heterogeneous) 애플리케이션들 사이의 연동 및 통합을 위한
수단
Web Service as Distributed Computing
Architecture
웹 서비스는 다른 분산 컴퓨팅 수단들과 많은 유사성을 가짐
ndash WSDL vs CORBA IDL
ndash SOAP vs JSONXML-RPC
웹의 장점을 이용하기 위해서는 기존 분산 컴퓨팅 방식이
변화되어야 함
ndash 웹은 비연결형(connection-less)
단방향 또는 비동기화된 메시지 이용
기존 기술들은 더 밀결합된(tightly coupled) 시스템을 가정함
ndash 웹은 시스템들이 서로에 대한 사전 지식 없이 연결될 수 있음을
가정함
Web Service의 특징
ndash Open-standard
Supporting organization for standardization W3C OASIS
Supporting software vendors Microsoft IBM Oracle HP Sun
SAP BEA
ndash Go across the Firewalls
Using independent transfer protocol HTTPS SMTP
ndash Service Registry
ndash 플랫폼과 프로그래밍 언어에 독립적
Using XML
ndash Web Service는 CORBA DCOM 등 기존 분산 컴퓨팅 수단들과
유사성을 가지나 Web 기술을 이용하여 기존 애플리케이션들을
느슨하게 결합된(loosely coupled) 형태로 연동 가능케 함
Web Service as Distributed Computing
Architecture
W3C Web Service Activity
8 Working Groups 1 Interest Group
ndash XML Protocol WG (SOAP) (20008 ~)
ndash Web Services Architecture WG (20021 ~ 20041)
ndash Web Services Description WG (WSDL) (20021 ~ 20076)
ndash Web Services Choreography WG (20031 ~)
ndash Semantic Web Services IG (200310 ~)
ndash Web Services Addressing WG (200410 ~)
ndash XML Schema Patterns for Data Binding WG (20053 ~)
ndash Semantic Annotations for WSDL WG (20063 ~)
ndash Web Services Policy WG (20066 ~)
Web Service Core Technologies
XML (Extensible Markup Language)
SOAP (SOAPXML Protocol)
WSDL (Web Services Description Language)
UDDI (Universal Description Discovery and Integration)
HTTP SMTP FTP etc
WS-SecurityWS-Reliable
Messaging
WS-Transactions
WS-Coordination
SOAP
WSDL DAML-S Policy Inspection
WSCI WSCL BPEL4WS
UDDI ebXML
DAML-S OWL-S
Transport
Encoding amp Messaging
Quality of Service
Service Description
Publication amp Discovery
Service Choreography
Semantic Web Service
XML
XML (eXtensible Markup Language)
ndash de facto standard language for data representation and
interchange over the Internet
ndash eXtensible
누구나 새로운 마크업(mark-up)을 정의할 수 있음
ndash Markup Language
문서의 내용(content)에 부가적인 정보를 추가할 수 있는 언어
Main properties of XML
ndash 의미적으로 구조화됨 (semantically structured)
ndash self-describing
XML
Markups in HTML
ndash stylistic markup
eg ltFONTgt ltBgt in HTML
ndash structural markup
eg ltPgt in HTML
ndash semantic markup
eg ltTITLEgt ltBODYgt in HTML
XML에서 markup은 문서의 출력 형식(display format)이 아니라 문서의
구조와 의미를 정의하기 위해 사용됨
XML
XML vs HTML
ltdlgt
ltdtgtCalifornia love
ltddgtby Tupac
ltulgt
ltligtpublisher R record
ltligtlength 430
ltligtdate 19991010
ltulgt
ltdlgt
ltsonggt
lttitlegtCalifornia lovelttitlegt
ltartistgtTupacltartistgt
ltpublishergtR recordltpublishergt
ltlengthgt430ltlengthgt
ltdategt19991010ltdategt
ltsonggt
XML 문서의 구조와 의미를 지정하
기 위해 사용자가 직접 태그를 정의
해서 사용
HTML 화면 출력 모양을 지정하기
위해 미리 정의된 태그를 이용
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Web Service란
이종(heterogeneous) 애플리케이션들 사이의 연동 및 통합을 위한
수단
Web Service as Distributed Computing
Architecture
웹 서비스는 다른 분산 컴퓨팅 수단들과 많은 유사성을 가짐
ndash WSDL vs CORBA IDL
ndash SOAP vs JSONXML-RPC
웹의 장점을 이용하기 위해서는 기존 분산 컴퓨팅 방식이
변화되어야 함
ndash 웹은 비연결형(connection-less)
단방향 또는 비동기화된 메시지 이용
기존 기술들은 더 밀결합된(tightly coupled) 시스템을 가정함
ndash 웹은 시스템들이 서로에 대한 사전 지식 없이 연결될 수 있음을
가정함
Web Service의 특징
ndash Open-standard
Supporting organization for standardization W3C OASIS
Supporting software vendors Microsoft IBM Oracle HP Sun
SAP BEA
ndash Go across the Firewalls
Using independent transfer protocol HTTPS SMTP
ndash Service Registry
ndash 플랫폼과 프로그래밍 언어에 독립적
Using XML
ndash Web Service는 CORBA DCOM 등 기존 분산 컴퓨팅 수단들과
유사성을 가지나 Web 기술을 이용하여 기존 애플리케이션들을
느슨하게 결합된(loosely coupled) 형태로 연동 가능케 함
Web Service as Distributed Computing
Architecture
W3C Web Service Activity
8 Working Groups 1 Interest Group
ndash XML Protocol WG (SOAP) (20008 ~)
ndash Web Services Architecture WG (20021 ~ 20041)
ndash Web Services Description WG (WSDL) (20021 ~ 20076)
ndash Web Services Choreography WG (20031 ~)
ndash Semantic Web Services IG (200310 ~)
ndash Web Services Addressing WG (200410 ~)
ndash XML Schema Patterns for Data Binding WG (20053 ~)
ndash Semantic Annotations for WSDL WG (20063 ~)
ndash Web Services Policy WG (20066 ~)
Web Service Core Technologies
XML (Extensible Markup Language)
SOAP (SOAPXML Protocol)
WSDL (Web Services Description Language)
UDDI (Universal Description Discovery and Integration)
HTTP SMTP FTP etc
WS-SecurityWS-Reliable
Messaging
WS-Transactions
WS-Coordination
SOAP
WSDL DAML-S Policy Inspection
WSCI WSCL BPEL4WS
UDDI ebXML
DAML-S OWL-S
Transport
Encoding amp Messaging
Quality of Service
Service Description
Publication amp Discovery
Service Choreography
Semantic Web Service
XML
XML (eXtensible Markup Language)
ndash de facto standard language for data representation and
interchange over the Internet
ndash eXtensible
누구나 새로운 마크업(mark-up)을 정의할 수 있음
ndash Markup Language
문서의 내용(content)에 부가적인 정보를 추가할 수 있는 언어
Main properties of XML
ndash 의미적으로 구조화됨 (semantically structured)
ndash self-describing
XML
Markups in HTML
ndash stylistic markup
eg ltFONTgt ltBgt in HTML
ndash structural markup
eg ltPgt in HTML
ndash semantic markup
eg ltTITLEgt ltBODYgt in HTML
XML에서 markup은 문서의 출력 형식(display format)이 아니라 문서의
구조와 의미를 정의하기 위해 사용됨
XML
XML vs HTML
ltdlgt
ltdtgtCalifornia love
ltddgtby Tupac
ltulgt
ltligtpublisher R record
ltligtlength 430
ltligtdate 19991010
ltulgt
ltdlgt
ltsonggt
lttitlegtCalifornia lovelttitlegt
ltartistgtTupacltartistgt
ltpublishergtR recordltpublishergt
ltlengthgt430ltlengthgt
ltdategt19991010ltdategt
ltsonggt
XML 문서의 구조와 의미를 지정하
기 위해 사용자가 직접 태그를 정의
해서 사용
HTML 화면 출력 모양을 지정하기
위해 미리 정의된 태그를 이용
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Web Service as Distributed Computing
Architecture
웹 서비스는 다른 분산 컴퓨팅 수단들과 많은 유사성을 가짐
ndash WSDL vs CORBA IDL
ndash SOAP vs JSONXML-RPC
웹의 장점을 이용하기 위해서는 기존 분산 컴퓨팅 방식이
변화되어야 함
ndash 웹은 비연결형(connection-less)
단방향 또는 비동기화된 메시지 이용
기존 기술들은 더 밀결합된(tightly coupled) 시스템을 가정함
ndash 웹은 시스템들이 서로에 대한 사전 지식 없이 연결될 수 있음을
가정함
Web Service의 특징
ndash Open-standard
Supporting organization for standardization W3C OASIS
Supporting software vendors Microsoft IBM Oracle HP Sun
SAP BEA
ndash Go across the Firewalls
Using independent transfer protocol HTTPS SMTP
ndash Service Registry
ndash 플랫폼과 프로그래밍 언어에 독립적
Using XML
ndash Web Service는 CORBA DCOM 등 기존 분산 컴퓨팅 수단들과
유사성을 가지나 Web 기술을 이용하여 기존 애플리케이션들을
느슨하게 결합된(loosely coupled) 형태로 연동 가능케 함
Web Service as Distributed Computing
Architecture
W3C Web Service Activity
8 Working Groups 1 Interest Group
ndash XML Protocol WG (SOAP) (20008 ~)
ndash Web Services Architecture WG (20021 ~ 20041)
ndash Web Services Description WG (WSDL) (20021 ~ 20076)
ndash Web Services Choreography WG (20031 ~)
ndash Semantic Web Services IG (200310 ~)
ndash Web Services Addressing WG (200410 ~)
ndash XML Schema Patterns for Data Binding WG (20053 ~)
ndash Semantic Annotations for WSDL WG (20063 ~)
ndash Web Services Policy WG (20066 ~)
Web Service Core Technologies
XML (Extensible Markup Language)
SOAP (SOAPXML Protocol)
WSDL (Web Services Description Language)
UDDI (Universal Description Discovery and Integration)
HTTP SMTP FTP etc
WS-SecurityWS-Reliable
Messaging
WS-Transactions
WS-Coordination
SOAP
WSDL DAML-S Policy Inspection
WSCI WSCL BPEL4WS
UDDI ebXML
DAML-S OWL-S
Transport
Encoding amp Messaging
Quality of Service
Service Description
Publication amp Discovery
Service Choreography
Semantic Web Service
XML
XML (eXtensible Markup Language)
ndash de facto standard language for data representation and
interchange over the Internet
ndash eXtensible
누구나 새로운 마크업(mark-up)을 정의할 수 있음
ndash Markup Language
문서의 내용(content)에 부가적인 정보를 추가할 수 있는 언어
Main properties of XML
ndash 의미적으로 구조화됨 (semantically structured)
ndash self-describing
XML
Markups in HTML
ndash stylistic markup
eg ltFONTgt ltBgt in HTML
ndash structural markup
eg ltPgt in HTML
ndash semantic markup
eg ltTITLEgt ltBODYgt in HTML
XML에서 markup은 문서의 출력 형식(display format)이 아니라 문서의
구조와 의미를 정의하기 위해 사용됨
XML
XML vs HTML
ltdlgt
ltdtgtCalifornia love
ltddgtby Tupac
ltulgt
ltligtpublisher R record
ltligtlength 430
ltligtdate 19991010
ltulgt
ltdlgt
ltsonggt
lttitlegtCalifornia lovelttitlegt
ltartistgtTupacltartistgt
ltpublishergtR recordltpublishergt
ltlengthgt430ltlengthgt
ltdategt19991010ltdategt
ltsonggt
XML 문서의 구조와 의미를 지정하
기 위해 사용자가 직접 태그를 정의
해서 사용
HTML 화면 출력 모양을 지정하기
위해 미리 정의된 태그를 이용
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Web Service의 특징
ndash Open-standard
Supporting organization for standardization W3C OASIS
Supporting software vendors Microsoft IBM Oracle HP Sun
SAP BEA
ndash Go across the Firewalls
Using independent transfer protocol HTTPS SMTP
ndash Service Registry
ndash 플랫폼과 프로그래밍 언어에 독립적
Using XML
ndash Web Service는 CORBA DCOM 등 기존 분산 컴퓨팅 수단들과
유사성을 가지나 Web 기술을 이용하여 기존 애플리케이션들을
느슨하게 결합된(loosely coupled) 형태로 연동 가능케 함
Web Service as Distributed Computing
Architecture
W3C Web Service Activity
8 Working Groups 1 Interest Group
ndash XML Protocol WG (SOAP) (20008 ~)
ndash Web Services Architecture WG (20021 ~ 20041)
ndash Web Services Description WG (WSDL) (20021 ~ 20076)
ndash Web Services Choreography WG (20031 ~)
ndash Semantic Web Services IG (200310 ~)
ndash Web Services Addressing WG (200410 ~)
ndash XML Schema Patterns for Data Binding WG (20053 ~)
ndash Semantic Annotations for WSDL WG (20063 ~)
ndash Web Services Policy WG (20066 ~)
Web Service Core Technologies
XML (Extensible Markup Language)
SOAP (SOAPXML Protocol)
WSDL (Web Services Description Language)
UDDI (Universal Description Discovery and Integration)
HTTP SMTP FTP etc
WS-SecurityWS-Reliable
Messaging
WS-Transactions
WS-Coordination
SOAP
WSDL DAML-S Policy Inspection
WSCI WSCL BPEL4WS
UDDI ebXML
DAML-S OWL-S
Transport
Encoding amp Messaging
Quality of Service
Service Description
Publication amp Discovery
Service Choreography
Semantic Web Service
XML
XML (eXtensible Markup Language)
ndash de facto standard language for data representation and
interchange over the Internet
ndash eXtensible
누구나 새로운 마크업(mark-up)을 정의할 수 있음
ndash Markup Language
문서의 내용(content)에 부가적인 정보를 추가할 수 있는 언어
Main properties of XML
ndash 의미적으로 구조화됨 (semantically structured)
ndash self-describing
XML
Markups in HTML
ndash stylistic markup
eg ltFONTgt ltBgt in HTML
ndash structural markup
eg ltPgt in HTML
ndash semantic markup
eg ltTITLEgt ltBODYgt in HTML
XML에서 markup은 문서의 출력 형식(display format)이 아니라 문서의
구조와 의미를 정의하기 위해 사용됨
XML
XML vs HTML
ltdlgt
ltdtgtCalifornia love
ltddgtby Tupac
ltulgt
ltligtpublisher R record
ltligtlength 430
ltligtdate 19991010
ltulgt
ltdlgt
ltsonggt
lttitlegtCalifornia lovelttitlegt
ltartistgtTupacltartistgt
ltpublishergtR recordltpublishergt
ltlengthgt430ltlengthgt
ltdategt19991010ltdategt
ltsonggt
XML 문서의 구조와 의미를 지정하
기 위해 사용자가 직접 태그를 정의
해서 사용
HTML 화면 출력 모양을 지정하기
위해 미리 정의된 태그를 이용
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
W3C Web Service Activity
8 Working Groups 1 Interest Group
ndash XML Protocol WG (SOAP) (20008 ~)
ndash Web Services Architecture WG (20021 ~ 20041)
ndash Web Services Description WG (WSDL) (20021 ~ 20076)
ndash Web Services Choreography WG (20031 ~)
ndash Semantic Web Services IG (200310 ~)
ndash Web Services Addressing WG (200410 ~)
ndash XML Schema Patterns for Data Binding WG (20053 ~)
ndash Semantic Annotations for WSDL WG (20063 ~)
ndash Web Services Policy WG (20066 ~)
Web Service Core Technologies
XML (Extensible Markup Language)
SOAP (SOAPXML Protocol)
WSDL (Web Services Description Language)
UDDI (Universal Description Discovery and Integration)
HTTP SMTP FTP etc
WS-SecurityWS-Reliable
Messaging
WS-Transactions
WS-Coordination
SOAP
WSDL DAML-S Policy Inspection
WSCI WSCL BPEL4WS
UDDI ebXML
DAML-S OWL-S
Transport
Encoding amp Messaging
Quality of Service
Service Description
Publication amp Discovery
Service Choreography
Semantic Web Service
XML
XML (eXtensible Markup Language)
ndash de facto standard language for data representation and
interchange over the Internet
ndash eXtensible
누구나 새로운 마크업(mark-up)을 정의할 수 있음
ndash Markup Language
문서의 내용(content)에 부가적인 정보를 추가할 수 있는 언어
Main properties of XML
ndash 의미적으로 구조화됨 (semantically structured)
ndash self-describing
XML
Markups in HTML
ndash stylistic markup
eg ltFONTgt ltBgt in HTML
ndash structural markup
eg ltPgt in HTML
ndash semantic markup
eg ltTITLEgt ltBODYgt in HTML
XML에서 markup은 문서의 출력 형식(display format)이 아니라 문서의
구조와 의미를 정의하기 위해 사용됨
XML
XML vs HTML
ltdlgt
ltdtgtCalifornia love
ltddgtby Tupac
ltulgt
ltligtpublisher R record
ltligtlength 430
ltligtdate 19991010
ltulgt
ltdlgt
ltsonggt
lttitlegtCalifornia lovelttitlegt
ltartistgtTupacltartistgt
ltpublishergtR recordltpublishergt
ltlengthgt430ltlengthgt
ltdategt19991010ltdategt
ltsonggt
XML 문서의 구조와 의미를 지정하
기 위해 사용자가 직접 태그를 정의
해서 사용
HTML 화면 출력 모양을 지정하기
위해 미리 정의된 태그를 이용
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Web Service Core Technologies
XML (Extensible Markup Language)
SOAP (SOAPXML Protocol)
WSDL (Web Services Description Language)
UDDI (Universal Description Discovery and Integration)
HTTP SMTP FTP etc
WS-SecurityWS-Reliable
Messaging
WS-Transactions
WS-Coordination
SOAP
WSDL DAML-S Policy Inspection
WSCI WSCL BPEL4WS
UDDI ebXML
DAML-S OWL-S
Transport
Encoding amp Messaging
Quality of Service
Service Description
Publication amp Discovery
Service Choreography
Semantic Web Service
XML
XML (eXtensible Markup Language)
ndash de facto standard language for data representation and
interchange over the Internet
ndash eXtensible
누구나 새로운 마크업(mark-up)을 정의할 수 있음
ndash Markup Language
문서의 내용(content)에 부가적인 정보를 추가할 수 있는 언어
Main properties of XML
ndash 의미적으로 구조화됨 (semantically structured)
ndash self-describing
XML
Markups in HTML
ndash stylistic markup
eg ltFONTgt ltBgt in HTML
ndash structural markup
eg ltPgt in HTML
ndash semantic markup
eg ltTITLEgt ltBODYgt in HTML
XML에서 markup은 문서의 출력 형식(display format)이 아니라 문서의
구조와 의미를 정의하기 위해 사용됨
XML
XML vs HTML
ltdlgt
ltdtgtCalifornia love
ltddgtby Tupac
ltulgt
ltligtpublisher R record
ltligtlength 430
ltligtdate 19991010
ltulgt
ltdlgt
ltsonggt
lttitlegtCalifornia lovelttitlegt
ltartistgtTupacltartistgt
ltpublishergtR recordltpublishergt
ltlengthgt430ltlengthgt
ltdategt19991010ltdategt
ltsonggt
XML 문서의 구조와 의미를 지정하
기 위해 사용자가 직접 태그를 정의
해서 사용
HTML 화면 출력 모양을 지정하기
위해 미리 정의된 태그를 이용
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
XML
XML (eXtensible Markup Language)
ndash de facto standard language for data representation and
interchange over the Internet
ndash eXtensible
누구나 새로운 마크업(mark-up)을 정의할 수 있음
ndash Markup Language
문서의 내용(content)에 부가적인 정보를 추가할 수 있는 언어
Main properties of XML
ndash 의미적으로 구조화됨 (semantically structured)
ndash self-describing
XML
Markups in HTML
ndash stylistic markup
eg ltFONTgt ltBgt in HTML
ndash structural markup
eg ltPgt in HTML
ndash semantic markup
eg ltTITLEgt ltBODYgt in HTML
XML에서 markup은 문서의 출력 형식(display format)이 아니라 문서의
구조와 의미를 정의하기 위해 사용됨
XML
XML vs HTML
ltdlgt
ltdtgtCalifornia love
ltddgtby Tupac
ltulgt
ltligtpublisher R record
ltligtlength 430
ltligtdate 19991010
ltulgt
ltdlgt
ltsonggt
lttitlegtCalifornia lovelttitlegt
ltartistgtTupacltartistgt
ltpublishergtR recordltpublishergt
ltlengthgt430ltlengthgt
ltdategt19991010ltdategt
ltsonggt
XML 문서의 구조와 의미를 지정하
기 위해 사용자가 직접 태그를 정의
해서 사용
HTML 화면 출력 모양을 지정하기
위해 미리 정의된 태그를 이용
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
XML
Markups in HTML
ndash stylistic markup
eg ltFONTgt ltBgt in HTML
ndash structural markup
eg ltPgt in HTML
ndash semantic markup
eg ltTITLEgt ltBODYgt in HTML
XML에서 markup은 문서의 출력 형식(display format)이 아니라 문서의
구조와 의미를 정의하기 위해 사용됨
XML
XML vs HTML
ltdlgt
ltdtgtCalifornia love
ltddgtby Tupac
ltulgt
ltligtpublisher R record
ltligtlength 430
ltligtdate 19991010
ltulgt
ltdlgt
ltsonggt
lttitlegtCalifornia lovelttitlegt
ltartistgtTupacltartistgt
ltpublishergtR recordltpublishergt
ltlengthgt430ltlengthgt
ltdategt19991010ltdategt
ltsonggt
XML 문서의 구조와 의미를 지정하
기 위해 사용자가 직접 태그를 정의
해서 사용
HTML 화면 출력 모양을 지정하기
위해 미리 정의된 태그를 이용
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
XML
XML vs HTML
ltdlgt
ltdtgtCalifornia love
ltddgtby Tupac
ltulgt
ltligtpublisher R record
ltligtlength 430
ltligtdate 19991010
ltulgt
ltdlgt
ltsonggt
lttitlegtCalifornia lovelttitlegt
ltartistgtTupacltartistgt
ltpublishergtR recordltpublishergt
ltlengthgt430ltlengthgt
ltdategt19991010ltdategt
ltsonggt
XML 문서의 구조와 의미를 지정하
기 위해 사용자가 직접 태그를 정의
해서 사용
HTML 화면 출력 모양을 지정하기
위해 미리 정의된 태그를 이용
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
XML
XML is also a meta-markup-language
ndash 새로운 마크업 언어를 정의할 수 있음
ndash eg DTD XML Schema
ltxml version=ldquo10rdquogt
ltmemo priority=ldquoimportantrdquogt
lttogtJohnlttogt
ltsubjectgtCS1111ltsubjectgt
ltmessagegt
Donrsquot forget to attend the class
ltemphasisgton Fridayltemphasisgt
Good luck to you
ltmessagegt
ltfromgtTomasltfromgt
lt memo gt1048736
ltschema
targetNamespace=ldquohttpwwwexamplecomMemordquo
xmlnsm =ldquohttpwwwexamplecomMemordquo
xmlns=httpwwww3org2001XMLSchemagt
ltelement name=ldquomemoldquo type=ldquommemoTypegt
ltcomplexType name=ldquomemoTypegt
ltsequencegt
ltelement name=ldquoto type=stringgt
ltelement name=ldquosubject type=stringgt
ltelement name=ldquomessage type=ldquommsgTypegt
ltelement name=ldquofrom type= stringgt
ltsequencegt
ltattribute name=ldquopriorityrdquo type=ldquostringrdquogt
ltcomplexTypegt
ltschemagt
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
XML
XML is a family of technologies
httpwwww3orgstandardsxml
ndash Schema DTD XML Schema
ndash Transformation XPath XSLT XSL-FO
ndash Query XPath XQuery
ndash Publishing XSL-FO
ndash Processing XML Pipeline(XProc)
ndash Security XML Encryption XML Signature XKMS
ndash 기타 XML Components
XLink XPointer XInclude XForms etc
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
XML 사용 분야
인터넷 상에서 애플리케이션시스템들 사이의 데이터 표현 및 교환을
위한 산업계 표준 문서 포맷으로 사용됨
ndash Electronic Data Interchange (EDI)
시스템 간 데이터 교환을 위한 공통 포맷으로 사용
ndash Business to Business Integration
기업간 비즈니스 애플리케이션의 통합 (EAI)
XML Web Services
ndash Advanced Information Management System
모든 유형의 데이터 통합 관리
Co-Work
지식관리시스템
ndash Document Publishing Applications
ndash Advanced Search System
구조 검색 상품 카탈로그 검색
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
XML 사용 분야
Electronic Data Interchange
ndash 이기종 시스템 간의 정보 공유를 위한 데이터 교환 프로토콜로 XML
이용
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
XML 사용 분야
Business to Business Integration
ndash 예 Web Services 기술을 이용한 분산 애플리케이션의 연동 및 통합
Simple Object Access Protocol(SOAP)
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
XML 사용 예
XML Data Repository at UW Database Group
ndash httpwwwcswashingtoneduresearchxmldatasets
Word processing formats
ndash Open Document Format httpwwwodfallianceorg
ndash Open Office XML httpwwwopenxmlcommunityorg
Graphics formats
ndash Scalable Vector Graphics(SVG) httpwwww3orgGraphicsSVG
ndash Extensible 3D Graphics (X3D) httpwwwweb3dorg
예httpwwwweb3dorgx3dcontentexamplesX3dResourceshtmlExamples)
RSS(Really Simple Syndication)
ndash 예 httprsspluschosuncom httpnewsgooglecokr httpsectionblognavercom
Messaging
ndash XML-RPC SOAP REST
Programming
ndash Deployment Descriptors in JavaEE(JSP EJB)StrutsSpring applications
ndash UI Layout definition in Android applications
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
History of XML
ISO 1986
ndash SGML(Standard Generalized Markup Language) amp SGML DTD
W3C (WWW Consortium)
ndash XML 10 amp XML DTD (Recommendation) 199802
ndash XML 10 amp XML DTD (Second Edition) 2000
ndash XML Schema 10 2001
ndash XML 10 (Third Edition) 200402
ndash XML 10 (Fourth Edition) 200608
ndash XML 11 (Recommendation) 200402
ndash XML Schema (Second Edition) 200410
ndash XML 11 (Second Edition) 200608
ndash Namespaces in XML 11 (Second Edition) 200608
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Note Maturity levels in W3C
Maturity levels of a technical report in W3C
ndash Working draft (WD)
published for review by the community including W3C Members
the public and other technical organizations
ndash Candidate recommendation (CR)
widely reviewed and satisfies the Working Groups technical
requirements
ndash Proposed recommendation (PR)
W3C has sent to the W3C Advisory Committee for final
endorsement
ndash W3C Recommendation (REC)
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
SOAP
SOAP
ndash Envelope for Web Service communication
ndash 분산 환경에서 구조화된 정보의 교환 및 RPC를 실현하기 위한
light-weight protocol
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
SOAP
SOAP Message Structure
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
SOAP
SOAP Message 예
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
WSDL
WSDL (Web Services Description Language) defines
ndash Web Service Interface
ndash Data amp Message Type
ndash Interaction Pattern
ndash Protocol Mapping
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
WSDL
Example
ndash The GreatH Hotel Reservation Service
uses SOAP 12 as its message format and HTTP as its
transmission protocol
services CheckAvailability functionality
interface reservationInterface
double opCheckAvailability (
Date checkInDate
Date checkOutDate
string roomType )
throws invalidDataFault
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
WSDL
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
WSDL
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
WSDL
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
UDDI
UDDI (Universal Description Discovery and Integration)
ndash XML로 비즈니스 정보를 기술하기 위한 데이터 모델
ndash 비즈니스 정보를 등록(Registration)하고 검색(Discovery)하기 위한
API 제공
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Web Service Architecture
Web Service Roles
1 RegisterPublish2 Discover
3 Invoke Service
- Service Providerrsquos Perspective1 Create functionality
2 Create SOAP service wrapper
3 Create WSDL service description
4 Deploy service
5 Register new service via UDDI
- Service Requesterrsquos Perspective1 Find services via UDDI
2 Retrieve service description file
3 Create SOAP client
4 Invoke remote service
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Web Service Architecture
Web Service Protocol Stack
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Usage Scenario
A travel agent
ndash 고객들에게 통합적인 휴가 패키지 상품을 제공하길 원함
ndash planetrainbus tickets hotels etc
Airlines and hotel chains
ndash 예약을 위한 정보 제공 및 예약 작업 수행
Credit card companies
ndash 고객에 의한 대금 결제를
보장하는 서비스를 제공
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Usage Scenario
Static Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖고 있음
ndash 필요한 웹 서비스를 직접 호출함
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Usage Scenario
Dynamic Discovery
ndash travel agency service는 다른 웹 서비스들에 대한 사전 지식
(WSDL)을 갖지 않음
ndash travel agency service는 먼저 항공사와 호텔들의 리스트를 검색함
travel agency service는 UDDI에게 각 웹 서비스의 필요한
operation들을 호출하는 방법에 대한 기술 사항을 요청함
travel agency service는 각 웹 서비스의 필요한 operation을 요청
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Additional Technologies
Web Services Choreography
ndash 모든 종류의 시스템들 사이의 협업(collaborations) 방법을 기술
ndash WSCL (Conversation Language) WSCI (Choreography Interface)
WS-CDL (Choreography Description Language) BPEL4WS
(Business Process Execution Language for WS)
Web Services Security
ndash SSL HTTPS SAML (Security Authorization Markup Language)
XKMS (XML Key Management Specification) XML Encryption WS-
License WS-Security
Web Services Transactions
ndash BTP (Business Transaction Protocol)
Web Services Messaging
ndash BEEP (Blocks Extensible Exchange Protocol) HTTPR (Reliable
HTTP) WS-Inspection WS-Referral WS-Routing
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Open API
Open API
ndash Sets of technologies that enable web sites to interact with each other
by using SOAP Javascript or any other web technologies
지원 프로토콜
ndash REST
XML data over HTTP
ndash SOAP
ndash XML-RPC
ndash JavaScript AJAX
ndash Atom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Web Services Support in Java EE
Web Services related specifications
ndash Implementing Enterprise Web Services JSR 109
Defines programming model and runtime behavior of Web Services in Java
EE container
ndash Java API for XML-Based Web Services (JAX-WS) 22 JSR 224
Defines a set of APIs and annotations that allow you to build and consume
Web services with Java
ndash Java API for RESTful Web Services (JAX-RS) 11 JSR 311
Defines a set of APIs that promotes the REST architecture style
ndash Java Architecture for XML Binding (JAXB) 22 JSR 222
For representing XML documents as Java artifacts
ndash Web Service Metadata (WS-metadata) for the Java Platform JSR 181
ndash Java API for XML Registries (JAXR) 10 JSR 93
Set of APIs that allow Java clients to access UDDI
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
REST(REpresentational State Transfer)
Concepts
ndash A style of software architecture for distributed hypermedia systems
such as the World Wide Web
ndash REST-style architectures consist of clients and servers
ndash A resource can be essentially any coherent and meaningful concept
that can be addressed by URI
ndash A representation of a resource is typically a document that captures
the current state of a resource
ndash Clients initiate requests to servers servers process requests and
return appropriate responses
Using a stateless communication protocol typically HTTP
ndash Requests and responses are built around the transfer of
representations of resources
Clients and servers exchange representations of resources using
a defined interface and protocol
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
RESTful Web Services
A simple web service implemented using HTTP and the principles
of REST
It is a collection of resources with three defined aspects
ndash base URI for the web service such as httpexamplecomresources
ndash Internet media type of the data supported by the web service
eg XML JSON hellip
ndash set of operations supported by the web service using HTTP methods
eg POST GET PUT or DELETE
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Note SOAP vs REST
SOAP
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Note SOAP vs REST
REST
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Current Web Services (Services amp APIs)
Mashup
ndash a web application that combines data or functionality from two or
more external sources to create a new service
Chicago Crime Map
httpchicagoeveryblockcom
Crime Data
Map Data
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Current Web Services (Services amp APIs)
Mashup Architecture
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash RSS20 RSS10 Atom10 format 사용
ndash Feed를 제공하는 서비스들
Google News Blogspot flickr Wikipedia Facebook Twitter hellip
ndash 예 flickr 의 공개 사진 검색
httpapiflickrcomservicesfeedsphotos_publicgnetags=flower
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Mashups by Feed
Feed를 통한 정보의 Mashup
ndash 예 Yahoo Pipes를 이용하여 네 개의 뉴스 제공자로부터의 검색 결과
feed들을 합성
httppipesyahoocompipespipeinfo_id=qlUkcn1A3BGeWlNQjknRlg
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Mashups by Open API
ProgrammableWeb (httpwwwprogrammablewebcom)
ndash 3008 APIs and 5659 Mashups are registered (March 8 2011)
Popular APIs for Mashups
Top APIs for Mashups
Most Popular APIs
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Mashups by Open API
Popular Mashup Categories
ndash Top mashup tags
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Mashups by Open API
Mashup Examples
ndash Housingmapscom
httpwwwhousingmapscom
Google Maps + Craigslist to create a visual housing search page
via dynamic overlays of Craigslist home listings on Google Maps
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Mashups by Open API
Mashup Examples
ndash Twitter Top News Trends
httptopnewstrendscom
Google trends atom feed is checked regularly
for new trends and Twitter is searched for these
terms
Google Trends + Twitter + Yahoo Term
Extraction
ndash Flickr Lightbox Slideshow
Slideshow of most interesting and recent photos
from flickr using the Lightbox Ajax tools
Flickr
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Flickr Open API
개요
ndash httpwwwflickrcomservicesapi
ndash 32개의 group에 100여개의 API method 제공
Group Activity Favorites Groups People Photos PhotosetsTags hellip
API method in Photos Group
flickrphotosaddTags flickrphotosremoveTag flickrphotossetTags
flickrphotosdelete
flickrphotosgetFavorites
flickrphotosgetInfo
flickrphotosgetRecent
flickrphotosgetSizes
flickrphotosrecentlyUpdated
flickrphotossearch
flickrphotossetDates
etc
ndash 각 API method 마다 parameter 정보 사용자 인증 필요 여부 응답 형태
등에 대한 정보 제공
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Flickr Open API
요청 형식 및 end-point URL
ndash REST - httpapiflickrcomservicesrest
ndash XML-RPC - httpapiflickrcomservicesxmlrpc
ndash SOAP - httpapiflickrcomservicessoap
응답 형식
ndash REST
ndash XML-RPC
ndash SOAP
ndash JSON(JavaScript Object Notation)
ndash 직렬화된 PHP 형식
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Flickr Open API
REST 사용 예
ndash 가장 최근에 업로드된 사진 중 주어진 tag 값으로 태깅된 사진 검색
ndash 요청 URL (HTTP GET 요청)
httpapiflickrcomservicesrestmethod=flickrphotossearchampapi_key=dfccfd29
0d9e710d952ba7ad296f4e47amptags=puppyampper_page=3
ndash 반환 내용 XML 문서
ndash httpwwwflickrcomphotostagspuppy 의 경우 결과는 HTML 문서임
ndash ltphotogt 엘리먼트의 정보로부터 사진 페이지나 사진 파일의 URL을 구할 수 있음
예 사진 페이지 ndash httpwwwflickrcomphotosownerid
ltxml version=10 encoding=utf-8 gt
ltrsp stat=okgt
ltphotos page=1 pages=348557 perpage=3 total=1045671gt
ltphoto id=5508848175 owner=41905335N03 secret=9f1ee1453c server=5216 farm=6
title=Snudd paring nattloumlp ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5509414876 owner=26196388N00 secret=936c96057b server=5299 farm=6
title=1710 Snow in sun ispublic=1 isfriend=0 isfamily=0 gt
ltphoto id=5508816133 owner=26196388N00 secret=40acfa5b89 server=5013 farm=6
title=1714 Snow ispublic=1 isfriend=0 isfamily=0 gt
ltphotosgt
ltrspgt
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Flickr Open API
Programming using REST (in PHP)
ndash httpexamplesmashupguidenetch06flickrsearchphp
1 HTTP request 생성 및 전송
PHP5의 libcurl library 활용 (httpus3phpnetcurl)
function getResource($url)
$chandle = curl_init()
curl_setopt($chandle CURLOPT_URL $url)
curl_setopt($chandle CURLOPT_RETURNTRANSFER 1)
$result = curl_exec($chandle)
curl_close($chandle)
return $result
$url = httpapiflickrcomservicesrestmethod=flickrphotossearchamp
api_key=$api_keyamptags=$tagampper_page=$per_page
$feed = getResource($url)
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Flickr Open API
2 HTTP response에 포함된 XML 데이터 처리
simpleXML library 활용 (httpus3phpnetsimplexml)
$feed = getResource($url)
$xml = simplexml_load_string($feed)
foreach ( $xml-gtphotos-gtphoto as $photo)
$title = $photo[title]
$farmid = $photo[farm] $serverid = $photo[server]
$id = $photo[id]
$secret = $photo[secret]
$owner = $photo[owner]
$thumb_url =
httpfarm$farmidstaticflickrcom$serverid$id_$secret_tjpg
$page_url = httpwwwflickrcomphotos$owner$id
print ltpgtlta href=$page_urlgtltimg alt=$title rc=$thumb_urlgtltagtltpgt
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Geocoder API
개요
ndash httpgeocoderus
ndash 미국 내의 주소나 교차로에 대해 위도 경도 값을 제공
ndash REST-RDF XML-RPC SOAP 인터페이스 제공
ndash WSDL httpgeocoderusdistegclientsGeoCoderPHPwsdl
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Geocoder API
geocode operation 호출 예 (using WS Explorer in Eclipse)
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Geocoder API
ndash SOAP request
ltxml version=10 encoding=UTF-8gt
ltsoapEnvlope xmlnssoap=httpschemasxmlsoaporgsoapenvelopegt
ltsoapHeadergtltsoapHeadergt
ltsoapBodygt
ltgeogeocode xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencodingStyle=httpschemasxmlsoaporgsoapencodinggt
ltlocationgt2855 Telegraph Ave Berkeley CA 94705ltlocationgt
ltgeogeocodegt
ltsoapBodygt
ltsoapEnvlopegt
Operation
Input Message
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Geocoder API
ndash SOAP response
ltxml version=10 encoding=UTF-8gt
ltsoapEnvelope xmlnssoap=httpschemasxmlsoaporgsoapenvelope
xmlnssoapenc=httpschemasxmlsoaporgsoapencoding
soapencodingStyle=httpschemasxmlsoaporgsoapencoding hellip gt
ltsoapBodygt
ltgeocodeResponse xmlns=httprpcgeocoderusGeoCoderUSgt
ltgeoresults xmlnsgeo=httprpcgeocoderusGeoCoderUS
soapencarrayType=geoGeocoderAddressResult[1]
xsitype=soapencArraygt
ltgeoitem xsitype=geoGeocoderAddressResultgt
ltgeonumber xsitype=xsdintgt2855ltgeonumbergt
ltgeolat xsitype=xsdfloatgt37858276ltgeolatgt
ltgeostreet xsitype=xsdstringgtTelegraphltgeostreetgt
ltgeostate xsitype=xsdstringgtCAltgeostategt
ltgeozip xsitype=xsdintgt94705ltgeozipgt
ltgeocity xsitype=xsdstringgtBerkeleyltgeocitygt
ltgeolong xsitype=xsdfloatgt-122260070ltgeolonggt hellip
ltgeoitemgt ltgeoresultsgt ltgeocodeResponsegt
ltsoapBodygt
ltsoapEnvelopegt
Output
Message
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Geocoder API
Programming using WSDLampSOAP (in PHP)
ndash HTTP Request 생성 및 전송
PEARSOAP package 사용 (httppearphpnetpackageSOAP)
주어진 WSDL 문서를 loading하고 parameter를 setting한 후 SOAP
request를 생성 및 전송
$address = 2855 Telegraph Avenue Berkeley CA 94705
$wsdl_url = httpgeocoderusdistegclientsGeoCoderPHPwsdl
$soap = new SOAP_Client($wsdl_url true)
$params = array( location=gt$address )
$results = $soap-gtcall(geocode $params)
print The latitude and longitude for address is
$results[0]-gtlat$results[0]-gtlong
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Naver Open API
개요
ndash httpdevnavercomopenapi
ndash 사용방법
일반 API key와 지도 API key를 발급받아야 함
호출 제한 25000 queries per day
상업적 용도의 활용은 별도의 제휴를 통해 가능
ndash REST 방식으로 구현
Open APIs
ndash 검색API 블로그 카페 웹문서 뉴스
ndash 컨텐츠API 실시간급상승검색어 지식iN 이미지 전문자료
ndash 데이터API 책 영화 영화인 지역 쇼핑 자동차 백과사전
ndash 지도API 자바스크립트 지도 플래시 지도
ndash 기능API 추천검색어 성인검색어 오타변환 등
ndash 미투데이API 글댓글미투친구 등에 대한 목록 검색 읽기 쓰기 등
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Naver Open API
예 1 지역 검색 및 블로그 검색 결과를 지도상에 표시
ndash 지도 API 지역검색 API 및 블로그 검색 API 이용
ndash httpdevnavercomopenapitutorial 참조
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Naver Open API
ndash 지역검색 API를 호출하는 PHP code (일부)
if(strlen($query) gt 0)
$encodedquery = urlencode($query)
$url = httpopenapinavercomsearchquery=$encodedqueryamp
target=localampsort=voteampkey=NAVERKEY
$result = simplexml_load_file($url)
$list = array()
$result = $result-gtchannel
foreach($result-gtitem as $item)
$title = $item-gttitle
$link = $item-gtlink
$desc = $item-gtdescription
$tel = $item-gttelephone
$addr = $item-gtaddress
$mapx = $item-gtmapx
$mapy = $item-gtmapy
hellip
$tmparr = array($title $link $desc $tel $addr $mapx $mapy)
array_push($list $tmparr)
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Naver Open API
예 2 개인 홈페이지에서 네이버 통합 검색 이용
ndash 지식인 웹문서 블로그 도서 쇼핑 검색 등의 Open API를 이용하여
통합 검색 결과 출력 (httpwwwflycokrSearchaspx 참조)
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
Mashup Contest
대한민국 매쉬업 경진대회(httpmashupkoreacom2010contest)
Web Biz Creation Project (httpwebcpkr)
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom
References
Web ServicesW3C httpwwww3org2002ws
httpenwikipediaorgwikiWeb_service
Mark D Hansen SOA 자바 웹 서비스로 통하는 서비스 지향
아키텍처 위키북스 2008
Ramesh Nagappan Java로 개발하는 웹 서비스 사이텍미디어
2004
Raymond Yee 프로 웹 20 매쉬업 위키북스 2009
ProgrammableWeb httpwwwprogrammablewebcom