2011-11-05 12 views
1

私はlocalhost上で完全に動作するflex 4.5 phpアプリケーションを持っています。要するにプロダクションサーバに移動

1. If I am the computer running my localhost, then the production site works. 

2. If I am on any other computer then the production site returns the error: "Send failed Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://localhost/public/gateway.php'" 

は、リリースビルドは、私のローカルホストマシン上のファイルを探している:私は私のリモートホストにアップロードしたとき、私は製品リリースにアクセスしようとすると、私は奇妙な問題に遭遇します。私は間違って何をしていますか?

EDIT:(Flash Builder 4でこの例を試してみると、動作します)リモートビルダーでリリースビルドを実行しようとすると、Flash Builder 4.5 for PHPでのみ問題が発生します。 swfファイルは、ローカルホストからファイルを)つかむと、あなたのローカルホストとリモートのWebサイトにアクセスするには、オフ

<?xml version="1.0" encoding="utf-8"?> 
<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:testclass="services.testclass.*" 
      minWidth="955" minHeight="600"> 
<fx:Script> 
    <![CDATA[ 
     import mx.controls.Alert; 
     import mx.events.FlexEvent; 

     protected function getService(event:FlexEvent):void 
     { 
      label2.text='this function did NOT work'; 
      testFunctionResult.token = testClass.testFunction(); 
     } 

    ]]> 
</fx:Script> 
<fx:Declarations> 
    <s:CallResponder id="testFunctionResult"/> 
    <testclass:TestClass id="testClass" 
         fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" 
         showBusyCursor="true"/> 
    <!-- Place non-visual elements (e.g., services, value objects) here --> 
</fx:Declarations> 
<s:VGroup width="100%" height="100%" x="75"> 
<s:Spacer height="25"/> 
<s:Label fontSize="18" color="Black" text="did this work?"/> 
<s:Label id="label2" color="Blue" 
     creationComplete="getService(event)" text="{testFunctionResult.lastResult}"/> 
</s:VGroup> 

</s:Application> 




<?php 
class TestClass{ 
public function testFunction(){ 
    return "this function worked"; 
} 
} 
?> 

答えて

2

それは本番のように見えるSWFハードlocalhostのURLにコード化されているいくつかのリモート呼び出しを持っている。あなたはする必要がありますそれを見つけてそれを変更してください。

私はRemoteObject、WebService、およびHTTPServiceの呼び出しを見ています。Servicあなたのアプリにコンパイルされたes-configファイル。そこにも見てください。

+0

thx。 Flex 4ではこれは私には起こりませんでした。私が4.5にアップグレードしたときだけです。私はlocalhostがハードコーディングされている場所を見つけることができません。 –

+0

AMF/RemoteObjectを使用していますか?またはHTTPService?またはWebService? – JeffryHouser

+0

php w/ZendFramework –

1

氏Gaga、
私は同じ問題がありました。解決策は、アプリケーション/ WEB-INF/flex/services-config.xmlに相対パスを設定しています。このビデオから解決策を見つけました。http://blog.themidnightcoders.com/index.php/2011/07/26/flex-remoting-urls-and-understanding-the-send-failed-error/

"コンパイラEMBEDS SWFへのチャンネル、エンドポイント、および宛先"のビデオには次のような情報があります。

まず私のチャンネル定義は、このようなものだった:

 <channels> 
      <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"> 
       <endpoint url="http://localhost:8080/applicationRoot/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/> 
      </channel-definition> 
     </channels> 

それから私は、これに変更:

 <channels> 
      <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"> 
       <endpoint url="/applicationRoot/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/> 
      </channel-definition> 
     </channels> 

今私は、リモートマシンからサーバーを接続することができます。

関連する問題