AMF klassi xaritasi ishlamayapti

Flex 4.5 va Zend_AMF yordamida AMF bitim nuqtasi sifatida ilovani yaratmoqdamiz.

PHP-da CRequest deb nomlangan bir klassni Flex-da so'rov deb nomlangan sinfga xaritalashni xohlayman.

Bu mening php-klassim:

<?php
namespace app\web;

class CRequest{
   public $_explicitType = 'com.site.remote.Request';

   public $stuff1;

   public $stuff2;

}

Ushbu actioncript sinfi: com.site.remote.Request

package com.dreamatique.remoting
{
    [Bindable]
    [RemoteClass(alias="com.site.remote.Request")]
    public class Request
    {

        public var stuff1:String;

        public var stuff2:String;

        public function Request()
        {
        }
    }
}

Sinov bo'lib, so'rovning nima bo'lishidan qat'iy nazar, so'nggi nuqta PHP tarafidan CRequest ning bir nusxasini qaytarib berdim.

Men shunga o'xshash uzoq ob'ekt chaqiruvini bajaraman:

var remoteObject:RemoteObject = new RemoteObject();
remoteObject.endpoint = "http://localhost/to/my/amf/endpoint";
remoteObject.showBusyCursor = true;
remoteObject.source = 'testing';
var op:AbstractOperation = remoteObject.getOperation(null);
op.addEventListener(ResultEvent.RESULT, result);
op.send();

public static function result(event:ResultEvent):void{

    trace(event.result);
    trace(Class(getDefinitionByName(getQualifiedClassName(event.result))));
    Alert.show(event.result.toString());

}

Muammo shundaki, natijalar ObjectProxy deb yoziladi va Request emas. Men noto'g'ri ish qilyapman?

1

2 javoblar

Sizning kodboshingizda sinfga hech bo'lmaganda bitta mos yozuvlaringiz borligiga ishonch hosil qiling.

Bu odatiy tuzoq. Ayniqsa, masofaviy qo'ng'iroqni birinchi marta rivojlantirganda va siz biron-bir joyda biron-bir kodda turini iste'mol qilmasdan oldin.

Agar sinfga havola qilinmagan bo'lsa, u tuzilmadi va shuning uchun ro'yxatga olinmaydi.

Ko'pincha, erta rivojlanish jarayonida, men StaticLinker sinfini yarataman.

public class StaticLinks
{
    private var request:Request;
}

So'ngra buni mening arizamga murojaat qiling:


   var linker:StaticLinks;

BTW - siz avvalgi taxminingizda to'g'risiz: Agar sizda [RemoteObject] deb sinfni izohlaringiz bo'lsa, registerClass() deb chaqirishingiz shart emas.

2
qo'shib qo'ydi
Bu shunday edi! Agar o'ynab o'tirgandan so'ng, men uning misolini yaratgan bo'lsam, sinf sinab ko'rilishini topdim. var test: Request; !
qo'shib qo'ydi muallif F21, manba

Sinfni ro'yxatdan o'tkazishni eslaysizmi?

import flash.net.registerClassAlias;

flash.net.registerClassAlias("com.site.remote.Request", Request);
1
qo'shib qo'ydi
Men o'qiganimdan ( roboncode.com/articles/144 ) va boshqa blog postlarida, kodi> registerClassAlias ​​ ni ishlatish kerak emas, lekin men noto'g'ri bo'lishi mumkin. Ob'ektlar registerClassAlias ​​ dan foydalansam Request deb yozilsa, flash.net.registerClassAlias ​​("asdfsomegibberish", Request) ; , ob'ekt yana ham so'rov sifatida yoziladi.
qo'shib qo'ydi muallif F21, manba
PhP |BotsUz
PhP |BotsUz
93 ishtirokchilar

Phpni o'rganishni Hohlasangiz https://t.me/joinchat/AAAAAE-KRc5dd5tPMmGmWA A'zo bo'lin