question

MartinWaller-0619 avatar image
0 Votes"
MartinWaller-0619 asked ElevenYu-MSFT commented

WS-Discovery

Hi,

I'm having issues finding and then talking to my Brother DCP-7055W printer. I'm using code such as:

         DiscoveryEndpoint discoveryEndpoint = new UdpDiscoveryEndpoint(DiscoveryVersion.WSDiscoveryApril2005);
         DiscoveryClient discoveryClient = new DiscoveryClient(discoveryEndpoint);

         FindCriteria findCriteria = new FindCriteria();
         findCriteria.Duration = TimeSpan.FromSeconds(5);
         findCriteria.ContractTypeNames.Add(new System.Xml.XmlQualifiedName("PrintDeviceType", "http://schemas.microsoft.com/windows/2006/08/wdp/print"));

         FindResponse findResponse = discoveryClient.Find(findCriteria);

to doscover my printer. This seems to return two endpoints one for my Web enabled WebCam and one for my printer. The printer entry three ContractTypeNames, one for devprof:Device, one for print:PrintDeviceType, and one for scan:ScanDeviceType which matches my expectations. The associated endpointAddress contains a URI that looks like:

{urn:uuid:e3248000-80ce-11db-8000-008092965229}

I was half expecting this to be an IP address or similar http://192.168.1.143 would be nice as that's the address of the printer.

My question is two fold, why does the line:

findCriteria.ContractTypeNames.Add(new System.Xml.XmlQualifiedName("PrintDeviceType", "http://schemas.microsoft.com/windows/2006/08/wdp/print"));

not limit the findings to just my printer? And how do I obtain the actual IP address?

Many thanks

Martin

dotnet-csharpwindows-server-print
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ElevenYu-MSFT avatar image
0 Votes"
ElevenYu-MSFT answered

Hi,

not limit the findings to just my printer

As per below article, a WSDAPI client first queries the device for complete descriptions of its services. While devices may include zero or more services. So, the WebCam might also include service that support scanning or any other related service.
https://docs.microsoft.com/en-us/windows/win32/wsdapi/about-web-services-for-devices

how do I obtain the actual IP address

From the description " When a device is manufactured, it is given a globally unique identifier, represented as a UUID URI. This identifier will never change for the device. When the device is powered on, it will always announce its logical address via a WS-Discovery Hello message", I think it should be an expected behavior that the associated endpoint Address contains a URI.

Hope the information can help you.

Thanks,
Eleven

If the Answer is helpful, please click "Accept Answer" and upvote it. Thanks.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MartinWaller-0619 avatar image
0 Votes"
MartinWaller-0619 answered ElevenYu-MSFT commented

Hi Eleven,

Many thanks for the answer, I'll check out the document.

Martin

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

OK, you can accept Answer" and upvote it if the Answer is helpful. And feel free to contact us if you have any further question.

0 Votes 0 ·