Ticket #286 (new defect)

Opened 7 months ago

Last modified 6 months ago

UnknownClassAlias: flex.messaging.messages.HTTPMessage

Reported by: thijs Owned by: nick
Priority: major Milestone: Flex Messaging
Component: Remoting Version: 0.3.1
Keywords: Cc:

Description (last modified by thijs) (diff)

While trying the following code (see attached swf):

import mx.messaging.messages.HTTPRequestMessage;
public function useRemoteObject():void {
   employeeRO = new RemoteObject();
   employeeRO.destination = "GenericDestination";
   employeeRO.setData.addEventListener("result", getListResultHandler);
   employeeRO.addEventListener("fault", faultHandler);
                
   var test:HTTPRequestMessage = new HTTPRequestMessage();
   test.url = "http://google.nl";
   employeeRO.setData(test);
}

I'm getting this error:

  File "/Users/thijstriemstra/Sites/pyamf/pyamf/trunk/pyamf/amf3.py", line 1067, in _getClassDefinition
    class_def = ClassDefinition(self.readString(), encoding=ref & 0x03)
  File "/Users/thijstriemstra/Sites/pyamf/pyamf/trunk/pyamf/amf3.py", line 548, in __init__
    self.alias = pyamf.get_class_alias(alias)
  File "/Users/thijstriemstra/Sites/pyamf/pyamf/trunk/pyamf/__init__.py", line 807, in get_class_alias
    return load_class(klass)
  File "/Users/thijstriemstra/Sites/pyamf/pyamf/trunk/pyamf/__init__.py", line 743, in load_class
    klass = loader(alias)
  File "/Users/thijstriemstra/Sites/pyamf/pyamf/trunk/pyamf/__init__.py", line 968, in flex_loader
    raise UnknownClassAlias, alias
UnknownClassAlias: flex.messaging.messages.HTTPMessage

And here's a patch that solves the problem:

class HTTPMessage(AbstractMessage):
    """
    HTTP requests are sent to the HTTP endpoint using this message type.

    @ivar contentType: Indicates the content type of this message.
    @type contentType: C{str}
    @ivar method: Indicates what method should be used for the request.
    @type method: C{str}
    @ivar url: Contains the final destination for this request.
    @type url: C{str}
    """

    def __init__(self, *args, **kwargs):
        AbstractMessage.__init__(self, *args, **kwargs)

        self.contentType = kwargs.get('contentType', None)
        self.method = kwargs.get('method', None)
        self.url = kwargs.get('url', None)

for x in (RemotingMessage, ErrorMessage, CommandMessage, AcknowledgeMessage, AsyncMessage, HTTPMessage):
    pyamf.register_class(x, 'flex.messaging.messages.%s' % x.__name__, metadata=['amf3'])
del x

Attachments

Login.swf (226.4 KB) - added by thijs 7 months ago.

Change History

Changed 7 months ago by thijs

  • description modified (diff)

Changed 7 months ago by thijs

  • description modified (diff)

Changed 7 months ago by thijs

Changed 7 months ago by thijs

  • description modified (diff)

Changed 6 months ago by thijs

  • milestone changed from 0.3.2 to Flex Messaging
Note: See TracTickets for help on using tickets.