Hi,
I am trying to post XML messages to the users of a room. I am using the client API sendPublicMessage. However, I noticed the special charters in XML are not handled properly when I receive the message on public message handler. Am I using the right API for this purpose?
Any information is greatly appreciated.
Thanks,
AB
sending a public message as xml
Re: sending a public message as xml
Hi,
Because SFS uses XML based protocol all string that include XML special characters are encoded - for example "<" becomes "<". Is that what you see?
Is this the public message handler on client side or it's the server side one?
Actually depends on the purpose. Why you need to send XML? In general you should be able to send XML messages using public messages without problems.
sakhapour wrote:However, I noticed the special charters in XML are not handled properly
Because SFS uses XML based protocol all string that include XML special characters are encoded - for example "<" becomes "<". Is that what you see?
sakhapour wrote:when I receive the message on public message handler.
Is this the public message handler on client side or it's the server side one?
sakhapour wrote:Am I using the right API for this purpose?
Actually depends on the purpose. Why you need to send XML? In general you should be able to send XML messages using public messages without problems.
-
- Posts: 9
- Joined: 08 May 2009, 03:35
Yes, I have noticed that the message is encoded no matter what. It seems that it is not decoding properly on handler side. Our application needs to send xml messages to users in the room and the user will process that xml appropriately.
I noticed sendObject is encoding as well. They way I got around this for now modified the open source code not to encode. In my source code I am implementing the:
public void handleEvent(SFSEvent event) {
...
}
However, when I send an XML through sendPublicMessage or sendObject it should be decoded properly when the callback gets called on handleEvent but is not getting decoded!!
Am I missing some step or configuration here?
Thanks.
I noticed sendObject is encoding as well. They way I got around this for now modified the open source code not to encode. In my source code I am implementing the:
public void handleEvent(SFSEvent event) {
...
}
However, when I send an XML through sendPublicMessage or sendObject it should be decoded properly when the callback gets called on handleEvent but is not getting decoded!!
Am I missing some step or configuration here?
Thanks.
-
- Posts: 9
- Joined: 08 May 2009, 03:35
Here is the xml I am sending:
<msg t='sys'><body action='setting'><get src='controlfile' name='siteid'/></body></msg>
The followings are the messages send and received through smartfox:
INFO: [Sending]: <msg t ='sys'><body action='pubMsg' r='1'><txt><![CDATA[<msg t='sys'><body action=
pos;setting'><get src='controlfile' name='siteid'/></body></msg> ]]></tx
</body></msg>
INFO: [ RECEIVED ]: <msg t='sys'><body action='pubMsg' r='1'><user id='3928' /><txt><![CDATA[<msg t='sys'
t;<body action='setting'><get src='controlfile' name='siteid'/></body>
t;/msg> ]]></txt></body></msg>, (len: 253)
I can see it is getting encoded on send side, but on receive side some how is not getting decoded.
<msg t='sys'><body action='setting'><get src='controlfile' name='siteid'/></body></msg>
The followings are the messages send and received through smartfox:
INFO: [Sending]: <msg t ='sys'><body action='pubMsg' r='1'><txt><![CDATA[<msg t='sys'><body action=
pos;setting'><get src='controlfile' name='siteid'/></body></msg> ]]></tx
</body></msg>
INFO: [ RECEIVED ]: <msg t='sys'><body action='pubMsg' r='1'><user id='3928' /><txt><![CDATA[<msg t='sys'
t;<body action='setting'><get src='controlfile' name='siteid'/></body>
t;/msg> ]]></txt></body></msg>, (len: 253)
I can see it is getting encoded on send side, but on receive side some how is not getting decoded.
-
- Posts: 9
- Joined: 08 May 2009, 03:35
Return to “Java2SE / Android Client API”
Who is online
Users browsing this forum: No registered users and 19 guests