XEP 0055 (Jabber search) with iphone SDK - ios

I am creating a XMPP sample on ios. What I am trying to do is search user over xmpp. I checked the opernfire server and it has the search plugin enabled. I gone through XEP:0055 and found the stanza. I also gone through this so question but did
I am done with xmpp connection and login. Now here are the details regarding to my server:
Host Name = 10.x.x.x;
Server name = abcd;
The request format I got from the XEP 0055 link is:
<iq type='set' from='romeo#montague.net/home' to='characters.shakespeare.lit' id='search2' xml:lang='en'>
<query xmlns='jabber:iq:search'>
<last>Capulet</last>
</query>
</iq>
I don't know what characters.shakespeare.lit is. I assume this is the server name. So I created following request:
<iq to="abcd" id="search2" xml:lang="en">
<query xmlns="jabber:iq:search">
<Username>kapil</Username>
</query>
</iq>
but I am not getting any response. I tried to replace the to value with following search.abcd and 10.x.x.x but I am not even receiving any response IQ for this rquest.
Any help plz.

shakespeare.lit is the xmpp host name. 'characters' is the Search service Name.

It is the name of a directory service. If you connect to a server, you can retrieve the list of services and use that server's directory service. Alternatively, you can use any server's directory service (depending on the service's configuration, you do not have to be connected to the server hosting the service).

var iq = $iq({
type: 'set',
id: 'search2',
to: 'vjud.yourserver.org'
})
.c('query', {xmlns: 'jabber:iq:search'})
.c('x', {xmlns: 'jabber:x:data', type:'submit'})
.c('field', {var: 'first'}).c('value','Rub*').up();
conn.sendIQ(iq);
note: to: characters.shakespeare.lit
Not your server but the vcard service search.

Related

Error: ExchangeImpersonation SOAP header must be present for this type of oauth token

I am trying to use Exchange Web Services (EWS) with application and OAuth2 authentication.
What I did:
registered on Azure portal application, granted all required permissions (even full_access_as_app for Exchange); accepted these permissions as an admin;
prepared correct OAuth2 Bearer token (with scope https://outlook.office365.com/.default);
prepared SOAP request with SOAP UI. As basis for this request I use this one: https://learn.microsoft.com/en-us/exchange/client-developer/web-service-reference/getattachment-operation . Additionally I've added HTTP Authorization header with Bearer token, X-AnchorMailbox with target mailbox.
As a result I get this one: "ExchangeImpersonation SOAP header must be present for this type of OAuth token". I cannot understand what should I do to fix it.
Even tried with ExchangeImpersonate and SmtpAddress with the same mailbox address as above but in this way I get another error "Mailbox not found". But mailbox is! (tested on several mailboxes).
My questions is: what am I doing wrong with EWS?
Request:
POST https://outlook.office365.com/ews/Exchange.asmx
Authorization: Bearer <token>
X-AnchorMailbox: mailbox#something.onmicrosoft.com
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Header>
        <t:RequestServerVersion Version="Exchange2016"/>
        <t:ExchangeImpersonation>
            <t:ConnectingSID>
                <t:PrimarySmtpAddress>
                    mailbox#something.onmicrosoft.com
                </t:PrimarySmtpAddress>
            </t:ConnectingSID>
        </t:ExchangeImpersonation>
  </soap:Header>
  <soap:Body>
    <GetAttachment xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
    xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
      <AttachmentShape/>
      <AttachmentIds>
        <t:AttachmentId Id="AAMkADAwNzdjNTg3LTc4M2ItNDE0Yi05MTk4LTQxZDBlYTc1NmMxZgBGAAAAAAAiixtLGariQY7rf5pAKRZZBwBVk8babsuEQ4s2Znfj9fB5AAAAAAEMAABVk8babsuEQ4s2Znfj9fB5AADq3B14AAABEgAQAKZOAcjZCBxHpqvY6XmXp5w="/>
      </AttachmentIds>
    </GetAttachment>
  </soap:Body>
</soap:Envelope>
Response:
ErrorNonExistentMailbox The SMTP address has no mailbox associated with it.
This fixed it for me.
_exchangeService.ImpersonatedUserId =
new ImpersonatedUserId(ConnectingIdType.SmtpAddress, userEmailAddress);
You would need to instantiate impersonation as below:
var ews = new Rebex.net.Ews();
ews.Connect(outlook.office365.com);
ews.Settings.Impersonation = new EwsImpersonation();
ews.Settings.Impersonation.SmtpAddress = <mailbox address>;

Unable to receive affiliation change notification from iq

I am using mod muc_light in MongooseIM from source code(ver-3.1.0) and taking help from this article I am able to perform the below operations successfully without any trouble:
create a new muc light room.
send/receive text message stanza
queries MAM and receives regular groupchat message. ['6.2.1 Groupchat message from occupant' from above article][Even, here I am getting the muc info but since this is related to a particular muc light room. So, not much useful.]
But I am unable to query MAM and receives an affiliation change notification. See topic [6.2.2 Affiliation change] in the above article link.
Following is the request/response for 'affiliation change notification'
// Request to server with type='set'
<iq type='set'
id='mamget2'
to='muclight.localhost'>
<query xmlns='urn:xmpp:mam:1' queryid='f37'/>
</iq>
// Response from server
<iq xmlns='jabber:client'
from='muclight.localhost'
to='ip0a0g0ur63vdjns#localhost/E42B7412598F3B081543-557985-559692'
id='mamget2'
type='error'>
<error code='' type='cancel'>
<not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>The action is not allowed.</text>
</error>
</iq>
// Request to server with type='get'
<iq type='get'
id='mamget2'
to='muclight.localhost'>
<query xmlns='urn:xmpp:mam:1' queryid='f37'/>
</iq>
// Response from server
<iq xmlns='jabber:client'
from='muclight.localhost'
to='ip0a0g0ur63vdjns#localhost/E42B7412598F3B081543-557985-559692'
id='mamget2'
type='error'>
<error code='' type='cancel'>
<not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>The action is not allowed.</text>
</error>
</iq>
MongooseIM config:
{mod_muc_light, [
{host, "muclight.#HOST#"},
{backend, rdbms},
{max_occupants, 256}
]},
{mod_mam_meta, [
{backend, rdbms},
{no_stanzaid_element, true},
{is_archivable_message, "muclight.#HOST#"},
{pm, false},
{muc, [
{host, "muclight.#HOST#"}
]}
]}
Questions/concerns:
Am I doing something wrong in config? - [I doubt this, because some others operation are working fine like mentioned above]
Am I sending the incorrect IQ stanza - [I doubt this because I am copying the exact same stanza example provided in above link]
Should I update MongooseIM. [May be]
Anything else?
Please help

How to script custom Openfire IQ request in tsung

My IQ request is
<iq id="rn3Nd-0" to="servername#domain.com" type="set">
<query xmlns="my:xmlns:name">
<username>someuser</username>
</query>
</iq>
How do I customize tsung scripts to bombard my openfire with above IQ request. Value in username has to be dynamic and keep changing. I would like to create 1000 request in a minute. How can we achieve this in tsung script.
You can read the usernames from a CSV file. So if you need 100 users you can create a CSV of 1000 names and it will randomly pick names from that.
http://tsung.erlang-projects.org/user_manual/conf-sessions.html#reading-usernames-and-password-from-a-csv-file

Mule SFDC connector: redirect_uri_mismatch&error_description=redirect_uri must match configuration

I am connecting to SFDC with mule connector by oauth, trying to authorize but getting following error message.
<flow name="sfdcFlow1" doc:name="sfdcFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="${hostname}" port="${port}" path="sfdc" doc:name="HTTP"/>
<sfdc:authorize config-ref="Salesforce__OAuth_v2_0" display="POPUP"
accessTokenUrl="https://na1.salesforce.com/services/oauth2/token"
authorizationUrl="https://na1.salesforce.com/services/oauth2/authorize"
doc:name="Salesforce"/>
</flow>
getting following error message in the browser:
error:redirect_uri_mismatch&error_description=redirect_uri must match configuration
what is redirect or callback url? Do I need to have another flow and http requests?
I made this but didnot work:
<http:inbound-endpoint exchange-pattern="request-response" host="${hostname}" port="${port}" path="callback" doc:name="HTTP"/>
<logger message="===callback====" level="INFO" doc:name="Logger"/>
</flow>
Edit:
I have an url from sfdc as: https://cs17.salesforce.com/. IS this is the url to be used for redirect?
Mules ref docs says to use
oauthcallback as path. I am using Anypoint studio with sfdc connector 6.0.1. Even after using same error message I receive it.
<sfdc:oauth-callback-config domain="localhost" localPort="8081" path="oauthcallback"/>
Mulesoft ref docs
Reference -1
Callback URL is where Salesforce will redirect after successful authentication. I have not used it with Salesforce but I have done this with other cloud connector and you can refer some of my slide share for details. Please try with those links and let me know if u still have any issue.
http://www.slideshare.net/rupeshkrsinha/integration-with-dropbox-using-mule-esb
http://www.slideshare.net/rupeshkrsinha/integrating-with-linkedin-using-mule-esb-linkedin-connector

FileTransfering in iOS with XMPPFramework and XMPPSiFileTransfer

I got stuck with implementing File Transfer functionality using iOS XMPPFramework(XMPPSiFileTransfer). I have tried out different ways and finally I could sent a file transfer request and the recipient got the request. But even if they accepted nothing seems to tranferring. I tried to sent request to recipients in Spark/Windows machine and iMessage/Mac. In the XMPPSiFileTransfer class itself, I found the developer comment as follow
"It's the other way around when we are the initiator. We send the request by calling initiateFileTransferTo:withData and then wait for the iq result with the si namespace of http://jabber.org/protocol/si, send a disco#info response, open a SOCKS5 socket and then wait for the other side the connect to start the transfer."
When I send a request by calling the method initiateFileTransferTo, SiFileTranfer generates the following XML:
<iq type="set" id="8FF7E518-E518-4A98-B122-914A8345C638" to="rajesh.rajan#chat.speridian.com/Spark 2.6.3" from="sreelash.s#chat.speridian.com/b79f10d5"><si xmlns="http://jabber.org/protocol/si" id="967DAA7A-F159-44D8-AD31-7C532AB459AD" mime-type="image/png" profile="http://jabber.org/protocol/si/profile/file-transfer"><file xmlns="http://jabber.org/protocol/si/profile/file-transfer" name="photoB29D9F41-EC41-41C8-AF6D-EA5E23FF906E.png" size="740"/><feature xmlns="http://jabber.org/protocol/feature-neg"><x xmlns="jabber:x:data" type="form"><field var="stream-method" type="list-single"><option><value>http://jabber.org/protocol/bytestreams</value></option></field></x></feature></si></iq>
Then I got the response on didRecieveIq as follows as mentioned in the developer comment.
<iq xmlns="jabber:client" id="8FF7E518-E518-4A98-B122-914A8345C638" to="sreelash.s#chat.speridian.com/b79f10d5" from="rajesh.rajan#chat.speridian.com/Spark 2.6.3" type="result"><si xmlns="http://jabber.org/protocol/si"><feature xmlns="http://jabber.org/protocol/feature-neg"><x xmlns="jabber:x:data" type="submit"><field var="stream-method"><value>http://jabber.org/protocol/bytestreams</value></field></x></feature></si></iq>
When I got the result with si namespace in didRecieveIq, the disco#info is sent as follow
<iq type="get" id="12A7231B-D50A-469E-96B4-BD39278B77EF" to="rajesh.rajan#chat.speridian.com/Spark 2.6.3" from="sreelash.s#chat.speridian.com/b79f10d5"><query xmlns="http://jabber.org/protocol/disco#info"/></iq>
and SOCKS5 socket is tried to open by calling the following method
- (id)initWithStream:(XMPPStream *)stream toJID:(XMPPJID *)aJid sid:(NSString *)sid
But I am getting "SOCKS5 Connection failed!" message. I am not able to identify what's the issue. Can anyone help me to sort out this issue?
Thanks in advance.
you need to make some modifications in the TURNSocket class XEP-0065.
try this xmpp
refer thislink

Resources