Hello,
I would like to know if it's possible using reflection to loop through
all "web references" of a given assembly and get the url as specified
in the web.config (dynamic url behavior).
Something like
for each objWebRef in [Assembly].GetWebReferences
Msgbox(objWebRef.url)
next
Thanks,
Alex 6 1739
alexbf <al****@gmail.comwrote:
I would like to know if it's possible using reflection to loop through
all "web references" of a given assembly and get the url as specified
in the web.config (dynamic url behavior).
Something like
for each objWebRef in [Assembly].GetWebReferences
Msgbox(objWebRef.url)
next
Web references don't really work like that - they're just autogenerated
proxy classes which are built into the "main" assembly.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
On Aug 29, 3:59 pm, Jon Skeet [C# MVP] <sk...@pobox.comwrote:
alexbf <ale...@gmail.comwrote:
I would like to know if it's possible using reflection to loop through
all "web references" of a given assembly and get the url as specified
in the web.config (dynamic url behavior).
Something like
for each objWebRef in [Assembly].GetWebReferences
Msgbox(objWebRef.url)
next
Web references don't really work like that - they're just autogenerated
proxy classes which are built into the "main" assembly.
Yes I am aware of that... so basically, I am looking for a way to loop
through those "autogenerated proxy classes" to get the URL...
If I take the problem differently.. how can I distinguish between a
normal class and a "autogenerated proxy class"? Using reflection, can
I do a loop on classes that inherits from
"System.Web.Services.Protocols.SoapHttpClientProto col"?
If so, how?
Thanks,
Alex
alexbf <al****@gmail.comwrote:
Web references don't really work like that - they're just autogenerated
proxy classes which are built into the "main" assembly.
Yes I am aware of that... so basically, I am looking for a way to loop
through those "autogenerated proxy classes" to get the URL...
If I take the problem differently.. how can I distinguish between a
normal class and a "autogenerated proxy class"? Using reflection, can
I do a loop on classes that inherits from
"System.Web.Services.Protocols.SoapHttpClientProto col"?
Absolutely. Use Type.IsSubclassOf or Type.IsAssignableFrom. Of course,
there could be other subclasses there, but it's a reasonable
indication...
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
On Aug 29, 4:44 pm, Jon Skeet [C# MVP] <sk...@pobox.comwrote:
alexbf <ale...@gmail.comwrote:
Web references don't really work like that - they're just autogenerated
proxy classes which are built into the "main" assembly.
Yes I am aware of that... so basically, I am looking for a way to loop
through those "autogenerated proxy classes" to get the URL...
If I take the problem differently.. how can I distinguish between a
normal class and a "autogenerated proxy class"? Using reflection, can
I do a loop on classes that inherits from
"System.Web.Services.Protocols.SoapHttpClientProto col"?
Absolutely. Use Type.IsSubclassOf or Type.IsAssignableFrom. Of course,
there could be other subclasses there, but it's a reasonable
indication...
If I try that :
Dim objClasse As Type
For Each objClasse In
[Assembly].GetExecutingAssembly.GetTypes()
Response.Write("// " & objClasse.Name & vbcrlf)
If
objClasse.IsAssignableFrom(GetType(System.Web.Serv ices.Protocols.SoapHttpClientProtocol))
Then
Response.Write("// WebService! " & objClasse.Name
& vbcrlf)
End If
Next
No proxy class shows up... as if they are not returned by "GetTypes()"
Is there another way to loop through classes?
Thanks,
Alex
alexbf <al****@gmail.comwrote:
If I try that :
Dim objClasse As Type
For Each objClasse In
[Assembly].GetExecutingAssembly.GetTypes()
Response.Write("// " & objClasse.Name & vbcrlf)
If
objClasse.IsAssignableFrom(GetType(System.Web.Serv ices.Protocols.SoapHttpClientProtocol))
Then
Response.Write("// WebService! " & objClasse.Name
& vbcrlf)
End If
Next
No proxy class shows up... as if they are not returned by "GetTypes()"
Is there another way to loop through classes?
IsAssignableFrom works the other way round. You should call it on the
SoapHttpClientProtocol type, passing in objClasse.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
On Aug 29, 5:33 pm, Jon Skeet [C# MVP] <sk...@pobox.comwrote:
alexbf <ale...@gmail.comwrote:
If I try that :
Dim objClasse As Type
For Each objClasse In
[Assembly].GetExecutingAssembly.GetTypes()
Response.Write("// " & objClasse.Name & vbcrlf)
If
objClasse.IsAssignableFrom(GetType(System.Web.Serv ices.Protocols.SoapHttpCl*ientProtocol))
Then
Response.Write("// WebService! " & objClasse.Name
& vbcrlf)
End If
Next
No proxy class shows up... as if they are not returned by "GetTypes()"
Is there another way to loop through classes?
IsAssignableFrom works the other way round. You should call it on the
SoapHttpClientProtocol type, passing in objClasse.
--
Jon Skeet - <sk...@pobox.com>http://www.pobox.com/~skeet Blog:http://www..msmvps.com/jon.skeet
If replying to the group, please do not mail me too- Hide quoted text -
- Show quoted text -
Thank you Jon, it works perfectly.
Here's my final code :
Dim objType As Type
Dim objWS As
System.Web.Services.Protocols.SoapHttpClientProtoc ol
For Each objType In
[Assembly].GetExecutingAssembly.GetTypes()
If
GetType(System.Web.Services.Protocols.SoapHttpClie ntProtocol).IsAssignableFrom(objType)
Then
'// The class is a webservice
objWS = Activator.CreateInstance(objType)
MsgBox("WebService : " & objType.Name & " - """ &
objWS.Url & """")
End If
Next
Best regards,
Alex http://www.xicommunity.ca http://www.myriadsuite.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Derek Hart |
last post by:
I wish to execute code from a string. The string will have a function name,
which will return a string:
Dim a as string
a = "MyFunctionName(param1, param2)"
I have seen a ton of people...
|
by: John |
last post by:
I have a class the reads in a file and sets the values of the file into its
properties. This class is used to populate the data onto a form. This form
has controls created at runtime based on...
|
by: Jimi |
last post by:
Given a C# project file path, can I use reflection to get all the
assemblies referenced by the project?
e.g., I know the path of a C# project, say, "c:\SomeProject.csproj",
and I want to load...
|
by: forvino |
last post by:
Hi Geeks,
Ihave a doubt in dotNet reflection. I m developing a tool which will
returns set of public(access specifier) methods of the selected
assembly.
this works completely fine,...
|
by: ECathell |
last post by:
I have a routine that compares 2 intances of the same object to see if there are any changes. The problem is that even though there are no changes, it tells me there are. I have even tried running a...
|
by: |
last post by:
I am having problems with casting or converting a class to to an interface
from which it derives. I'm certain that it's due to how it's being loaded,
but I'm not sure how to get past the problem....
|
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= |
last post by:
I have a C# logging assembly with a static constructor and methods that is
called from another C# Assembly that is used as a COM interface for a VB6
Application. Ideally I need to build a file...
|
by: Michael Sander |
last post by:
Hello ng,
anyone knowns how to add a reference to an assembly to
System.Reflection.AssemblyBuilder?
In System.Web.Compilation.AssemblyBuilder is a function like
AddAssemblyReference, but not in...
|
by: Cralis |
last post by:
Hi guys,
Someone once said, 'You can do that with reflection'. I can't recall
what it was I was trying to do at the time, but then he said, 'Any
developer knows what reflection is...'. I kept...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |