How can I actually download/transfer a file found using UPnP? - streaming

I'm completely new to UPnP as a protocol, but I'm hoping to use it to transfer files from a Sony Camera to an iOS app I'm working on. So far I have SSDP discovery setup, I can read the UPnP client's services, search through folders and access file names, but the final hurdle which I'm stuck on is how to actually download/transfer the files once I'm able to list them!
What I end up getting is the below:
<item id="04_02_0624600856_000001_000001_000000" restricted="1" parentID="03_01_0624600856_000001_000000_000000">
<dc:title>DSC05076.ARW</dc:title>
<upnp:class>object.item.imageItem.photo</upnp:class>
<dc:date>2018-08-23T12:24:21</dc:date>
<res protocolInfo="http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_SM;DLNA.ORG_CI=1">http://192.168.122.1:60151/SM_DSC05076.ARW?%2104%5f02%5f0624600856%5f000001%5f000001%5f000000%21http%2dget%3a%2a%3aimage%2fjpeg%3aDLNA%2eORG%5fPN%3dJPEG%5fSM%3bDLNA%2eORG%5fCI%3d1%21%21%21%21%21</res>
<res protocolInfo="http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_LRG;DLNA.ORG_CI=1">http://192.168.122.1:60151/LRG_DSC05076.ARW?%2104%5f02%5f0624600856%5f000001%5f000001%5f000000%21http%2dget%3a%2a%3aimage%2fjpeg%3aDLNA%2eORG%5fPN%3dJPEG%5fLRG%3bDLNA%2eORG%5fCI%3d1%21%21%21%21%21</res>
<res protocolInfo="http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN;DLNA.ORG_CI=1">http://192.168.122.1:60151/TN_DSC05076.ARW?%2104%5f02%5f0624600856%5f000001%5f000001%5f000000%21http%2dget%3a%2a%3aimage%2fjpeg%3aDLNA%2eORG%5fPN%3dJPEG%5fTN%3bDLNA%2eORG%5fCI%3d1%21%21%21%21%21</res>
I would (With my naive experience of simple HTTP APIs) then expect to simply be able to download the file in question by hitting:
http://192.168.122.1:60151/SM_DSC05076.ARW or similar (I'm assuming I have to change this URL slightly as the file is listed as image/jpeg rather than RAW?
Whatever combination I try of the full res object, snipping bits, decoding the url e.t.c. I always get a 404 response when trying to visit the URL in question. Is there something more complex I need to do here? Or something simple that I'm missing?
Thanks in advance!

The problem here was that I was using a url from a previous session. It turns out that the urls change between connection sessions, which is why I was getting a 404.
Lesson learned: UPnP is highly dynamic, and you can’t rely on caching images under their access MRL!

Related

Setting up Dynamic Links in Firebase with Wordpress site

I am really struggling here... All I actually want to achieve is that I can get the Generate-Strong-Password function inside my app but that is actually harder than I thought.
I learned that I should go with Firebase Dynamic Links because I have a Wordpress-Website from All-Inkl.com.
I followed this Tutorial and there is actually an Apple-Site-Association-File at the moment. But I can't access my Website anymore as it looks like this:
Inside my Firebase Project I am getting this error which says that there not all the necessary "A-Files" are inside my Website:
My DNS-Settings:
I've been struggling for weeks now to get this done so if anyone has any idea how I can fix it I would be extremely grateful!! (btw, I am a total newbie when it comes to websites; I know my way around Swift though)
It seems that different domain providers accept different values for DNS entries ('A records' = 'A-Datensätze', in this case).
Try editing the entries for the Host field (which currently hold your website's URL) to one of the 'common inputs' listed here: https://firebase.google.com/docs/hosting/custom-domain?hl=de#domain-key
As the URL to your site doesn't seem to be what your provider accepts, I would suggest you try replacing it with the next option, i.e. replacing it with # .
Hope this helps solving your issue!

How do relative URLs work in Sinatra?

I am hosting my Sinatra application using Apache with Passenger. It's hosted within a subfolder -- meaning, my main site is example.com, my application is at example.com/popcorn.
So I have a get '/' route, and that works fine. The problem is that my view includes a HTML form that makes a post request to upload, and the post '/upload' route isn't handling it. Instead of example.com/popcorn/upload, it's trying to get example.com/upload.
So I figure okay, not the ideal solution, but for now I'll hardcode the form action URL. But that doesn't work either -- making the action popcorn/upload fails too. This is where I get a little baffled, and my Google-fu was weak, I couldn't find help there.
Maybe I could have some kind of Apache rewrite rule, but is that the correct solution? Am I missing something? I would really appreciate a tip here because it feels like I've messed up something very simple and it's really bugging me.
You probably want the url helper method. That takes into account where the app is mounted on the server:
url('/upload')
The above code will evaluate to something like this:
http://example.com/popcord/upload
Inside your app you shouldn’t need to change anything, this will be routed to the existing post '/upload' handler.

Post csv content to Web Api

I have a c# console application which post .csv content to a web service. If I run my solution through VS, it runs perfectly fine but after deploying web service on IIS I keep getting Multiple Choice Status Code 300 error. Not sure how to resolve that. Any pointers would be appreciated.
Thanks
These are relatively simple but I cannot think of other possibilities based on your description.
One of my recent designs had a literal in the code that when I deployed it ended up using a different port which I had forgotten to change to a relative reference.
If not that then the other problem I had with it was because I used JSON to link to the web service. While it worked when viewing in VS when deployed my JSON reference was actually incorrect. specifically it had to do with code in my web.config file, which would be the app.config file for your console application. I had used the code
standardEndpoint helpEnabled="true" automaticFormatSelectionEnabled="false" crossDomainScriptAccessEnabled="true"
when I should have also added
defaultOutgoingResponseFormat="Json"
to make the code work

Implement WebDAV connection in iPhone app

I've been searching around this forum and Google, but I can't find anything that helps me. I need to be able to connect to a WebDAV server, type in a username and password to get access and show the folders and files in my iPhone app. Just like the free iPhone app called WebDAV Nav.
Seems like the question is asked a lot, but no one really has an answer for it?
Does anyone know if there's a sample project out there, that could get me on the right track?
I've tried WTClient and flyingcode webdav.
Both flycode's WebDAV and WTClient are a few years old, seem incomplete and have a few errors.
When I try WTClient with a WebDAV server I get the response
This URL can be accessed only with a WebDAV compatible software program.
When I try the flycode WebDAV code, it fails to parse the server directory listing response correctly. I managed to modify the code in FMWebDAVRequest to look for slightly different XML elementNames in the response
eg "response" instead of "D:response", "href" instead of "D:href",
"resourcetype" instead of ":getcontenttype"
Then it worked, successfully retrieving the directory listing.
But should I continue to tweak this code, try something more robust or roll my own? What have others done/used?

Apps>Menu>Basic 405 Method Not Allowed

I am hosting my pages on my doamain. I put the following info. When I go to view the app it shows 405 Method Not Allowed..Not sure what I am doing wrong.
*
The first page load a APP makes is a POST request.
Seems your server could be rejecting them.
Its worth checking the server side error log for further information.
Indeed, it will most probably be a setting on your server. I had the same problem, my server didn't allow POST method on .html pages, changed my canvas page source to .php and all works fine now.
If you can look at your apache logs, it will provide a more clear error that we can help you debug with. Though a 405 error typically signifies a problem with the server and usually stems for a POST request.
I have made the mistake 2 times of creating my site in html instead of using a scripting extension. For example, if you are running on a Windows server and coding in Visual Studio, it is tempting to just create .htm or .html files. However, most web servers will not allow a POST operation to these pages. Instead, create .aspx pages, which will still allow you to use the same exact static HTML and JavaScript. This solved my problem in both cases.