Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
| Search | Today's Posts | Mark Forums Read
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 18th, 2003, 11:40 AM
Registered User
 
Join Date: Sep 2003
Location: San Jose, Ca, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Retrieve printer information within a web service

I'm trying to retrieve the printer information of a computer using WMI and web services. I used this piece of code:

[WebMethod]
public String GetPrinter()
{
  oq = new System.Management.ObjectQuery("SELECT * FROM Win32_PrinterDriver");
  query = new ManagementObjectSearcher(oMs,oq);
  queryCollection = query.Get();
  Console.WriteLine(queryCollection.ToString());
  foreach ( ManagementObject mo in queryCollection)
  {
    return mo["Caption"].ToString();
  }
  return "done";
}

it works fine if i try it in command line but if i call it from a web service the query returns empty. The same piece of code works if i try to retrieve other information (i.e if i replace Win32_Printer by Win32_SoundCard or something else).

Does anybody have an idea of what i'm doing wrong?

Thanks for your help




Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieve System information by VBA powerz Access VBA 8 August 13th, 2013 03:49 PM
Web Service Consuming another web service CraigWhitfield EJB 0 January 10th, 2008 08:38 AM
sql queries to retrieve information from share po gurjar SharePoint Development 1 August 17th, 2007 12:26 PM
Service Oriented Web Service aldwinenriquez .NET Web Services 2 September 15th, 2005 03:25 AM
Sending Information to a Printer YoungLuke Classic ASP Basics 0 July 9th, 2003 05:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.