Pregunta

I'm attempting to interact with a UPnP printer on my network. I can discover the printer, get the available services on it, and even get the list of actions available for a service. However, this is where I'm stuck.

For example, there is an action GetPrinterAttributes and I know I need to create a http POST to send an envelop requesting the action, but I do no know what that looks like. I'm hoping someone can help point me to documentation or anything to get me going again.

Based on other examples, I tried creating the request payload as follows:

<s:Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <s:Body>
        <u:GetPrinterAttributes xmlns:u="urn.schemas-upnp-org:device:Printer:1">
        </u:GetPrinterAttributes>
    </s:Body>
</s:Envelope>

This is as far as I can get, yet I don't know what the tags mean. Hoping for some help there.

thanks!

¿Fue útil?

Solución

You really are implementing a UPnP control point from scratch :o . There must be usable UPnP libraries for your platform that would cut the amount of work needed to maybe 1-5%. But I guess you knew that so carry on... I just wanted to make sure you understand that UPnP is not the simplest protocol and implementing it for a single application makes little sense.

I'll just refer you to the same document as I did for SSDP: UDA 1.1 pdf, especially 3.1.1 SOAP Profile. You could read the actual SOAP spec as well, but I think the UPnP docs are complete enough. The UDA defines the SOAP profile and contains several envelope examples. It also explains what the containing HTTP POST must look like (see especially the required headers).

about your envelope (without having seen the Printer spec): GetPrinterAttributes namespace is wrong as methods are defined in a service, not device. It's also missing the initial <?xml version="1.0"> line.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top