The server response is currently not included in the ErrorMessage property. It will be added in the future.
Firstly, sorry for reviving an old thread
I was just wondering if with the B4A 3.82 update it is now possible to catch an 801 error code to determine if access has been denied on a browse request?
If not then please can someone expand on what is required to add it myself...
You can add it yourself by modifying HttpUtils2Service code. You will need to remove the library and use the two modules (HttpJob and HttpUtils2Service) instead.
I'm currently using HTTP (v1.36) and HttpUtils2 (v2.01) libraries to identify and browse UPNP media devices on my network.
Attached is my project which is reaching a point where I'm no longer embarrassed to share it
, it's still a work in progress and will only browse UPNP media devices that require no authorisation and currently only plays video files, but music and images are easy to add (I've just not done it yet
).
Whilst I'm on the subject of authorisation, does anyone know how to do this within the UPNP standard? I'm currently sending the following browse request...
Private Sub BrowseServer(objectID As String, metaData As Boolean)
Debug.debugLog("##### SEND BROWSE REQUEST #####") 'DEBUG
' Set browseFlag to either BrowseMetadata or BrowseDirectChildren
Dim browseFlag As String
If metaData = True Then
browseFlag = "BrowseMetadata"
Else
browseFlag = "BrowseDirectChildren"
End If
browseID = objectID
' Create SOAP XML message
Dim xmlMsg As String
xmlMsg = "<?xml version='1.0' encoding='utf-8'?>" & _
"<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/' s:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>" & _
"<s:Body>" & _
"<u:Browse xmlns:u='" & browseServiceType & "'>" & _
"<ObjectID>" & browseID & "</ObjectID>" & _
"<BrowseFlag>" & browseFlag & "</BrowseFlag>" & _
"<Filter>" & browseFilter & "</Filter>" & _
"<StartingIndex>" & browseStartingIndex & "</StartingIndex>" & _
"<RequestedCount>" & browseRequestedCount & "</RequestedCount>" & _
"<SortCriteria>" & browseSortCriteria & "</SortCriteria>" & _
"</u:Browse>" & _
"</s:Body>" & _
"</s:Envelope>"
xmlMsg = xmlMsg.Replace("'", Chr(34))
Debug.debugLog(xmlMsg) 'DEBUG
' Initialise HTTP job
Dim httpReq As HttpJob
httpReq.Initialize("Browse",Me)
httpReq.PostString(browseURL, xmlMsg)
httpReq.GetRequest.SetContentType("text/xml; charset=" & Chr(34) & "utf-8" & Chr(34))
httpReq.GetRequest.SetHeader("SOAPAction",Chr(34) & browseServiceType & "#Browse" & Chr(34))
httpReq.GetRequest.Timeout = 20000
If browseReset = True Then
' Store the objectID being browsed
Main.browseLog.Add(objectID)
End If
End Sub
But if I remember correctly I don't think that it can be sent within this request. It's a while ago since I read the docs but seem to think I have to send a authorisation request and be accepted before attempting to browse?
Thanks,
RandomCoder
PS. When I'm eventually finished I plan to share the code here in the Forum along with a brief explanation of the sequence. I hope you like the look of it so far!