XML-RPC

XML-RPC란, RPC 프로토콜의 일종으로서, 인코딩 형식에서는 XML을 채택하고, 전송 방식에서는 HTTP 프로토콜을 사용하고 있다. XML-RPC는 매우 단순한 규약으로서, 작은 데이터 형식이나 명령을 정의하는 정도로만 사용하고 있으며, 사양서도 A4 2매 정도로 꽤나 단순한 편이다. 이건 대다수의 RPC 프로토콜 시스템이 수많은 규격을 규정하고, 실제 사용할 때에도 엄청난 양의 코딩을 요구하는 것과 비교하면 눈에 띄는 특징이라고 할 수 있다.

이 프로토콜은 1998년 데이브 위너(Dave Winer)의 UserLand Software Ltd.가 마이크로소프트와 공동으로 개발하였다. 이후에 이 프로토콜에 좀 더 부가적인 기능을 추가한 SOAP 프로토콜이 개발되었으나, 보통 SOAP 보다 단순하고 사용하기 쉬운 XML-RPC를 더욱 많이 사용하고 있다.

이와 비슷한 RPC 계열 프로토콜로는 JSON-RPC 프로토콜이 존재한다.

자료형

이름 사용 예 설명
array
 <array>
   <data>
     <value><i4>1404</i4></value>
     <value><string>Something here</string></value>
     <value><i4>1</i4></value>
   </data>
 </array>
값의 배열. 키는 포함하지 않음.
base64
<base64>eW91IGNhbid0IHJlYWQgdGhpcyE=</base64>
Base64로 인코딩 된 바이너리 데이터
boolean
<boolean>1</boolean>
논리식 (0 또는 1)
date/time
<dateTime.iso8601>19980717T14:08:55</dateTime.iso8601>
날짜와 시간
double
<double>-12.53</double>
배정밀도 부동소수점
integer
<i4>42</i4>

or

<int>42</int>
정수
string
<string>Hello world!</string>
문자열. XML 파일의 인코딩 형식에 따름.
struct
 <struct>
   <member>
     <name>foo</name>
     <value><i4>1</i4></value>
   </member>
   <member>
     <name>bar</name>
     <value><i4>2</i4></value>
   </member>
 </struct>
키 값을 포함한 값의 배열.
nil
<nil/>
NULL 식별용. XML-RPC 확장

사용 예

XML-RPC Call 형식의 예제

 <?xml version="1.0"?>
 <methodCall>
   <methodName>examples.getStateName</methodName>
   <params>
     <param>
         <value><i4>40</i4></value>
     </param>
   </params>
 </methodCall>

XML-RPC Response 형식의 예제

 <?xml version="1.0"?>
 <methodResponse>
   <params>
     <param>
         <value><string>South Dakota</string></value>
     </param>
   </params>
 </methodResponse>

XML-RPC Fault 형식의 예제

 <?xml version="1.0"?>
 <methodResponse>
   <fault>
     <value>
       <struct>
         <member>
           <name>faultCode</name>
           <value><int>4</int></value>
         </member>
         <member>
           <name>faultString</name>
           <value><string>Too many parameters.</string></value>
         </member>
       </struct>
     </value>
   </fault>
 </methodResponse>

같이 보기

외부 링크

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.