Punjab does not consistently acknowledge that it is getting messages from strophe - xmpp
First, thank you in advance for taking a look at this problem with me.
I'm currently using strophe.js to connect to Punjab over a BOSH connection, which ultimately forwards the messages to Openfire. I'm prebinding on the server and attaching to the connection with strophe. This works fine initially; I can send and receive messages, and when I get an idle ping I am able to successfully respond. However, after some time, I'm getting disconnected.
After examining the Punjab logs, it seems that I don't always get an httpbind acknowledgement from Punjab when I send a message from strophe. Strophe waits a bout 60 seconds, as it is supposed to, and tries sending the message again - a complete duplicate with the same ID. This makes sense, since it has no idea if Punjab ever got the message since it never acknowledged it. However, for some reason, Punjab gets this duplicate message and thinks that it is a new one with an incorrect RID, and so it increments it's internal RID counter as it would any other message. Furthermore, it forwards the message to the Openfire server AGAIN, though I have not seen this have any significant effect as far as I can tell. Finally, after this has happened a number of times, the RID being used by Strophe falls outside of the RID tolerance window and Punjab returns a 404 Not Found error, and ultimately closes the connection.
My question is, why is Punjab not acknowledging some messages as it should - returning <body xmlns='http://jabber.org/protocol/httpbind'/> to strophe.
This process is detailed with examples from the logs below:
2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1] HEADERS 1340410643.66: Punjab gets a message from the HTTP Bind (this is why we are observing activity in HTTPChannel)
2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=92416C9E3804DF3F6B5661F5B6447314BA070C1FE9BF3D6830AA256AFFA84CAB691B1E3746DBFD4E99692CC18F831C89810CDF256CD12EAF3EA351FEF240605589BE9AE835B9D862265A1672749B5DF9E7AADEE8BEC95006A410CDA5D25271964C9EE065AB968AB3C9521BC9D1059D545FA40575FB477AC3FFDD4F4A702334D2A83C9C90', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1] HTTPB POST : This is the POST message coming from the BOSH connection
2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1] You can see that it is in an httpbind protocol body
<body rid='1211827046' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
<iq type='result' to='codemonkey' id='511-862' xmlns='jabber:client'/>
</body>
2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1] 1211827046
2012-06-22 20:17:23-0400 [HTTPChannel,21,127.0.0.1] Here, Punjab strips the httpbind body and sends the root message directly to OpenFire
SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 => using the direct session connection Punjab has set up for this user (evidenced by the SID).
SEND: "
<iq xmlns='jabber:client' to='codemonkey' type='result' id='511-862'/>"
HOWEVER, HERE WE ARE MISSING THE HTTPBIND CONFIRMATION THAT SHOULD BE SENT BACK TO STROPHE, LETTING IT KNOW THAT THE MESSAGE WAS FORWARDED
THUS, STROPHE SENDS THE SAME MESSAGE AGAIN WITH THE SAME RID, THINKING THAT PUNJAB NEVER GOT THE FIRST ONE.
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] HEADERS 1340410708.95: Punjab gets a message from the HTTP Bind (this is strophes second attempt at sending the message)
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=92416C9E3804DF3F6B5661F5B6447314BA070C1FE9BF3D6830AA256AFFA84CAB691B1E3746DBFD4E99692CC18F831C89810CDF256CD12EAF3EA351FEF240605589BE9AE835B9D862265A1672749B5DF9E7AADEE8BEC95006A410CDA5D25271964C9EE065AB968AB3C9521BC9D1059D545FA40575FB477AC3FFDD4F4A702334D2A83C9C90', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] HTTPB POST :
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1]
<body rid='1211827046' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
<iq type='result' to='codemonkey' id='511-862' xmlns='jabber:client'/>
</body>
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] 1211827046
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1]
SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 => PUNJAB SENDS THIS TO OPENFIRE AS WELL, EVIDENCE THAT PUNJAB FAILS TO DETECT THAT THIS IS A DUPLICATE MESSAGE
SEND: " It seems that Openfire must disregard this, considering that we haven’t seen issues with openfire receiving these messages.
<iq xmlns='jabber:client' to='codemonkey' type='result' id='511-862'/>" and haven’t seen duplicate messages through chat or anything.
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] RETURN HTTPB 1340410708.95:
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] PUNJAB SENDS OUT THE HTTPBIND ACKNOWLEDGEMENT, AS IT SHOULD HAVE THE FIRST TIME.
<body xmlns='http://jabber.org/protocol/httpbind'/>
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] 1211827046
2012-06-22 20:18:28-0400 [HTTPChannel,22,127.0.0.1] 127.0.0.1 - - [23/Jun/2012:00:18:28 +0000] "POST /bosh HTTP/1.1" 200 51 "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"
Since Punjab sees the duplicate request as a new request, it has incremented its internal RID counter for both, meaning we are now off by 1 RID (each message sent from strophe is supposed to increment the RID value by 1). The first few times this happens, the connection remains because Punjab has a tolerance window of about 5. Eventually, we get out of this window, and Punjab closes the connection.
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HEADERS 1340410993.78:
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=0772CAEB889BB1F853371E4153AC6972595A3A548BAE87D3F8D86AFBB5B88B4C0B8FD61F971816D4678388499B0A71E2517048261B07AD393D9EECDA199FA7EA51CBCD17299047473C6B9A9667BAF9367059319B4F0292B57238A0E2DB2AC737B12E530EAAE85732B1070E1F563E7675A82DF41C57A2C705B358328BE477C581D02DC714', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HTTPB POST :
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1]
<body rid='1211827048' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
<iq type='result' to='codemonkey' id='600-864' xmlns='jabber:client'/>
</body>
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 1211827048
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] This rid is invalid 1211827048 1211827052 ITS INTERNAL RID COUNTER HAS INCREASED TO 52 WHILE WE ARE AT 48.
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HTTPB Error 404 The tolerance has been exceeded and the connection is closed.
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 127.0.0.1 - - [23/Jun/2012:00:23:13 +0000] "POST /bosh HTTP/1.1" 404 - "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"
Since Punjab sees the duplicate request as a new request, it has incremented its internal RID counter for both, meaning we are now off by 1 RID (each message sent from strophe is supposed to increment the RID value by 1). The first few times this happens, the connection remains because Punjab has a tolerance window of about 5. Eventually, we get out of this window, and Punjab closes the connection.
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HEADERS 1340410993.78:
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=0772CAEB889BB1F853371E4153AC6972595A3A548BAE87D3F8D86AFBB5B88B4C0B8FD61F971816D4678388499B0A71E2517048261B07AD393D9EECDA199FA7EA51CBCD17299047473C6B9A9667BAF9367059319B4F0292B57238A0E2DB2AC737B12E530EAAE85732B1070E1F563E7675A82DF41C57A2C705B358328BE477C581D02DC714', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HTTPB POST :
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1]
<body rid='1211827048' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
<iq type='result' to='codemonkey' id='600-864' xmlns='jabber:client'/>
</body>
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 1211827048
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] This rid is invalid 1211827048 1211827052 ITS INTERNAL RID COUNTER HAS INCREASED TO 52 WHILE WE ARE AT 48.
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HTTPB Error 404 The tolerance has been exceeded and the connection is closed.
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 127.0.0.1 - - [23/Jun/2012:00:23:13 +0000] "POST /bosh HTTP/1.1" 404 - "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"
Any help would be greatly appreciated. Perhaps I am not fully understanding what Punjab is doing. It seems to me that Punjab gets the message over BOSH from strophe packaged in an httpbind body. It extracts the message from the httpbind body and forwards the bare message to Openfire over the direct session. Finally, it responds to strophe by sending a bare <body xmlns='http://jabber.org/protocol/httpbind'/> message back, letting strophe know that the message was received and dealt with. When messages come in from Openfire, they are shown in the logs under the [XmlStream,client] header as opposed to the [HTTPChannel,21,127.0.0.1] header. These come in from Openfire over the direct session connection, Punjab wraps them in an httpbind body, and forwards them over BOSH to strophe. Strophe then returns an empty <body xmlns='http://jabber.org/protocol/httpbind'/> acknowledging the transaction.
So why is Punjab sometimes failing to acknowledge the message? And why isn't it seeing the duplicate message as a duplicate and just returning the acknowledgement instead of resending it and incrementing it's RID counter erroneously? Again, thank you, thank you, THANK YOU for reading this far. I am at my wits end and any help would be appreciated.
Here is a complete Punjab log of the failure:
2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] HEADERS 1340410782.18:
2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=92416C9E3804DF3F6B5661F5B6447314BA070C1FE9BF3D6830AA256AFFA84CAB691B1E3746DBFD4E99692CC18F831C89810CDF256CD12EAF3EA351FEF240605589BE9AE835B9D862265A1672749B5DF9E7AADEE8BEC95006A410CDA5D25271964C9EE065AB968AB3C9521BC9D1059D545FA40575FB477AC3FFDD4F4A702334D2A83C9C90', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] HTTPB POST :
2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1]
<body rid='1211827046' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
<iq type='result' to='codemonkey' id='511-862' xmlns='jabber:client'/>
</body>
2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] 1211827046
2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] RETURN HTTPB 1340410782.2:
2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1]
<body xmlns='http://jabber.org/protocol/httpbind'>
<iq xmlns='jabber:client' from='codemonkey' type='get' id='64-863' to='MySiteadmin#codemonkey/5da9d909-46e0-4dac-8f02-a4113e6490e5'>
<ping xmlns='urn:xmpp:ping'/>
</iq>
</body>
2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] 1211827046
2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] 127.0.0.1 - - [23/Jun/2012:00:19:42 +0000] "POST /bosh HTTP/1.1" 200 222 "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"
2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] HEADERS 1340410782.34:
2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '190', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=92416C9E3804DF3F6B5661F5B6447314BA070C1FE9BF3D6830AA256AFFA84CAB691B1E3746DBFD4E99692CC18F831C89810CDF256CD12EAF3EA351FEF240605589BE9AE835B9D862265A1672749B5DF9E7AADEE8BEC95006A410CDA5D25271964C9EE065AB968AB3C9521BC9D1059D545FA40575FB477AC3FFDD4F4A702334D2A83C9C90', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] HTTPB POST :
2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1]
<body rid='1211827047' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
<iq type='result' to='codemonkey' id='64-863' xmlns='jabber:client'/>
</body>
2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1] 1211827047
2012-06-22 20:19:42-0400 [HTTPChannel,22,127.0.0.1]
SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 =>
SEND: "
<iq xmlns='jabber:client' to='codemonkey' type='result' id='64-863'/>"
2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1] HEADERS 1340410850.19:
2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '190', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=0772CAEB889BB1F853371E4153AC6972595A3A548BAE87D3F8D86AFBB5B88B4C0B8FD61F971816D4678388499B0A71E2517048261B07AD393D9EECDA199FA7EA51CBCD17299047473C6B9A9667BAF9367059319B4F0292B57238A0E2DB2AC737B12E530EAAE85732B1070E1F563E7675A82DF41C57A2C705B358328BE477C581D02DC714', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1] HTTPB POST :
2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1]
<body rid='1211827047' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
<iq type='result' to='codemonkey' id='64-863' xmlns='jabber:client'/>
</body>
2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1] 1211827047
2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1]
SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 =>
SEND: "
<iq xmlns='jabber:client' to='codemonkey' type='result' id='64-863'/>"
2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1] RETURN HTTPB 1340410850.21:
2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1]
<body xmlns='http://jabber.org/protocol/httpbind'/>
2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1] 1211827047
2012-06-22 20:20:50-0400 [HTTPChannel,21,127.0.0.1] 127.0.0.1 - - [23/Jun/2012:00:20:49 +0000] "POST /bosh HTTP/1.1" 200 51 "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"
2012-06-22 20:22:00-0400 [XmlStream,client]
SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 =>
RECV: '
<iq type="get" id="600-864" from="codemonkey" to="MySiteadmin#codemonkey/5da9d909-46e0-4dac-8f02-a4113e6490e5">
<ping xmlns="urn:xmpp:ping"/>
</iq>'
2012-06-22 20:22:00-0400 [XmlStream,client] RETURN HTTPB 1340410920.62:
2012-06-22 20:22:00-0400 [XmlStream,client]
<body xmlns='http://jabber.org/protocol/httpbind'>
<iq xmlns='jabber:client' from='codemonkey' type='get' id='600-864' to='MySiteadmin#codemonkey/5da9d909-46e0-4dac-8f02-a4113e6490e5'>
<ping xmlns='urn:xmpp:ping'/>
</iq>
</body>
2012-06-22 20:22:00-0400 [XmlStream,client] 1211827047
2012-06-22 20:22:00-0400 [XmlStream,client] 127.0.0.1 - - [23/Jun/2012:00:21:59+0000] "POST /bosh HTTP/1.1" 200 223 "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"
2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] HEADERS 1340410927.48:
2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '190', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=0772CAEB889BB1F853371E4153AC6972595A3A548BAE87D3F8D86AFBB5B88B4C0B8FD61F971816D4678388499B0A71E2517048261B07AD393D9EECDA199FA7EA51CBCD17299047473C6B9A9667BAF9367059319B4F0292B57238A0E2DB2AC737B12E530EAAE85732B1070E1F563E7675A82DF41C57A2C705B358328BE477C581D02DC714', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] HTTPB POST :
2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1]
<body rid='1211827047' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
<iq type='result' to='codemonkey' id='64-863' xmlns='jabber:client'/>
</body>
2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] 1211827047
2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] RETURN HTTPB 1340410927.48:
2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1]
<body xmlns='http://jabber.org/protocol/httpbind'>
<iq xmlns='jabber:client' from='codemonkey' type='get' id='600-864' to='MySiteadmin#codemonkey/5da9d909-46e0-4dac-8f02-a4113e6490e5'>
<pingxmlns='urn:xmpp:ping'/>
</iq>
</body>
2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] 1211827047
2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] 127.0.0.1 - - [23/Jun/2012:00:22:06 +0000] "POST /bosh HTTP/1.1" 200 223 "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"
2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] HEADERS 1340410927.67:
2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=0772CAEB889BB1F853371E4153AC6972595A3A548BAE87D3F8D86AFBB5B88B4C0B8FD61F971816D4678388499B0A71E2517048261B07AD393D9EECDA199FA7EA51CBCD17299047473C6B9A9667BAF9367059319B4F0292B57238A0E2DB2AC737B12E530EAAE85732B1070E1F563E7675A82DF41C57A2C705B358328BE477C581D02DC714', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] HTTPB POST :
2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1]
<body rid='1211827048' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
<iq type='result' to='codemonkey' id='600-864' xmlns='jabber:client'/>
</body>
2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1] 1211827048
2012-06-22 20:22:07-0400 [HTTPChannel,21,127.0.0.1]
SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 =>
SEND: "
<iq xmlns='jabber:client' to='codemonkey' type='result' id='600-864'/>"
2012-06-22 20:22:12-0400 [-]
SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 =>
SEND: ' '
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HEADERS 1340410993.78:
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] {'origin': 'http://172.16.160.246', 'content-length': '191', 'accept-language': 'en-US,en;q=0.8', 'accept-encoding': 'gzip,deflate,sdch', 'x-forwarded-host': '172.16.160.246', 'x-forwarded-for': '172.16.122.9', 'host': '127.0.0.1:5280', 'accept': '*/*', 'user-agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5', 'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'connection': 'Keep-Alive', 'referer': 'http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486', 'cookie': 'ASP.NET_SessionId=c4ioeuw2azw21lkedv0nbwlt; .MySiteUniqueCookie=0772CAEB889BB1F853371E4153AC6972595A3A548BAE87D3F8D86AFBB5B88B4C0B8FD61F971816D4678388499B0A71E2517048261B07AD393D9EECDA199FA7EA51CBCD17299047473C6B9A9667BAF9367059319B4F0292B57238A0E2DB2AC737B12E530EAAE85732B1070E1F563E7675A82DF41C57A2C705B358328BE477C581D02DC714', 'x-forwarded-server': 'CODEMONKEY.mydomain.com', 'content-type': 'application/xml'}
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HTTPB POST :
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1]
<body rid='1211827048' xmlns='http://jabber.org/protocol/httpbind' sid='fb03e4779f4b9a4fe15fbf09d5905f455cc54919'>
<iq type='result' to='codemonkey' id='600-864' xmlns='jabber:client'/>
</body>
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 1211827048
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] This rid is invalid 1211827048 1211827052
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] HTTPB Error 404
2012-06-22 20:23:13-0400 [HTTPChannel,22,127.0.0.1] 127.0.0.1 - - [23/Jun/2012:00:23:13 +0000] "POST /bosh HTTP/1.1" 404 - "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"
2012-06-22 20:23:23-0400 [XmlStream,client]
SID: fb03e4779f4b9a4fe15fbf09d5905f455cc54919 =>
RECV: '
<iq type="get" id="180-865" from="codemonkey" to="MySiteadmin#codemonkey/5da9d909-46e0-4dac-8f02-a4113e6490e5">
<ping xmlns="urn:xmpp:ping"/>
</iq>'
2012-06-22 20:23:23-0400 [XmlStream,client] RETURN HTTPB 1340411003.49:
2012-06-22 20:23:23-0400 [XmlStream,client]
<body xmlns='http://jabber.org/protocol/httpbind'>
<iq xmlns='jabber:client' from='codemonkey' type='get' id='180-865' to='MySiteadmin#codemonkey/5da9d909-46e0-4dac-8f02-a4113e6490e5'>
<ping xmlns='urn:xmpp:ping'/>
</iq>
</body>
2012-06-22 20:23:23-0400 [XmlStream,client] 1211827048
2012-06-22 20:23:23-0400 [XmlStream,client] 127.0.0.1 - - [23/Jun/2012:00:23:23+0000] "POST /bosh HTTP/1.1" 200 223 "http://172.16.160.246/MySite/Viewers/InteractiveView?programGuideId=486" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5"
As it turns out, my understanding of Punjab was flawed. The empty <body xmlns='http://jabber.org/protocol/httpbind'/> messages are not actually for acknowledging messages over the BOSH connection. As BOSH uses the long polling technique, the client initializes the connection with an empty httpbind body. The server holds this connection open for the duration of the wait time specified - i.e. 60 seconds. If no messages have been received by that 60 second mark, the server closes the connection by responding with an empty httpbind body, and the client reopens a new one by sending another empty body to the server.
My problem stems from the fact that I was initializing the prebind connection in C# with the MatriX library. It's default wait time for the connection to be held open is 300 seconds. Thus, it sets up the connection with punjab to close connections after 300 seconds. HOWEVER, strophe's default wait time is 60 seconds. When I attached to the existing MatriX connection with strophe, strophe became confused since punjab wasn't releasing the connection in 60 seconds as it expected.
The fix was to change the strophe wait time to 300 seconds to match the MatriX set up conditions.
Related
XMPP / Ejabberd: Why does the roster item is always ask='subscribe'?
The roster of user "john#localhost" is <iq xmlns="jabber:client" xml:lang="en" to="john#localhost/2182919552157840751291" from="john#localhost" type="result" id="56c73b295y"> <query xmlns="jabber:iq:roster"> <item subscription="both" jid="johnna#localhost"/> </query> </iq> But the roster of user "johnna#localhost" is <iq xmlns="jabber:client" xml:lang="en" to="johnna#localhost/15960489746475669037996" from="johnna#localhost" type="result" id="56c73b295y"> <query xmlns="jabber:iq:roster"> <item ask="subscribe" jid="john#localhost"/> </query> </iq> How it's possible ? Why item is ask="subscribe" when john has both subscription ? Step to reproduce eJabberd version: ejabberd/ecs:20.01 john#localhost send stanza: <presence type="subscribe" to="johnna#localhost" id="test1" /> johnna#localhost reply with: <presence type="subscribed" to="john#localhost" id="test1" /> Then send: <presence type="subscribe" to="john#localhost" id="test2" /> Finally, john#localhost reply: <presence type="subscribed" to="johnna#localhost" id="test2" /> Roster iq received by john is <iq xmlns="jabber:client" xml:lang="en" to="johnna#localhost/15960489746475669037996" from="johnna#localhost" type="set" id="56c73b295y"> <query xmlns="jabber:iq:roster"> <item subscription="both" jid="johnna#localhost"/> </query> </iq> But johnna received: <iq xmlns="jabber:client" xml:lang="en" to="johnna#localhost/15960489746475669037996" from="johnna#localhost" type="set" id="56c73b295y"> <query xmlns="jabber:iq:roster"> <item ask="subscribe" jid="john#localhost"/> </query> </iq> modules enabled modules: mod_admin_extra: {} mod_block_strangers: {} mod_blocking: {} mod_client_state: {} mod_http_api: {} mod_last: {} mod_mam: default: always mod_offline: access_max_user_messages: max_user_offline_messages mod_privacy: {} mod_roster: {}
SIPp: Cancel scenario 487 before 200
I'm trying to simulate how to deal when 487 comes before 200 in cancel scenario. But i get "Aborting call on unexpected message for Call-Id while sending (index 5), received 'ACK sip:service#192.168.1.20:5060 SIP/2.0" error. this is my server. <scenario name="Basic UAS responder"> <recv request="INVITE" crlf="true"> </recv> <send> <![CDATA[ SIP/2.0 100 Trying [last_Via:] [last_From:] [last_To:] [last_Call-ID:] [last_CSeq:] Contact: <sip:[local_ip]:[local_port];transport=[transport]> Content-Length: [len] ]]> </send> <send> <![CDATA[ SIP/2.0 180 Ringing [last_Via:] [last_From:] [last_To:];tag=[call_number] [last_Call-ID:] [last_CSeq:] Contact: <sip:[local_ip]:[local_port];transport=[transport]> Content-Length: [len] ]]> </send> <recv request="CANCEL"> </recv> <send> <![CDATA[ SIP/2.0 487 Request Terminated [last_Via:] [last_From:] [last_To:] [last_Call-ID:] CSeq: [cseq] INVITE Contact: <sip:[local_ip]:[local_port];transport=[transport]> Content-Length: [len] ]]> </send> <send> <![CDATA[ SIP/2.0 200 OK [last_Via:] [last_From:] [last_To:] [last_Call-ID:] [last_CSeq:] Contact: <sip:[local_ip]:[local_port];transport=[transport]> Content-Length: [len] ]]> </send> <!--pause milliseconds="4000"/--> <recv request="ACK" crlf="true"> </recv> </scenario> this is my client <scenario name="UAC Cancel"> <send retrans="500"> <![CDATA[ INVITE sip:[service]#[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] To: <sip:[service]#[remote_ip]:[remote_port]> From: <sip:sipp#[local_ip]:[local_port]; tag=[call_number] Call-ID: [call_id] CSeq: [cseq] INVITE Contact: sip:sipp#[local_ip]:[local_port] Max-Forwards: 70 Content-Length: [len] ]]> </send> <recv response="100" optional="true"> </recv> <recv response="180"> </recv> <pause milliseconds="4000"/> <send> <![CDATA[ CANCEL sip:[service]#[remote_ip]:[remote_port] SIP/2.0 [last_Via:] To: sip:[service]#[local_ip]:[local_port]>[peer_tag_param] From: sip:sipp#[local_ip]:[local_port];tag=[call_number] Call-ID: [call_id] [last_CSeq:] Contact: sip:sipp#[local_ip]:[local_port] Max-Forwards: 70 Content-length: [len] ]]> </send> <recv response="200" optional="true"> </recv> <recv response="487" next="cancelACK"> </recv> <label id="cancelACK"/> <send> <![CDATA[ ACK sip:[service]#[remote_ip]:[remote_port] SIP/2.0 [last_Via:] To: <sip:[service]#[remote_ip]:[remote_port]>[peer_tag_param] From: <sip:sipp#[local_ip]:[local_port];tag=[call_number] Call-ID: [call_id] CSeq: [cseq] ACK Contact: sip:sipp#[local_ip]:[local_port] Max-Forwards: 70 Content-Length: [len] ]]> </send> <pause milliseconds="3000"/> </scenario>
Looks to me like you'll have a problem with the way your are using [last_Via:]. The CANCEL request from the UAC should have a new branch parameter in its Via header since it's a new transaction. Also the OK response to the INVITE request being generated by the UAS is going to use the Via header from the CANCEL request. Since the Via header is critical for SIP transaction matching it's understandable that sipp is complaining when it is not able to match things up properly.
REST Service returns CORS? error - ColdFusion
I create a REST service in CF11 and up until last night everything was working fine until I started getting CORS errors all over the place. Long story short this is my code: <cfcomponent rest="true" restPath="/testimonials"> <cffunction name="getTestimonials" access="remote" returntype="any" httpMethod="GET" restPath="/getTestimonials"> <cfargument name="showRatings" type="numeric" restArgSource="Query" default="0"> <cfargument name="siteID" type="numeric" restArgSource="Query" default="0"> <cfargument name="pageID" type="numeric" restArgSource="Query" default="0"> ..... And I am calling it like this <cfhttp url="http://dev.example.com/rest/api/testimonials/getTestimonials" method="GET" result="res"> <cfhttpparam type="URL" name="showRatings" value="0"> <cfhttpparam type="URL" name="siteID" value="17"> <cfhttpparam type="URL" name="pageID" value="2"> </cfhttp> <cfdump var="#res#"> And this is the return struct that I am getting back struct Charset [empty string] ErrorDetail [empty string] Filecontent [empty string] Header HTTP/1.1 200 OK Access-Control-Allow-Methods: POST,GET,OPTIONS Date: Wed, 23 Sep 2015 08:14:02 GMT Content-Length: 0 Access-Control-Allow-Headers: Content-Type Access-Control-Allow-Origin: * Server: Microsoft-IIS/8.0 X-Powered-By: ASP.NET server-error: true Mimetype Unable to determine MIME type of file. Responseheader struct Access-Control-Allow-Headers Content-Type Access-Control-Allow-Methods POST,GET,OPTIONS Access-Control-Allow-Origin * Content-Length 0 Date Wed, 23 Sep 2015 08:14:02 GMT Explanation OK Http_Version HTTP/1.1 Server Microsoft-IIS/8.0 Status_Code 200 X-Powered-By ASP.NET server-error true Statuscode 200 OK Text YES Nothing Changed as far as I know code-wise or on my IIS server to justify this error. I even added the code below in my web.config to try and enable CORS <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="*"/> <add name="Access-Control-Allow-Headers" value="Content-Type"/> <add name="Access-Control-Allow-Methods" value="POST,GET,OPTIONS"/> </customHeaders> </httpProtocol> </system.webServer> </configuration>
How to create conference rooms in Openfire with XMPPHP?
I'm developing a system which at some point I'll have to allow users to create their own conference rooms. I was reading about create rooms and wrote some code with XMPP which results in the verbose log below. 1422017436 [VERBOSE]: Socket is ready; send it. 1422017436 [VERBOSE]: SENT: <presence from='24527#localhost/xmpphp' to='sala3#myconference.localhost/xmpphp'><x xmlns='http://jabber.org/protocol/muc'/></presence> 1422017436 [VERBOSE]: Successfully sent 134 bytes. 1422017436 [VERBOSE]: Socket is ready; send it. 1422017436 [VERBOSE]: SENT: <iq from='24527#localhost/xmpphp' id='create1' to='sala3#myconference.localhost/xmpphp' type='set'><query xmlns='http://jabber.org/protocol/muc#owner'><x xmlns='jabber:x:data' type='submit'/></query></iq> 1422017436 [VERBOSE]: Successfully sent 203 bytes. 1422017436 [VERBOSE]: Disconnecting... 1422017436 [VERBOSE]: Socket is ready; send it. 1422017436 [VERBOSE]: SENT: </stream:stream> 1422017436 [VERBOSE]: Successfully sent 16 bytes. 1422017436 [VERBOSE]: RECV: <presence from="sala3#myconference.localhost/xmpphp" to="24527#localhost/xmpphp"><x xmlns="http://jabber.org/protocol/muc#user"><item jid="24527#localhost/xmpphp" affiliation="owner" role="moderator"/><status code="110"/><status code="100"/><status code="201"/></x></presence> 1422017436 [DEBUG]: Calling presence_handler 1422017436 [DEBUG]: Presence: sala3#myconference.localhost/xmpphp [available] 1422017436 [DEBUG]: EVENT: presence 1422017436 [VERBOSE]: RECV: <iq type="result" id="create1" from="sala3#myconference.localhost/xmpphp" to="24527#localhost/xmpphp"/> 1422017436 [VERBOSE]: RECV: </stream:stream> 1422017436 [DEBUG]: EVENT: end_stream It seems to be working, as I can read here: 1422017436 [DEBUG]: Calling presence_handler 1422017436 [DEBUG]: Presence: sala3#myconference.localhost/xmpphp [available] 1422017436 [DEBUG]: EVENT: presence 1422017436 [VERBOSE]: RECV: <iq type="result" id="create1" from="sala3#myconference.localhost/xmpphp" to="24527#localhost/xmpphp"/> 1422017436 [VERBOSE]: RECV: </stream:stream> But I cannot find the sala3 room in Openfire Panel. Is there anything wrong with my SENT packets? Thanks.
It is still ugly, but it worked. I added it to XMPP.php public function createGroup() { $out = "<presence from='24527#localhost/xmpphp' to='sala4#myconference.localhost/xmpphp'><x xmlns='http://jabber.org/protocol/muc'/></presence>"; $this->send($out); } public function createGroup2() { $out = "<iq from='24527#localhost/desktop' id='create1' to='sala4#myconference.localhost/xmpphp' type='get'> <query xmlns='http://jabber.org/protocol/muc#owner'/> </iq>"; $this->send($out); } public function sendConfigRoom() { $out = "<iq from='24527#localhost/desktop' id='create2' to='sala4#myconference.localhost/xmpphp' type='set'> <query xmlns='http://jabber.org/protocol/muc#owner'> <x xmlns='jabber:x:data' type='submit'> <field var='FORM_TYPE'> <value>http://jabber.org/protocol/muc#roomconfig</value> </field> <field var='muc#roomconfig_roomname'> <value>A Dark Cave</value> </field> <field var='muc#roomconfig_roomdesc'> <value>The place for all good witches!</value> </field> <field var='muc#roomconfig_enablelogging'> <value>0</value> </field> <field var='muc#roomconfig_changesubject'> <value>1</value> </field> <field var='muc#roomconfig_allowinvites'> <value>0</value> </field> <field var='muc#roomconfig_allowpm'> <value>anyone</value> </field> <field var='muc#roomconfig_maxusers'> <value>10</value> </field> <field var='muc#roomconfig_publicroom'> <value>0</value> </field> <field var='muc#roomconfig_persistentroom'> <value>1</value> </field> <field var='muc#roomconfig_moderatedroom'> <value>0</value> </field> <field var='muc#roomconfig_membersonly'> <value>0</value> </field> <field var='muc#roomconfig_passwordprotectedroom'> <value>1</value> </field> <field var='muc#roomconfig_roomsecret'> <value>cauldronburn</value> </field> <field var='muc#roomconfig_whois'> <value>moderators</value> </field> <field var='muc#maxhistoryfetch'> <value>50</value> </field> <field var='muc#roomconfig_roomadmins'> <value>24527#localhost</value> </field> </x> </query> </iq> "; $this->send($out); } And my createGroup.php: <?php // activate full error reporting //error_reporting(E_ALL & E_STRICT); error_reporting(E_ALL); ini_set('display_errors', 'On'); include 'XMPPHP/XMPP.php'; // load the image from filesystem #Use XMPPHP_Log::LEVEL_VERBOSE to get more logging for error reports #If this doesn't work, are you running 64-bit PHP with < 5.2.6? $conn = new XMPPHP_XMPP('myserver', 5222, '24527', 'my pw', 'xmpphp', 'localhost', $printlog=true, $loglevel=XMPPHP_Log::LEVEL_VERBOSE); $conn->connect(); $conn->processUntil('session_start'); $conn->useEncryption(false); $conn->createGroup(); $conn->processUntil('presence'); $conn->createGroup2(); $conn->processUntil('result'); $conn->sendConfigsRoom(); #$conn->processUntil(array('result', 'error')); $conn->disconnect();
Making SOAP call using Perl's SOAP::Lite and a WSDL file
I want to make a SOAP call to a local web service. The web service is defined via a WSDL file (see below). I want to use Perl and SOAP::Lite. I tried this: use strict ; use warnings ; use SOAP::Lite ; my $endpoint = qq{http://example.com:2222/orawsv/PS_API/ACCOUNT_WS} ; my $tns = 'http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS' ; my $method_urn = $tns ; my $soapaction = $tns ; my $method = 'GET_BY_ACCOUNT_NUMBER' ; my $sObj = SOAP::Lite->new(uri => $soapaction, proxy => $endpoint) ; my $response = $sObj->call(SOAP::Data->name($method)->attr({ 'xmlns' => $method_urn}) => SOAP::Data->name('ACCOUNT_NUMBER-VARCHAR2-IN' => '274724')) ; print $response->faultstring() . "\n"; However, this results in an XML parsing failed error message. What would be the correct SOAP::Lite code to make this method call? The HTTP request generated by the above is Accept: text/xml Accept: multipart/* Accept: application/soap Content-Length: 553 Content-Type: text/xml; charset=utf-8 SOAPAction: "http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS#GET_BY_ACCOUNT_NUMBER" <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GET_BY_ACCOUNT_NUMBER xmlns="http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS"> <ACCOUNT_NUMBER-VARCHAR2-IN xsi:type="xsd:int">274724</ACCOUNT_NUMBER-VARCHAR2-IN> </GET_BY_ACCOUNT_NUMBER> </soap:Body> </soap:Envelope> Here is the WSDL file defining the web service: <definitions name="ACCOUNT_WS" targetNamespace="http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <types> <xsd:schema targetNamespace="http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS" elementFormDefault="qualified"> <xsd:element name="CACCOUNT_A-GET_BY_ACCOUNT_NUMBERInput"> <xsd:complexType> <xsd:sequence> <xsd:element name="ACCOUNT_NUMBER-VARCHAR2-IN" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="GET_BY_ACCOUNT_NUMBEROutput"> <xsd:complexType> <xsd:sequence> <xsd:element name="RETURN" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </types> <message name="GET_BY_ACCOUNT_NUMBERInputMessage"> <part name="parameters" element="tns:CACCOUNT_A-GET_BY_ACCOUNT_NUMBERInput"/> </message> <message name="GET_BY_ACCOUNT_NUMBEROutputMessage"> <part name="parameters" element="tns:GET_BY_ACCOUNT_NUMBEROutput"/> </message> <portType name="ACCOUNT_WSPortType"> <operation name="GET_BY_ACCOUNT_NUMBER"> <input message="tns:GET_BY_ACCOUNT_NUMBERInputMessage"/> <output message="tns:GET_BY_ACCOUNT_NUMBEROutputMessage"/> </operation> </portType> <binding name="ACCOUNT_WSBinding" type="tns:ACCOUNT_WSPortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="GET_BY_ACCOUNT_NUMBER"> <soap:operation soapAction="GET_BY_ACCOUNT_NUMBER"/> <input> <soap:body parts="parameters" use="literal"/> </input> <output> <soap:body parts="parameters" use="literal"/> </output> </operation> </binding> <service name="ACCOUNT_WSService"> <documentation>Oracle Web Service</documentation> <port name="ACCOUNT_WSPort" binding="tns:ACCOUNT_WSBinding"> <soap:address location="http://example.com:2222/orawsv/PS_API/ACCOUNT_WS"/> </port> </service> </definitions>
Since you have the WSDL, you shouldn't have to construct SOAP::Data objects at all. Simply load the WSDL into your client object and call the method directly: my $client = SOAP::WSDL->new(wsdl => $url_of_wsdl); my $result = $client->$method(#arguments); Yes, it's that easy!
Looks like this is about a year old, so this might not be relevant any longer. Anyway, based on the soap::lite documentation on CPAN it looks like you want to do this: my $response = $sObj->call(SOAP::Data->name($method)->attr({ 'xmlns' => $method_urn}), SOAP::Data->name('parameters')->value(SOAP::Data->value([ SOAP::Data->name('ACCOUNT_NUMBER-VARCHAR2-IN' => '274724'), ])) ); die $response->fault->{ faultstring } if ($response->fault); print $response->result, "\n";