ç®æ¬¡ïŒ
REST察SOAPã ããŒã1ãéããæããŠãã ããã
REST察SOAPã ããŒã2ããã©ãããã©ãŒã éä¿¡ãæŽçããã®ã¯ã©ã®ããã«ç°¡åã§å¹ççã§ããïŒ
ãªãã§ãããªããšïŒ
ã¢ããªã±ãŒã·ã§ã³éãç¹ã«ç°ãªããã©ãããã©ãŒã ã§äœæãããã¢ããªã±ãŒã·ã§ã³éã®çžäºäœçšãå¿ èŠãªã®ã¯ãªãã§ããïŒ ãã¡ãããæããªè³ªåã§ãã ããã°ã©ãã³ã°ã®äžçã§ã¯ãå®å šã«ç¬ç«ããããã€ãã®å Žæãããã³ããã€ãã®å Žæã§ã¯æµå¯Ÿçãªãã©ãããã©ãŒã ãååšãã䞊è¡ããŠéçºãããŠããŸãã ããã«ãèšå€§ãªéã®ãœãããŠã§ã¢ããã§ã«äœæãããæ£åžžã«åäœããŠãããããæ°ãããã©ãããã©ãŒã ããšã«ãœãããŠã§ã¢ãæžãæããããšã¯ãããŸããã éè¡ãäŸã«ãšã£ãŠã¿ãŸãããã 瀟å ã®ãã¹ãŠã®éè¡ããã°ã©ããŒã¯åžžã«JAVAã§èšè¿°ãããŠãããããéè¡ã«ã¯5幎éæ£åžžã«æ©èœãããµãŒãã¹ããããŸããæè¿ãAndroidã®ã»ãŒãã¹ãŠã®ããŒãžã§ã³ã®OSã§å®å®ããŠåäœããçŸããã¢ãã€ã«ã¢ããªã±ãŒã·ã§ã³ãç»å ŽããŸãããããªã³ã倧åŠã§ã¯ãäŸç¶ãšããŠé«åºŠãªãŠã§ãæè¡ïŒjkïŒã®äŸãšããŠç€ºãããŠããŸãã ãããŠä»ãWindowsçšã®ãã¹ã¯ããããã³ãã³ã°ã¢ããªã±ãŒã·ã§ã³ãéçºããã¿ã¹ã¯ããããŸãã éè¡ã¯ã¢ãŠããœãŒã·ã³ã°äŒç€Ÿã«WPFã¢ããªã±ãŒã·ã§ã³ã泚æããŸããã éä¿¡ãã©ãããã©ãŒã ãæŽçããæ¹æ³ã¯ïŒ
ã¡ãã£ãšããæŽå²
äŸããè±ç·ããæŽå²ã«ç®ãåããŸãããã ãµã€ããæžãããã«HTTPãããã³ã«ãç¥ãå¿ èŠããªã.Netã®æ代ã«ããã°ã©ããŒã®ä»²éã«å ãããWinAPIã«ã€ããŠèããããšããªãå®å šã«æ©èœãããã¹ã¯ãããã¢ããªã±ãŒã·ã§ã³ãæžãããšããã§ããã®ã§ãç§ããããè¡ãã®ã¯ããããååã®å€ããããé£ããã§ãããã ã ããããç§ã¯ãã®ãããªé 足ãããããšããŸãã ã¡ã€ã³ãããã¯ããé¢ããªãããã«ãæç«ã®æ代ïŒ1998幎ã«XMLã®åºçŸã«ããæç«ãçµ¶æ» ãããšæ³å®ããŠããŸãïŒãç¹ã«èæ ®ããŸããã 2ã€ã®ã¢ããªã±ãŒã·ã§ã³éã§ç¢ºç«ãããæ¥ç¶ãããã1ã€ããã€ããéä¿¡ãããã1ã€ããã€ããåä¿¡ãããšããŸãã 次ã¯ïŒ ã¢ããªã±ãŒã·ã§ã³ã¯ãããšãã°ãã1ããããã¹ãŠã®é¡§å®¢ã®ãªã¹ããéä¿¡ããããã2 | 36782ã-ãã¯ã©ã€ã¢ã³ã36782ã®ãã©ã³ã¶ã¯ã·ã§ã³ã®ãªã¹ããéä¿¡ãããããšãæå³ããããšã«åæããå¿ èŠããããŸãã ããããäžç代ã®å šçæã«ãã®ãããªããšãèµ·ãã£ãã®ã§ãããã ãã®ãããéçºè ã¯ã¢ããªã±ãŒã·ã§ã³ã®ããåãããšã«æ°ãããã€ã¯ãéçºããå¿ èŠããããŸããã ã€ã³ã¿ãŒãããã®éçºïŒ90幎代åã°ïŒã§ãã¢ããªã±ãŒã·ã§ã³ã¯ãåæãããURLã§åæããã圢åŒã§æ å ±ãæäŸããããšã§æ å ±ã亀æããããšãã§ããŸããïŒåŸã«ãRESTããšåŒã°ããŸãïŒã XML-RPCãåºçŸããåã®ãããã³ã«ãšã¢ããªã±ãŒã·ã§ã³ã®éä¿¡æ¹æ³ -ã³ã¡ã³ããæãããæã人ããããããããªããšããçç±ã ãã§ãç§ã¯æžããŸããã
RPC
RPCã¯ããªã¢ãŒãããã·ãŒãžã£ã³ãŒã«ãã§ãããéåžžã«å€ãæŠå¿µã§ãããå€ä»£ãäžãçŸä»£ã®ãããã³ã«ãçµã¿åãããŠãå¥ã®ã¢ããªã±ãŒã·ã§ã³ã§ã¡ãœãããåŒã³åºãããšãã§ããŸãã XML-RPCã¯ãXMLã®ç»å ŽçŽåŸã®1998幎ã«ç»å Žãããããã³ã«ã§ãã åœåã¯Microsoftã«ãã£ãŠãµããŒããããŠããŸããããããã«Microsoftã¯å®å šã«SOAPã«åãæ¿ããããã.Net Frameworkã§ãã®ãããã³ã«ããµããŒãããã¯ã©ã¹ã¯èŠã€ãããŸããã ããã«ãããããããXML-RPCã¯ããŸã ã«ããŸããŸãªèšèªïŒç¹ã«PHPïŒã«äœãã§ããŸãããæããã«ãã®ã·ã³ãã«ãããéçºè ã®æãç²åŸããŠããŸãã é·ãéå±¥æŽæžã§ç§ãæžããããšãããªããæçµçã«ç解ãããšãã®é¢çœãæãã ããã¯XML-RPCãšç§ã®åŠçã®å±¥æŽæžã§ãã :)
SOAP
SOAPã¯ãMicrosoftã®åªåã«ãã1998幎ã«ãç»å ŽããŸããã ããã¯ããœãããŠã§ã¢ã®äžçã«ãããé©åœãšããŠçºè¡šãããŸããã ããã¯ããã¹ãŠããã€ã¯ããœããã®èšç»ã«åŸã£ãŠãããšããããšã§ã¯ãªãããããã³ã«ã®è€éããšéãã®ããã«éåžžã«å€ãã®æ¹å€ããããŸããã åæã«ãSOAPãçã®çªç Žå£ãšèŠãªã人ãããŸããã ãããã³ã«èªäœã¯é²åãç¶ãã2003幎ã«W3CãSOAP 1.2ãå§åãšããŠæ¿èªãããŸã§ãæ°ããä»æ§ãšæ°ããä»æ§ãå€æ°äœæãããŸããã SOAPãã¡ããªãŒã¯å°è±¡çã§ããããšãå€æããŸãããããã«åœŒãã®å®¶æåçããããŸãïŒ
ïŒåçã§ã¯-WS-AddressingãWS-EnumerationãWS-EventingãWS-TransferãWS-TrustãWS-FederationãWeb Single Sign-On ...ãããŠãå³åŽã®2çªç®ã®ãã®ã¯èŠããŠããŸããïŒ
10幎以äžã«ããã£ãŠãSOAPããããè°è«ã¯åãŸããŸããã§ããã ããã®äœéã®ããã«ã茻茳ãäŸç¶ãšããŠå³ããæ¹å€ãããŠããŸãã ãããããããã³ã«ã¯æ»ã¬ããšã¯ãªãããããå察ã«ãäžçããããææããŸããã§ããã ãããã³ã«ã«å¯Ÿããæ¹å€ã¯ã»ãŒçå®ã§ããHTTPæ©èœã¯äœ¿çšãããã ã¡ãã»ãŒãžã®é·ãã¯RESTãããé·ããªããŸãããããã®WS-Federationããã³WS-AtomicTransactionã®ãã¹ãŠã¯ãå€ãã®å Žå䜿çšãããŸããã
ããããç§ã¯ä»ã®ããšã«çŠç¹ãåœãŠãããšæããŸããSOAPãããã³ã«ãã¡ããªã䜿çšããŠãã©ãã ãè¿ éã«åæ£ã¢ããªã±ãŒã·ã§ã³ãéçºã§ããã®ã§ããããã ããã¯ãã€ã¯ããœãããç§ãã¡ã«çŽæããé©åœã§ã¯ãããŸãããïŒ ç§ã®æèŠã§ã¯ãããã¯åœŒå¥³ã§ãã ã³ãŒãå ã®å±æ§ãä»ã«ã©ãã«é 眮ãããµãŒãã¹ã®[å ¬é]ãã¿ã³ãã¯ãªãã¯ããã¯ã©ã€ã¢ã³ãã®[ãããã·ãçæ]ãã¿ã³ãã¯ãªãã¯ããŠãåããããžã§ã¯ãå ã«ãããã®ããã«ã³ãŒããåŒã³åºããŸããïŒ ãããã£ãŠãæåç·ã¯ããã®ãããªç©èªãã©ã®èšèªãšããã°ã©ãã³ã°ç°å¢ã§å¯èœããšããåé¡ã§ãã ãã®ããŒã¿ãããŒãã«ã«åæžããããšããŸãã
ããããRESTã«ã€ããŠã¯ã©ãã§ããããã
ã¢ãã¬ã¹ããSOAPãžã®ãããããäžèŸã®èšèã«ãããããããç§ã¯RESTã¢ãããŒããäžèŠã§ãããšèšãã€ããã¯æ±ºããŠãããŸããã RESTãšããçšèªã¯2000幎ã«ç»å ŽããŸããã SOAPã®æåã®ããŒãžã§ã³ããããã2幎åŸã ã¢ãããŒãèªäœã¯ã¯ããã«æ©ãçŸãã2000幎ã«åçŽã«å®çŸãææžåãããååã¯é·ããç§ã¯ããªãã«ãã®ãããªæ å ±ãäžããŸããããç解ã§ããªããRESTãã«å€ãããŸããã ååã®ç±æ¥ãšRESTã®ååã«ã€ããŠã¯ã ãã®èšäºã®æåã®éšåã§è©³ãã説æããŸããã ããã§ã¯ãRESTãæé©ã«äœ¿çšãããå Žæãšãã®çç±ã«çŠç¹ãåœãŠãŸãã
- javascriptãã䜿çšããããµãŒãã¹å ã ããã§èšãããšã¯ãããŸããããjavascriptã¯jsonã§ããŸãæ©èœããããããããæäŸããå¿ èŠããããŸãã
- ã¯ã©ã€ã¢ã³ããããã·ãçæããæ¹æ³ããªãèšèªãã䜿çšããããµãŒãã¹ã ããã¯ãããšãã°Objective-Cã§ãã SOAPãšã³ãããŒããæåã§è§£æããå¿ èŠã¯ãããŸãããããã¯å¿ èŠãããŸããã
- éåžžã«é«ãããã©ãŒãã³ã¹èŠä»¶ãããå Žåã ãããã¯éåžžãTwitter APIãGoogle APIãªã©ã®éåžžã«é »ç¹ã«äœ¿çšãããAPIã§ãã
ãããŠãSOAPã䜿çšããå ŽåïŒ
- SOAPã䜿çšããéçºãå éããããŒã«ãååšãããã©ãããã©ãŒã éã§çžäºäœçšãçºçããå Žåã ããšãã°ã.Netããã³Flexãã䜿çšãããSOAPãµãŒãã¹ãJAVAã§èšè¿°ããã®ãé©åã§ãã
- ãã¹ãŠã®SOAPããŒãã®æ©æµãåããããšãã§ããå Žåã ç§ã¯èª°ãããããè¡ãããšãã©ãã«ãããŠä¿¡é Œã§ããæ å ±ãæã£ãŠããŸããã æ確ãªäŸãæãã€ããŸããã
ãããã£ãŠã ãµããŒããããŠããå Žåã¯SOAPã䜿çšããå¿ èŠããããããã§ãªãå Žåã¯RESTã䜿çšããå¿ èŠããããŸã ã ããã«ãããã³ãŒãã詳现ã«è§£æããŠããã«æ°ãããã£ãŒã«ããè¿œå ãã代ããã«ãããµãŒãã¹åç §ã®æŽæ°ããã¿ã³ãã¯ãªãã¯ããã ãã§ãWebãµãŒãã¹ã¯ã©ã€ã¢ã³ãã®éçºãšå€æŽã«ãããæéãå€§å¹ ã«ççž®ãããŸãã
.Netã§ã®RESTãµãŒãã¹ãšSOAPãµãŒãã¹ã®éçºé床ã¯åãã§ãã WCFã§ã¯ãäžè¬çã«SOAPãµãŒãã¹ãRESTfulã«ããŸãã¯ãã®éã®åçŽã§æéã®ãããè©æ¬ºã«ãã£ãŠãã®éã«å€ããããšãã§ããŸãããããã£ãŠãéçºé床ãå éãããšããããšã¯ããµãŒããŒéšåãšåæã«ãããã«åŸã§å®å šã«éçºã§ããã¯ã©ã€ã¢ã³ãéšåãæå³ããŸãå¥ã®äŒç€Ÿã ãµãŒãã¹ã倧èŠæš¡ã§è€éãªããŒã¿æ§é ãåãå ¥ããŠè¿ãå ŽåãSOAPã䜿çšããå©ç¹ã¯å€§ãããªããŸã ã
SOAPã®æ¥ã¯çªå·ä»ããããŠããŸããïŒ
RESTãšSOAPã¯ã©ã¡ããæ£åžžã«äœ¿çšãããããã«ãªããŸããããæ¹è©å®¶ãæžããŠããããã«ãSOAPãå®éã«æ¶æ» ããå¯èœæ§ããããŸãã ç§ã®æèŠã§ã¯ãããã¯ãRESTfulãµãŒãã¹ã®WSDLãŸãã¯åæ§ã®ãããã³ã«ã䜿çšããå§ããã¯ã©ã€ã¢ã³ããããã·ã®çæãå¯èœã«ãªãå Žåã«å¯èœã§ãã ãã®ãããªã¯ãªãŒããããããããã³ã«ã¯WADLãšåŒã°ããŠããŸããããçŸæç¹ã§ã¯ãã®ãããªãã®ã¯ååšããŸããã ãã¡ããããã®ãããªã·ããªãªã§ã¯ãITã®äžçã®å°ãªããšã1人ã®äž»èŠãªãã¬ãŒã€ãŒã®æ¬²æ±ãšãŸãšããªåªåãå¿ èŠã«ãªããŸãããç§ã¯ãã®ãããªãªãã·ã§ã³ãé€å€ããŸããã ãããŠããããã¯ãŒã¯ã¢ãŒããã¯ãã£ã®ã·ã³ãã«ããšå©ç¹ãããã³ã¯ã©ã€ã¢ã³ããããã·ã䜿çšããã¢ããªã±ãŒã·ã§ã³ã€ã³ã¿ã©ã¯ã·ã§ã³ã®èªååãšãã2ã€ã®äžçã®ãã¹ããç²åŸããŸãã
äŸ
èšäºã®æåãããã®äŸãå¿ããŠããŸãããïŒ åœŒã¯äººçããé£ãå»ãããŸããã JAVAã§èšè¿°ãããæ¢åã®ãµãŒãã¹ããããŒã¿ãåä¿¡ããWPFã¢ããªã±ãŒã·ã§ã³ãéçºãããŠããããšãæãåºãããŠãã ããã ãã®èšäºã«åŸã£ãŠãã¹ãŠãçŸããèŠããããã«ã圌ã¯ã©ã®ãã©ãŒãããã§ããŒã¿ãæäŸã§ããŸããïŒ ãããSOAPã§ã ãããŠåœŒã¯jsonãäžããŸãã ãRESTã®æå³ã§ããã¯ã©ã®ãããªjsonãªã®ãããšããèãã誰ãæã£ãŠããªãããšãé¡ã£ãŠããŸãã ãã¡ããREST ïŒ RESTã¯ãåçŽãªXMLãjsonããŸãã¯ãVasyaãæ±ããã圢åŒã§ãã£ãŠããä»ã®èŠæ±ããã圢åŒã§ããŒã¿ãè¿ãããšãã§ããŸãããã ãããã®åœ¢åŒãæšå¥šW3Cæšæºã®1ã€ã«ããããããã«ããïŒ
Content-Type: application/as-Vasya-asked; charset=utf-8
ç§ãã¡ã¯ããžãã¹ããæ°ãåãããŠããŸãã ããŠããã®ãµãŒãã¹ã¯jsonã§ããŒã¿ãè¿ããŸãããäœãç§ãã¡ãè ããã®ã§ããããïŒ ãã ããããã«åé¡ããããŸããã¯ã©ã€ã¢ã³ãã®ãããã·ãçæããããšã¯ã§ããŸããããªã¯ãšã¹ããšããŒã¹ã®åçãæåã§éä¿¡ããå¿ èŠããããŸãã HttpWebRequestãŸãã¯ã¢ããªã³ã䜿çšããå¿ èŠããããŸãã ãããŠãSOAPããããŸã-顧客ã®ãéãç¯çŽãããŸãã
ãããã«
èšèªããã©ãããã©ãŒã ã«é¢ä¿ãªããã¢ããªã±ãŒã·ã§ã³ã®çžäºäœçšã®å šäœåãããªãæŠèª¬ã§ãããšæããŸãã 説æãã3ã€ã®ã¢ãããŒãïŒRESTãXML-RPCãSOAPïŒããã¹ãŠå¯èœãªãªãã·ã§ã³ã§ã¯ãªãããšãä»ãå ããŸããã ããšãã°ããœãŒã·ã£ã«ãããã¯ãŒã¯ïŒFlexã§èšè¿°ãããïŒã®ããã¡ãã¯ããœã±ãããä»ããŠCïŒã§èšè¿°ããããµãŒããŒåŽãžã®çŽæ¥æ¥ç¶ã確ç«ããããšããããããŸãã ãã®ãããæ°ããã¢ããªã±ãŒã·ã§ã³ããšã«ã¢ããããçºæããå¿ èŠæ§ãšãšãã«ãé床ã®åäžãåŸãããŸãã ã©ããã§ãã§ã«...
éèŠãªãã®ãèŠéããå¯èœæ§ããããŸããç¹ã«.Netã«é¢ä¿ããªãå Žåã¯ãããã«ã€ããŠç¥ã£ãŠããããã§ãã
PSæšæ¥ç§ã®ã«ã«ããå¢ãããŠãããint03e ã SSSurkvãš1nd1goã«æè¬ããŸãã