QuickBlox delete dialog returns access denied - quickblox

I wrote a helper using Jersey to delete a dialog on QuickBlox. For some reason, the same delete request generated by curl returns without any errors but with Jersey (a java restful client library) returns a 403. Here are the packet traces (taken on wireshark) of the requests and responses:
Jersey Request:
DELETE /chat/Dialog/55c5fab8535c12a211000d0f.json HTTP/1.1\r\n
Accept: */*\r\n
QB-Token: 32a7acd55d3b21dad79afba3b834a0b62c9a4946\r\n
User-Agent: Jersey/2.19 (HttpUrlConnection 1.8.0_20)\r\n
Host: api.quickblox.com\r\n
Connection: keep-alive\r\n
\r\n
Jersey Response:
Hypertext Transfer Protocol
HTTP/1.1 403 Access Denied\r\n
Date: Sat, 08 Aug 2015 12:49:14 GMT\r\n
Connection: keep-alive\r\n
Cache-Control: no-store\r\n
Content-Type: text/html\r\n
Content-Language: en\r\n
Content-Length: 249\r\n
\r\n
[HTTP response 2/2]
[Time since request: 0.009155000 seconds]
[Prev request in frame: 24303]
[Prev response in frame: 24324]
[Request in frame: 24328]
Line-based text data: text/html
<HTML>\n
<HEAD>\n
<TITLE>Access Denied</TITLE>\n
</HEAD>\n
\n
<BODY BGCOLOR="white" FGCOLOR="black">\n
<H1>Access Denied</H1>\n
<HR>\n
\n
<FONT FACE="Helvetica,Arial"><B>\n
Description: You are not allowed to access the document you requested.\n
</B></FONT>\n
<HR>\n
</BODY>\n
Curl Request:
Hypertext Transfer Protocol
DELETE /chat/Dialog/55c5fab8535c12a211000d0f.json HTTP/1.1\r\n
User-Agent: curl/7.37.1\r\n
Host: api.quickblox.com\r\n
Accept: */*\r\n
QB-Token: 32a7acd55d3b21dad79afba3b834a0b62c9a4946\r\n
\r\n
[Full request URI: http://api.quickblox.com/chat/Dialog/55c5fab8535c12a211000d0f.json]
[HTTP request 1/1]
[Response in frame: 35345]
Curl Response:
Hypertext Transfer Protocol
HTTP/1.1 200 OK\r\n
Access-Control-Allow-Origin: *\r\n
Cache-Control: max-age=0, private, must-revalidate\r\n
Content-Type: application/json; charset=utf-8\r\n
Date: Sat, 08 Aug 2015 12:54:34 GMT\r\n
ETag: "7215ee9c7d9dc229d2921a40e899ec5f"\r\n
QB-Token-ExpirationDate: 2015-08-08 14:49:14 UTC\r\n
QuickBlox-REST-API-Version: 0.1.1\r\n
Server: nginx/1.0.15\r\n
Status: 200 OK\r\n
X-Rack-Cache: invalidate, pass\r\n
X-Request-Id: 129dfcd4199bcae1f61cbd55a435885d\r\n
X-Runtime: 0.036879\r\n
X-UA-Compatible: IE=Edge,chrome=1\r\n
Content-Length: 1\r\n
Connection: keep-alive\r\n
\r\n
[HTTP response 1/1]
[Time since request: 0.475311000 seconds]
[Request in frame: 35287]
JavaScript Object Notation: application/json
Line-based text data: application/json
Does anyone have any idea what's happening here?

Related

Jsessionid Jmeter after login to site

what should i do to corelate i can use different login in jmeter i have already parameterize the value. i am getting stuck with this jsession id
Sample Count: 1
Error Count: 0
Data type ("text"|"bin"|""): text
Response code: 200
Response message: OK
Response headers:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-AREQUESTID: 340x9129744x1
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-ASEN: SEN-1047238
Set-Cookie: atlassian.xsrf.token=AVWR-AYBS-V3UU-QQRS|fef17187ee7e13e93c498a08e44fb5c2b90aba75|lout; Path=/
X-AUSERNAME: anonymous
X-Content-Type-Options: nosniff
Set-Cookie: JSESSIONID=3075A3A258CBA5D6131F724E3C0800CC; Path=/; HttpOnly
X-Accel-Buffering: no
Vary: User-Agent
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Date: Sun, 07 Oct 2018 09:40:27 GMT
Content-Encoding: gzip
HTTPSampleResult fields:
ContentType: text/html;charset=UTF-8
DataEncoding: UTF-8

Adding attachments to mule message

We are kind of stuck and do not know how to send attachments in mule message. We have some code in place that adds outbound attachments, but the values for Content-Disposition and Content-Type are autogenerated by mule and are not matching what is expected on the server. I have pasted the message that we are generating, the message that is expected (note the differences on content-types and content-dispositions).
The content-disposition has to be “inline” on payload and “attachment” on the part of data-file.xml, but instead mule generates Content-Disposition: form-data; name="payload" and Content-Disposition: form-data; name="data-file.xml"
This is the code snippet we are using to generate attachments:
ByteArrayDataSource ds = new org.mule.message.ds.ByteArrayDataSource((byte[])docInput.getDataSet(),ATTACHMENT_FILE_NAME,"application/pdf");
DataHandler dh = new javax.activation.DataHandler(ds);
msg.addOutboundAttachment(ATTACHMENT_FILE_NAME, dh);
Generated-Message-By_mule
POST /Operations/GenerateDocument HTTP/1.1
X-MULE_ENDPOINT: http://bxl-rs-d1-vm:42420/Operations/GenerateDocument
X-MULE_CORRELATION_SEQUENCE: -1
X-MULE_ENCODING: UTF-8
X-MULE_ROOT_MESSAGE_ID: be11dc40-a0af-11e4-89da-080027001cc8
Client-Authorization: YyoAjWLrpsySg7Euxf9zs3S/ujAPjFuRkT7di6/Dk9o=
Content-Type: multipart/mixed; boundary=" WeqbofBr94jK6QxpiWP36xMWse3bxwG21uQZed6”
Date: Tue, 20 Jan 2015 14:22:20 GMT
X-MULE_CORRELATION_GROUP_SIZE: -1
Accept: application/xml
X-MULE_SESSION: rO0ABXNyACNvcmcubXVsZS5zZXNzaW9uLkRlZmF1bHRNdWxlU2Vzc2lvbi7rdtEW7GGKAwAFWgAFdmFsaWRMAA1mbG93Q29uc3RydWN0dAAmTG9yZy9tdWxlL2FwaS9jb25zdHJ1Y3QvRmxvd0NvbnN0cnVjdDtMAAJpZHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wACnByb3BlcnRpZXN0AA9MamF2YS91dGlsL01hcDtMAA9zZWN1cml0eUNvbnRleHR0ACdMb3JnL211bGUvYXBpL3NlY3VyaXR5L1NlY3VyaXR5Q29udGV4dDt4cAFwdAAkYmUxMjc4ODAtYTBhZi0xMWU0LTg5ZGEtMDgwMDI3MDAxY2M4c3IAJWphdmEudXRpbC5Db2xsZWN0aW9ucyRTeW5jaHJvbml6ZWRNYXAbc/kJS0s5ewMAAkwAAW1xAH4AA0wABW11dGV4dAASTGphdmEvbGFuZy9PYmplY3Q7eHBzcgAkb3JnLm11bGUudXRpbC5DYXNlSW5zZW5zaXRpdmVIYXNoTWFwndHZ72dFzgADAAB4cHcMP0AAAAAAABAAAAABdAAMT3BlcmF0aW9uVmFydAAQZ2VuZXJhdGVEb2N1bWVudHhxAH4ACXhweA==
User-Agent: Jakarta Commons-HttpClient/3.1
Host: bxl-rs-d1-vm:42420
Content-Length: 16645
--WeqbofBr94jK6QxpiWP36xMWse3bxwG21uQZed6
Content-Disposition: form-data; name="payload"
Content-Type: application/octet-stream; charset=ISO-8859-1
Content-Transfer-Encoding: binary
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns12:GenerateDocumentRequest xmlns:ns2="http://www.sodexo.com/CRM-Integration-Push" xmlns:ns3="http://www.sodexo.com/CRM-Integration-Update" xmlns:ns4="http://www.sodexo.com/CRM-Integration-PushFeedback" xmlns:ns5="http://www.sodexo.be/schemas/organization-api/1.0" xmlns:ns6="http://www.sodexo.be/schemas/organization-api/Phoenix-Organization-Update" xmlns:ns7="http://www.sodexo.com/CRM-Integration-UpdateFeedback" xmlns:ns8="http://www.sodexo.com/CRM-Address-Management" xmlns:ns9="http://net.sxpbelux.eurodb.services/eurodbServiceSchema-addressRequest" xmlns:ns10="http://net.sxpbelux.eurodb.services/eurodbServiceSchema-resultType" xmlns:ns11="http://www.sodexo.com/CRM-Document-Management" xmlns:ns12="http://schemas.datacontract.org/2004/07/Compro.Services.Contracts.DataContracts" xmlns:ns13="http://schemas.datacontract.org/2004/07/System" xmlns:ns14="http://net.sxpbelux.eurodb.services/eurodbServiceSchema-addressSearchRequest" xmlns:ns15="http://www.sodexo.com/CRM-Integration-Base" xmlns:ns16="http://www.sodexo.be/schemas/organization-api/Phoenix-OrganizationServices-Base" xmlns:ns17="http://www.sodexo.be/schemas/organization-api/Phoenix-Organization-UpdateFeedback" xmlns:ns18="http://net.sxpbelux.eurodb.services/eurodbServiceSchema-searchAddressResultType"><ns12:AttachmentFiles xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><ns12:BusinessContext>ServiceVoucher</ns12:BusinessContext><ns12:BusinessReference>Work_Voucher_Assigned</ns12:BusinessReference><ns12:CommunicationKey>CommunicationKey</ns12:CommunicationKey><ns12:DataFile>data-file.xml</ns12:DataFile><ns12:FileFormat>DOCX</ns12:FileFormat></ns12:GenerateDocumentRequest>
--WeqbofBr94jK6QxpiWP36xMWse3bxwG21uQZed6
Content-Disposition: form-data; name="data-file.xml"
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 8bit
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:DocumentData xmlns:ns2="http://www.sodexo.com/CRM-Integration-Template">
<Contacts>
<Contact>
<email>email#abc.com</email>
<firstName>firstName</firstName> ....
Message_expected_by_server
POST http://besvc-hq1000057:42420/Operations/GenerateDocumentWithAttachment/ HTTP/1.1
Date: Wed, 26 Nov 2014 13:31:24 GMT
Accept: application/xml
X-Compro-Username: ASI
Client-Authorization: S/rumqB+P0jfzY54eSeAGrKeMCfy7RYizno5A8D0ulI=
Content-Type: multipart/mixed; boundary="d1261136-19f2-463e-ac7e-e8925c807c7d"
Host: besvc-hq1000057:42420
Content-Length: 26128
Expect: 100-continue
Connection: Keep-Alive
--d1261136-19f2-463e-ac7e-e8925c807c7d
Content-Type: application/xml; charset=utf-8
Content-Disposition: inline
[... some xml data ...]
--d1261136-19f2-463e-ac7e-e8925c807c7d
Content-Type: application/xml; charset=utf-8
Content-Disposition: attachment; filename=order_created_badcom_data.xml
[... some xml content ...]
--d1261136-19f2-463e-ac7e-e8925c807c7d
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Content-Disposition: attachment; filename=a.docx
[... some binary content ...]
--d1261136-19f2-463e-ac7e-e8925c807c7d
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Content-Disposition: attachment; filename=a2.docx
[... some binary content ...]
--d1261136-19f2-463e-ac7e-e8925c807c7d--
If you have any ideas on how to get this to work, kindly let us know.
Thanks and regards,
Priya
Can you try setting the Content-Type on the message as follows:
<set-property propertyName="Content-Type" value="application/pdf" doc:name="Content-Type"/>
You can replace the 'application/pdf' with your desired value. The same applies to the other property you want to modify.
HTH
I finally figured out that this is mule's limitation - we do not have control over setting content-disposition value when adding attachments using message.addOutboundAttachment() method.
The workarounds for this is to have your own http transport connector implemented or implement your client using any rest client framework or http client libraries.
The following will work fine and will set attachment with the message :-
<set-attachment value="#[message.payload]" contentType="application/pdf" attachmentName="#[message.inboundProperties['originalFilename']]" doc:name="Attachment" />
Where you can replace #[message.inboundProperties['originalFilename']] directly with file name or can keep as same if you are using a file inbound endpoint

Add Headers to a POST

I am trying to pass header when i post XML Data in VB.Net.
It needs to look like this :
POST /test1.asmx HTTP/1.1
Host: www.test1.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://test1.org/PostApplication_V5"
I am using the following :
Req.Headers.Add("POST /", "test1.asmx HTTP/1.1")
Req.Headers.Add("HOST", "www.test1.com")
Req.Headers.Add("Content-Type", "text/xml; charset=utf-8")
Req.Headers.Add("Content-Length", "length")
Req.Headers.Add("SOAPAction", """http://test1.org/PostApplication_V5""")
Its not working
<POST /test1.asmx HTTP/1.1>
<Host: www.test1.com>
<Content-Type: text/xml; charset=utf-8>
<Content-Length: length>
<SOAPAction: "http://test1.org/PostApplication_V5">
</POST /test1.asmx HTTP/1.1>
</Host: www.test1.com>
</Content-Type: text/xml; charset=utf-8>
</Content-Length: length>
</SOAPAction: "http://test1.org/PostApplication_V5">

Objective C Mime Parser for IMAP response

I want to Parse a NSDATA which contains IMAP response, For ex
Date: Tue, 18 Sep 2012 02:50:54 +0000 (GMT)
From: xx#xx.com
To: yy#yy.com
Message-ID: 7034025
Content-Type: multipart/mixed;
boundary="----=_Part_16_9157073.1347936657899"
Message-Source: IMAP
------=_Part_16_9157073.1347936657899
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-ID: text.txt
Content-Location: text.txt
X-Section-ID: Text-Section
Test Message
------=_Part_16_9157073.1347936657899
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-ID: attachment_1
Content-Location: image_1347936646.jpg
X-Section-ID: Thumbnail-Section
ˇÿˇ‡ ...........
------=_Part_16_9157073.1347936657899--
From this I want to extract both Parts(Text & Image). Can anybody suggest me an Objective-c mime parser.
Note: The image part is in Binary not encoded with base64.

So nginx is not interpreting folded headers correctly?

HTTP/1.1 header field values can be
folded onto multiple lines if the
continuation line begins with a space
or horizontal tab. All linear white
space, including folding, has the same
semantics as SP. A recipient MAY
replace any linear white space with a
single SP before interpreting the
field value or forwarding the message
downstream.(quoted from here)
Here's my server side script,which just dumps the cookie content:
var_dump($_COOKIE);exit;
Here comes my test,please pay attention to the cookie part:
GET /logtest.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.17) Gecko/20110420 AlexaToolbar/alxf-2.11 Firefox/3.6.17
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Cookie: A=t;
artDate=t
Cache-Control: max-age=0
HTTP/1.1 200 OK
Server: iis/8.0
Date: Mon, 23 May 2011 12:38:00 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Keep-Alive: timeout=20
X-Powered-By: PHP/5.3.2
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
27
array(1) {
["A"]=>
string(1) "t"
}
0
GET /logtest.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.17) Gecko/20110420 AlexaToolbar/alxf-2.11 Firefox/3.6.17
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Cookie: A=t;
artDate=t
Cache-Control: max-age=0
HTTP/1.1 200 OK
Server: iis/8.0
Date: Mon, 23 May 2011 12:38:11 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Keep-Alive: timeout=20
X-Powered-By: PHP/5.3.2
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
27
array(1) {
["A"]=>
string(1) "t"
}
0
GET /logtest.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.17) Gecko/20110420 AlexaToolbar/alxf-2.11 Firefox/3.6.17
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Cookie: A=t;artDate=t
Cache-Control: max-age=0
HTTP/1.1 200 OK
Server: iis/8.0
Date: Mon, 23 May 2011 12:38:55 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Keep-Alive: timeout=20
X-Powered-By: PHP/5.3.2
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
47
array(2) {
["A"]=>
string(1) "t"
["artDate"]=>
string(1) "t"
}
0
It's a known issue that doesn't have a high priority.