SoapAction can't add \"
-
Wednesday, July 25, 2012 8:00 AM
Hi,
I would like to send a XMLHttpRequest with SOAPACTION, such as "urn:schemas-upnp-org:service:ContentDirectory:1#Browse".
Sure, I tried to send a request to DLNA server, but only Windows Media Player success.
I captured packets to compare with other program, and I found a slight difference from my SOAPACTION.
Here are the two SOAPACTION strings of 2 packets:
1. My packet
SOAPACTION: urn:schemas-upnp-org:service:ContentDirectory:1#Browse
2. TrueLink+ packet
SOAPACTION: "urn:schemas-upnp-org:service:ContentDirectory:1#Browse"
if I browsed WMP server, my program can work properly. However, other DMS will return "Internal server error" and XML which tells me "Invalid Action".
So I imitated TrueLink SOAPACTION. Unfortunately, when I add \" both in head and end of SOAPACTION, the sent packet won't have SOAPACTION,
e.g. SOAPACTION = "\"urn:schemas-upnp-org:service:ContentDirectory:1#Browse\"";
I have tried WinJS.xhr and XMLHttpRequest(), the situations are the same.
Can anyone tell me what I neglect?
All Replies
-
Wednesday, July 25, 2012 2:49 PMModerator
Can you please post your code of how you are setting this header?
-Jeff
Jeff Sanders (MSFT)
-
Thursday, July 26, 2012 3:45 AM
// WinJS var header = { 'Content-Type': 'text/xml; charset="utf-8"', 'SOAPACTION': '\"urn:schemas-upnp-org:service:ContentDirectory:1#Browse\"' }; //Url and xml are worked when send to WMP server. WinJS.xhr({ type: "POST", url: Url, headers: header, data: xml }).done(//callback code); // Use XMLHttpRequest(), the result is the same as WinJS. var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function (state) { } xhr.onerror = function (err) { } xhr.open("POST", Url, true); xhr.setRequestHeader("Content-Type", "text/xml"); xhr.setRequestHeader("charset", "utf-8"); xhr.setRequestHeader('SOAPACTION', '\"urn:schemas-upnp-org:service:ContentDirectory:1#Browse\"'); xhr.send(xml);It seems "u or "U that are not allowed in SOAPACTION.
Thank you Jeff.
-
Wednesday, August 01, 2012 3:48 AM
Hi~
Any comment?
-
Friday, September 28, 2012 8:26 AM
This problem is no doubt a bug of IE10.
I have tried with streamSocket, then I can correctly to send the headers.
And I have tried the same Javascript code in IE(desktop) occurs the same situation.
Can this bug be fixed?
-
Friday, September 28, 2012 5:10 PMModerator
The issue appears to occur when you quote the string for the header value.
I have not found a workaround yet!
Jeff Sanders (MSFT)
-
Friday, September 28, 2012 6:29 PMModerator
Can you get away with a single quote?
var action = "\'" + "urn:schemas-upnp-org:service:ContentDirectory:1#Browse" + "\'"; var header = { "SOAPACTION": action };Jeff Sanders (MSFT)


