using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Services.Protocols;
using WebServiceAccessReports.ufddbreportservices;
namespace WebServiceAccessReports
{
class Program
{
static void Main(string[] args)
{
ReportingService2005 rs = new ReportingService2005();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
string report = "/154";
bool forRendering = false;
string historyID = null;
ParameterValue[] values = null;
DataSourceCredentials[] credentials = null;
ReportParameter[] parameters = null;
try
{
parameters = rs.GetReportParameters(report, historyID,
forRendering, values, credentials);
if (parameters != null)
{
foreach (ReportParameter rp in parameters)
{
Console.WriteLine("Name: {0}", rp.Name);
}
}
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.InnerXml.ToString());
}
}
}
}
I need some help converting the code to produce a dll or something else in
order to run this application from non .net environments.
TIA
>I have the following code for a console application that I got from a MS
>web site:
<snip>
> I need some help converting the code to produce a dll or something else in
> order to run this application from non .net environments.
1) Decide which language you want to use to write your DLL. C++ is still
widely used for such programming tasks, but by no means your only choice.
2) Once you've made your decision, post your question in a newsgroup
dedicated to that language - you'll (almost) certainly get a far better and
quicker response...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
"Mark Rae [MVP]" <ma...@markNOSPAMrae.net> wrote in message
news:OTTrlfvX...@TK2MSFTNGP06.phx.gbl...
[please don't top-post]
>>> I need some help converting the code to produce a dll or something else
>>> in order to run this application from non .net environments.
>>
>> 1) Decide which language you want to use to write your DLL. C++ is still
>> widely used for such programming tasks, but by no means your only choice.
>>
>> 2) Once you've made your decision, post your question in a newsgroup
>> dedicated to that language - you'll (almost) certainly get a far better
>> and quicker response...
>
> A, I see. It's because CO# cannot produce a DLL?
You can create .NET assemblies as DLLs. You can make them COM-visible. You
can use a tool called regasm to make them work like Windows DLLs. However,
all of these still require the CLR.
If you want to create a "true" Windows DLL which doesn't require the .NET
Framework, you'll need to use something other than C# or any other managed
programming language.
What "non .net" environments do you mean?
Do you mean from Windows directly?
Do you mean from a non-Windows box on a private network?
Do you mean from a non-Windows box across the web?
You can write code in .NET that produces a .dll, and if you configure that
.dll properly, you can create a proxy that can be called from COM objects,
thus making your .NET .dll available to COM.
If you want your .NET .dll available over the web, you should expose the
class as a Web Service, which would allow Windoss and non-Windows platforms
alike the ability to consume your class(es).
But, if you want to strictly write .NET code that is immediately available
to non-.NET environments, that is not possible.
-Scott
"Scott M." <s-...@nospam.nospam> wrote in message
news:eyMQJJwX...@TK2MSFTNGP05.phx.gbl...
Then, you'll need to code the .NET code just as it is, but mark the assembly
as availble for COM InterOp in the project's properties.
Then, you can use the .NET "regasm.exe" tool, to generate a COM Callable
Wrapper (CCW) that your VB 6 application can make a reference to and use as
if the .NET assembly was a COM object the whole time.
There isn't anything you need to do to your C# code.
http://msdn.microsoft.com/en-us/library/w29wacsy(VS.80).aspx
-Scott
namespace WebServiceAccessReports
{
public class Program
{
static void Main(string[] args)
{
}
public string getParameters(string reportFile)
{
ReportingService2005 rs = new ReportingService2005();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
string report = reportFile;
bool forRendering = false;
string historyID = null;
string returnStr = "";
ParameterValue[] values = null;
DataSourceCredentials[] credentials = null;
ReportParameter[] parameters = null;
try
{
parameters = rs.GetReportParameters(report, historyID,
forRendering, values, credentials);
if (parameters != null)
{
foreach (ReportParameter rp in parameters)
{
returnStr = returnStr + " " + rp.Name;
//Console.WriteLine("Name: {0}", rp.Name);
}
}
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.InnerXml.ToString());
}
return returnStr;
}
}
}
I built it as a class library I ran regasm utility with no problem.
My question is: do I instantiate WebServiceAccessReports.Program or what?
Thanks for all the help.
"Scott M." <s-...@nospam.nospam> wrote in message
news:ex6892wX...@TK2MSFTNGP04.phx.gbl...
I know I'm going to regret this, but...
Can't you call the web service from VB 6?
--
Mike
"Family Tree Mike" <FamilyT...@ThisOldHouse.com> wrote in message
news:OXURT7yX...@TK2MSFTNGP04.phx.gbl...
> I know I'm going to regret this, but...
>
> Can't you call the web service from VB 6?
With the SOAP Toolkit, probably.
It looks like you have a Console application here, even though you built it
as a class libary. You should build this as a class library project from
the start. But yes, after you get your COM proxy, you just make an instance
of the class and use it as usual.
-Scott
Thanks agian.
"Scott M." <s-...@nospam.nospam> wrote in message
news:eWxjVFzX...@TK2MSFTNGP05.phx.gbl...
Not exactly sure since I'm not familiar with your entire setup, but I'd
Google the exact error you got for some ideas on what is the problem and
potential cures.
-Scott
It should work. It is COM based. VB6 use COM.
But it is an IDE from 1998 using a kit from 2003.
Not particular attractive.
Arne