2009년 8월 4일 화요일

AIR에서 WebORB for PHP 사용

weborb\Weborb\WEB-INF\flex 위치에 remoting-config.xml, services-config.xml를 잘 변경해줘야 쓸 수 있다. services-config.xml에 my-air-amf 라는 게 있어서 봤더니 주소가 틀려서 접속이 안되더라.

 

remoting-config.xml 에 보면 아래와 같은 xml이 있다.

 

    <destination id="GenericAIRDestination">
        <channels>
          <channel ref="my-air-amf"/>
        </channels>   
        <properties>
            <source>*</source>
        </properties>
     </destination>

 

이 remoting-config.xml과 services-config.xml이 뭐 어떻게 꿍짝꿍짝 하나본데 급하게 하느라 WebORB에서 문서를 몇 번 찾아보다가 안보여서 그냥 "되는데 뭐~" 하면서 관뒀다.

 

destination의 id값은 RemoteObject의 destination 프로퍼티 값 혹은 RemoteObject 생성할 때 생성자의 첫 번째 인자로 지정해주는 값이다. source가 만약 com.example.app.FileSystemBrowser로 지정되어 있으면 weborb\Services\com\example\app에 있는 FileSystemBrowser.php 클래스를 사용하게 된다. 기타 다른 클래스가 또 있다면 아래와 같이 지정해주면 된다.

 

flash.net.registerClassAlias("com.example.app.FolderItem", FolderNode);
flash.net.registerClassAlias("com.example.app.FileItem", FileNode);
flash.net.registerClassAlias("com.example.app.FileSystemItem", FileSystemNode);

 

이렇게 해두면 flex에서 원격(WebORB for PHP로 구성된 웹서버)에 있는 SomeMethod(fileNode); 메소드를 호출하면 FileNode 타입을 서버에서 받아 그대로 사용할 수 있다. 어쨌든 비동기라 짜기 귀찮긴 하지만 XML 파싱하고 전송하고 받고 그런거 안하는 게 어디야.

댓글 없음:

댓글 쓰기