1 / 11

Ch.07-5 xml- rpc 사용하기

Ch.07-5 xml- rpc 사용하기. 2008011113 김상엽. 목차. XML-RPC 란 무엇인가 ? XML-RPC 의 형태 예제 소스 분 석. Xml- rpc 란 무엇인가 ?. XML : 웹서비스에서 광범위하게 사용되는 데이터나 문서를 표준화 하기 위하여 사용되는 도구를 말한다 . html 과는 다르게 텍스트로 표현된 데이터를 구조화 하여 전송할 수 있으므로 , 데이터의 재사용과 정보 검색에 있어서 유리하다. Xml- rpc 란 무엇인가 ?.

Download Presentation

Ch.07-5 xml- rpc 사용하기

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ch.07-5xml-rpc사용하기 2008011113 김상엽

  2. 목차 • XML-RPC란 무엇인가? • XML-RPC의 형태 • 예제 소스 분석

  3. Xml-rpc란 무엇인가? • XML : 웹서비스에서광범위하게 사용되는 데이터나 문서를 표준화 하기 위하여 사용되는 도구를 말한다. html과는 다르게 텍스트로 표현된 데이터를 구조화 하여 전송할 수 있으므로, 데이터의 재사용과 정보 검색에 있어서 유리하다.

  4. Xml-rpc란 무엇인가? • RPC : 네트워킹을 할 때, 원격지에 정의된 함수를 다른 로컬 컴퓨터에서 호출하는 것처럼 만든 기술을 말한다. 이 기술은 송수신 프로토콜을 사용하는 스텁을 만들어 통신하므로, 개발자는 내부적인 과정을 몰라도 클라이언트, 서버를 만들어 사용할 수 있다. 클라이언트 Stub Stub 서버

  5. Xml-rpc란 무엇인가? • XML-RPC : 이름 그대로 RPC기술을 이용한 서버와의 통신 과정에서 XML 을 이용하는 기술. 서버와 클라이언트간의 정보가 XML 문서로 만들어져 응답하게 된다. XML 문서 클라이언트 Stub Stub 서버 XML 문서

  6. XMl-rpc의 형태 • <?xml version=“1.0”?> • <methodResponse> 서버의 함수 응답을 의미 • <params> • <param> • <value><i4>11</i4></value> 4바이트의 11이라는 값을 • </param> 가지는 param변수를 의미 • </params> • </method Call>

  7. XMl-rpc의 형태 • <?xml version=“1.0”?> • <methodCall> 클라이언트의 함수 호출을 의미 • <methodName>echo.execute</methodName> 함수이름 • <params> • <param> • <value><i4>11</i4></value> 4바이트의 11이라는 값을 • </param> 가지는 param변수를 의미 • </params> • </method Call>

  8. 예제 • Public class SampleIBMLActivity extends Activity { • private String url=“http://147.46.109.56:10423/”; //접속 서버 정의 • private Stirng HANDLER_NAME=“echo”; //핸들러 이름 정의 • ---- • public void onCreate(Bundle savedInstanceState) { • ---- • connectBtn.setOnClickListener(new OnClickListener() { • public void onClick(View v) { • launch(); //메소드 호출 • } • }_; • ----

  9. 예제 • public void launch() { • try { • IBMLClient client=new IBMLClient(url); //클라이언트 객체 생성 • println(“Client initialized with URL [“ + url + “].\n”); • Vector params=new Vector(); • params.add(“Hello Android Town!”); Vector 객체 생성 • Vector response=null; • response=(Vector)client.execute(HANDLER_NAME+”.execute”, params); // 메소드 호출 • println(“Waiting response …\n”); • processResponse(response); //Vector 객체 처리 • } catch(Exception ex) { • ex.printStackTrace(); • } • }

  10. 예제 • private void processResponse(Vector response) throws IBMLPacketException { • println(“Processing response …\n”); • for(inti=0; i<response.size(); i++) { • Object obj=response.get(i); • if(objinstanceof String) { • String msg=“#” + i + “ (String) : “ + obj; • println(msg); • ---- • } • } • } • private void println(String msg) { • Log.d(TAG, msg);

  11. 예제 • txtMsg.append(“\n” + msg); • } • }

More Related