SendMessage eata type mismatch error - WeOnlyDo Discussion board

SendMessage eata type mismatch error (wodXMPP)

by yonko, Friday, October 28, 2011, 09:51 (4773 days ago)

hello again,

when i try to send messaage with the SendMessage method, it always falls to error (data type mismatch)

my VFP code:

oXMPP = CREATEOBJECT( WeOnlyDo.wodXMPPCom )
oSprava = CREATEOBJECT( WeOnlyDo.XMPPMessage )
...
oSprava.Text = test message
oXMPP.SendMessage( test@ventus.sk ,oSprava)
-> OLE error code 0x80020005

I want to use SendMessage method for its ErrorCode property

Re: SendMessage eata type mismatch error

by woddrazen, Friday, October 28, 2011, 10:34 (4773 days ago) @ yonko

Yonko,


Why don't you try to import wodXMPP inside Visual FoxPro on this way
http://www.weonlydo.com/index.asp?kb=1&View=entry&EntryID=44


Drazen

Re: SendMessage eata type mismatch error

by yonko, Friday, October 28, 2011, 14:53 (4773 days ago) @ woddrazen

Yonko,


Why don't you try to import wodXMPP inside Visual FoxPro on this way
http://www.weonlydo.com/index.asp?kb=1&View=entry&EntryID=44


Drazen

... because i'm creating non-visual class for non-visual processes

however, i figure out where is the problem. when i create object oXMPP from WeOnlyDo.wodXMPP (activeX control) instead of WeOnlyDo.wodXMPPCom (COM object), the SendMessage method works. Why the SendMessage method does'n work on wodXMPPCom, i don't know but i expect it should

the second problem is, that the SendMessage.ErrorCode/Text does not handle any error. (for example when i send message to recipient which is Off or doesn't exist or when i try to send message while connection state is <>5). where is the problem now?

Re: SendMessage eata type mismatch error

by woddrazen, Friday, October 28, 2011, 15:15 (4773 days ago) @ yonko

Yonko,


Can you show us maybe your code snippet? Did you maybe check for an error inside Disconnected Event?


Drazen

Re: SendMessage eata type mismatch error

by yonko, Friday, October 28, 2011, 15:59 (4773 days ago) @ woddrazen

Yonko,


Can you show us maybe your code snippet? Did you maybe check for an error inside Disconnected Event?


Drazen


i don't use event handlers. i simply send message and right after i check for XMPPMessage.ErrorCode (just wait for state property turns to 5). i need to know if the message was delivered because if not, i have to send it to someone else. based on the documentation i thought that this property will be applicable to.

Re: SendMessage eata type mismatch error

by woddrazen, Friday, October 28, 2011, 16:05 (4773 days ago) @ yonko

Yonko,


Is there any chance you can show us some code snippet?


Drazen

Re: SendMessage eata type mismatch error

by yonko, Friday, October 28, 2011, 16:18 (4773 days ago) @ woddrazen

of course...

FUNCTION SendMsg
PARAMETRES lcMsg, lcWho
LOCAL oMsg, lnSec
oMsg = NULL
oMsg = CREATEOBJECT( WeOnlyDo.XMPPMessage )
oMsg.Text = ALLTRIM(lcMsg)
THIS.oXMPP.SendMessage(lcWho,oMsg)
lnSec = SECONDS()
DO WHILE THIS.oXMPP.State <> 5 .AND. (SECONDS()-lnSec)<2
DOEVENTS
ENDDO
IF !EMPTY(oSprava.ErrorCode)
DO S_ErrMes WITH (oSprava.ErrorText)
RETURN .F.
ELSE
RETURN .T.
ENDIF

Re: SendMessage eata type mismatch error

by yonko, Friday, October 28, 2011, 16:42 (4773 days ago) @ yonko

sorry, i've done a mistake in the last post. here is the correct code:

[code]
FUNCTION SendMsg
PARAMETRES lcMsg, lcWho
LOCAL oMsg, lnSec
oMsg = NULL
oMsg = CREATEOBJECT( WeOnlyDo.XMPPMessage )
oMsg.Text = ALLTRIM(lcMsg)
THIS.oXMPP.SendMessage(lcWho,oMsg)
lnSec = SECONDS()
DO WHILE THIS.oXMPP.State <> 5 .AND. (SECONDS()-lnSec)<2
DOEVENTS
ENDDO
IF !EMPTY(oMsg.ErrorCode)
DO S_ErrMes WITH (oMsg.ErrorText)
RETURN .F.
ELSE
RETURN .T.
ENDIF
[/code]

Re: SendMessage eata type mismatch error

by wodDamir, Friday, October 28, 2011, 17:25 (4773 days ago) @ yonko

Hi,

There is a possibility that no error was actually given by the server. However, what happens if you check LastError propert (of main wodXMPP object)?

Also, you're using asynchronous approach, and then blocking each call by looping the DoEvents statement. Is there any specific reason why you're doing that? Why not simply use Blocking mode (http://www.weonlydo.com/XMPP/Help/wodXMPP-Blocking.html)?

Regards,
Damba

Re: SendMessage eata type mismatch error

by yonko, Sunday, October 30, 2011, 16:35 (4771 days ago) @ wodDamir

Hi,

There is a possibility that no error was actually given by the server. However, what happens if you check LastError propert (of main wodXMPP object)?

Also, you're using asynchronous approach, and then blocking each call by looping the DoEvents statement. Is there any specific reason why you're doing that? Why not simply use Blocking mode (http://www.weonlydo.com/XMPP/Help/wodXMPP-Blocking.html)?

Regards,
Damba

i understand that when some problems with the server or account or object happens, main wodXMPP object's property LastError holds info about it. but what kind of error is held by wodXMPPMessage's ErrorCode property?

Re: SendMessage eata type mismatch error

by woddrazen, Sunday, October 30, 2011, 19:40 (4771 days ago) @ yonko

Yonko,


This is actually same. You will receive same error inside ErrorText and LastError Property.


Drazen