2011-02-08 12 views
0

저는 Flex 4 + Spring Blazeds Integration 1.5 + Spring 3.0.5 + jboss-5.1.0.GA에서 실행중인 최대 절전 모드를 사용하여 응용 프로그램을 구축하고 있습니다. 간단한 로그인 양식을 만들고 원격 객체를 통해 문자열을 제출하면 잘 작동합니다. 그러나 Object를 사용하려고하면 간단하지 않습니다. 재밌는 것은 그것이 심지어 경고를 보여주지 않는다는 것입니다! 또한 태그 "RemoteClass"를 제거하면 java로 전송되지만 오류가 발생합니다. Bellow는 코드 및 구성입니다.원격 객체가 작동하지 않습니다.

내 자바 클래스 :

package com.controlefinanceiro.entities; 

// imports 

@Entity 
@Table(name="CF_USER_SISTEMA") 
public class UserSistema implements Serializable{ 
    private static final long serialVersionUID = 1L; 

    @Id 
    @Column(name="USERNAME") 
    private String username; 

    @Column(name="PASSWORD") 
    private String password; 

    /** 
    * Constructor 
    */ 
    public UserSistema(){ 
    } 

    // all getters and setters 
} 

내 플렉스 클래스 :

package com.controlefinanceiro.view.model 
{ 
    [Bindable] 
    [RemoteClass=(alias="com.controlefinanceiro.entities.UserSistema")] 
    public class UserSistema 
    { 
     public var username:String; 
     public var password:String; 
    } 
} 

서비스 - 구성 :

<services-config> 
    <services> 
     <service-include file-path="remoting-config.xml" /> 
    </services> 

    <!-- Spring factory registration --> 
    <factories> 
     <factory id="spring" 
      class="com.controlefinanceiro.controller.SpringFactory" /> 
    </factories> 

    <channels> 
     <channel-definition id="channel-amf" 
      class="mx.messaging.channels.AMFChannel"> 
      <endpoint 
       url="http://localhost:8080/ControleFinanceiroServices/messagebroker/amf" 
       class="flex.messaging.endpoints.AMFEndpoint" /> 
      <properties> 
       <polling-enabled>false</polling-enabled> 
      </properties> 
     </channel-definition> 
    </channels> 

     // rest of config (log, redeploy) 
</services-config> 

원격-설정 :

<adapters> 
     <adapter-definition id="java-object" 
      class="flex.messaging.services.remoting.adapters.JavaAdapter" 
      default="true" /> 
    </adapters> 

    <default-channels> 
     <channel ref="channel-amf" /> 
    </default-channels> 

    <destination id="loginService"> 
     <properties> 
      <factory>spring</factory> 
      <source>loginService</source> 
     </properties> 
    </destination> 
</service> 

Flex 어플리케이션 : 코드에서 가난한 영어와 "포르투갈어"단어

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
       xmlns:s="library://ns.adobe.com/flex/spark" 
       xmlns:mx="library://ns.adobe.com/flex/mx" 
       xmlns:comp="com.controlefinanceiro.view.componentes.*"> 
    <s:layout><s:BasicLayout/></s:layout> 
    <fx:Declarations> 
     <s:RemoteObject id="ro" destination="loginService" showBusyCursor="true" fault="onRemoteFault(event)"/> 
    </fx:Declarations> 
    <fx:Script> 
     <![CDATA[ 
      public function doLogin(event:MouseEvent):void{ 
       Alert.show("login"); 
       var usu:UserSistema = new UserSistema(); 
       Alert.show("user"); 
       //usu.username = user.text; 
       //usu.password = senha.text; 
       //ro.doLogin.addEventListener(ResultEvent.RESULT,onLoginSuccess); 
       //ro.doLogin.addEventListener(FaultEvent.FAULT,onLoginFault); 
       //ro.doLogin(usu); 
      } 
      public function doEcho(event:MouseEvent):void{ 
       Alert.show("echo"); 
       ro.echo.addEventListener(ResultEvent.RESULT,alertResult); 
       ro.echo.addEventListener(FaultEvent.FAULT,onLoginFault); 
       ro.echo(user.text); 
      } 
      // others methods that just do an Alert.show() 
     ]]> 
    </fx:Script> 
    <mx:Canvas width="242" height="141" horizontalCenter="0" verticalCenter="0"> 
     <s:Label id="msg" x="10" y="6"/> 
     <s:Label x="21" y="37" text="Usuario:"/> 
     <s:TextInput id="user" width="134" x="77" y="27"/> 
     <s:Label x="30" y="67" text="Senha:"/> 
     <s:TextInput id="senha" width="133" displayAsPassword="true" x="78" y="57"/> 
     <s:Button label="Login" click="doLogin(event)" id="login" x="165" y="100"/> 
     <s:Button x="113" y="100" label="Echo" click="doEcho(event)"/> 
    </mx:Canvas> 
</s:Application> 

PS : 죄송합니다 : P

감사합니다! Andre

+1

서비스 구성에 하드 코딩 된 URL이 있습니다. 동일한 URL (일명 Localhost?)에서 SWF를 제공하고 있습니까? ServiceCapture 나 Charles 또는 Flash Builder Network 모니터와 같은 프로그램을 사용하여 무엇을주고 받았는지 확인 했습니까? – JeffryHouser

+2

[RemoteClass = (별칭 = "com.controlefinanceiro.entities.UserSistema")] 구문이 잘못되었습니다. [RemoteClass (별칭 ...] –

+0

당신의 의견을 보내 주셔서 감사합니다. 나는 힘든 의도로 URL을 의도적으로 코딩했다. 사실,이 오류는 단지 @ Florian F 코멘트로 간단한 sintax 오류 (만약 당신이 답을 게시하고 싶습니다.) 다시 한번 고마워요! –

답변

0

한눈에, 귀하의 bean과 XML 구성이 올바른 것으로 보입니다.

MXML 파일에서 alertResult 이벤트가 없다는 사실을 알았습니다. 플렉스 사이드에 표시되지 않는 이유가 여기에 있습니다.

시도 당신에 추가 MXML 파일 :

private function alertResult(event:ResultEvent):void 
{ 
    userSistema:UserSistema = new UserSistema(); 
    userSistema = (UserSistema)event.result; 

    Alert.show(userSistema.username, userSistema.password); 
} 
  • 나는 브라질 너무 해요!
관련 문제