class in Nested namespaces using WebService !arrrghhh 
Author Message
 class in Nested namespaces using WebService !arrrghhh

Hi all

Can someone tell me if there is some trick to using an instance of a web
service from within a class that belongs to a heavily (4 tiered) namespace.
I noticed in the ide that when I add the web reference and check the proxies
code it automatically has a namespace (generated by the ide) which takes on
the name of the project which has made the web reference and then the name
of the web reference itelf, ie

namespace TheProjectName.TheWebReference

This is all ok until I hit a project which has classes that are members of
the nested namespaces. I can in this scenario do this:

using ProjectName.WebReferenceName;

etc etc then declare

ProjectName.WebReference.ClassName ws = new
ProjectName.WebReference.ClassName();

The compiler will compile this no issue, however it doesnt really seem to
recognise the class despite allowing me to declare of it's type and it
certainly does not show up the publicly available methods of the web service
when I refer to the instance variable (as per ws above ie ws.MethodName();).

What Am I missing here?

TIA

Simon



Sun, 22 May 2005 15:18:49 GMT  
 class in Nested namespaces using WebService !arrrghhh
Simon,

    What I would do is generate the proxy yourself, using wsdl.exe.  With
this tool, you can create your proxy just like the ide, but you can also
specify the namespace you want the classes generated to be a part of.  This
way, you can change the namespace conflict you seem to be having.

    Hope this helps.

--
               - Nicholas Paldino [.NET/C# MVP]


Quote:
> Hi all

> Can someone tell me if there is some trick to using an instance of a web
> service from within a class that belongs to a heavily (4 tiered)
namespace.
> I noticed in the ide that when I add the web reference and check the
proxies
> code it automatically has a namespace (generated by the ide) which takes
on
> the name of the project which has made the web reference and then the name
> of the web reference itelf, ie

> namespace TheProjectName.TheWebReference

> This is all ok until I hit a project which has classes that are members of
> the nested namespaces. I can in this scenario do this:

> using ProjectName.WebReferenceName;

> etc etc then declare

> ProjectName.WebReference.ClassName ws = new
> ProjectName.WebReference.ClassName();

> The compiler will compile this no issue, however it doesnt really seem to
> recognise the class despite allowing me to declare of it's type and it
> certainly does not show up the publicly available methods of the web
service
> when I refer to the instance variable (as per ws above ie
ws.MethodName();).

> What Am I missing here?

> TIA

> Simon



Sun, 22 May 2005 21:40:24 GMT  
 class in Nested namespaces using WebService !arrrghhh
Thanks Nicholas

I will do as you suggested. Just for the record, since posting my problem
I tried to use this web service from another consumer app and placed
the class (consumer) in a three deep nested namespace. Again when
the ide generated a proxy it placed the last namespace of the consumers
nested trio in front of the proxies namespace which follows the name
of the web service ie namespace 3rdNestedNamespace.WebServiceName.
So I removed the first part (3rdNestedNamespace) and provided the following
using WebServiceName;
Rebuilt the solution and ok now it works. Try changed depths of the
consumers
namespace declaration and it still works.
Now the weird bit is that all yesterday I was doing exactly this from the
original
application that uses the web service and it would work but then late
yesterday
it began to work and I am not exactly sure what I did and what order to
encourage
the IDE to accept this.

SO in a nutshell I think I will definately be using wsdl.exe a bit more than
I anticipated
until perhaps vers 2.0 of VS.Net.

Thanks again Nicholas



Quote:
> Simon,

>     What I would do is generate the proxy yourself, using wsdl.exe.  With
> this tool, you can create your proxy just like the ide, but you can also
> specify the namespace you want the classes generated to be a part of.
This
> way, you can change the namespace conflict you seem to be having.

>     Hope this helps.

> --
>                - Nicholas Paldino [.NET/C# MVP]



> > Hi all

> > Can someone tell me if there is some trick to using an instance of a web
> > service from within a class that belongs to a heavily (4 tiered)
> namespace.
> > I noticed in the ide that when I add the web reference and check the
> proxies
> > code it automatically has a namespace (generated by the ide) which takes
> on
> > the name of the project which has made the web reference and then the
name
> > of the web reference itelf, ie

> > namespace TheProjectName.TheWebReference

> > This is all ok until I hit a project which has classes that are members
of
> > the nested namespaces. I can in this scenario do this:

> > using ProjectName.WebReferenceName;

> > etc etc then declare

> > ProjectName.WebReference.ClassName ws = new
> > ProjectName.WebReference.ClassName();

> > The compiler will compile this no issue, however it doesnt really seem
to
> > recognise the class despite allowing me to declare of it's type and it
> > certainly does not show up the publicly available methods of the web
> service
> > when I refer to the instance variable (as per ws above ie
> ws.MethodName();).

> > What Am I missing here?

> > TIA

> > Simon



Mon, 23 May 2005 06:55:25 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Using unmanaged nested classes of a managed class

2. dllexport with nested classes using templates

3. STL auto_ptr used for nested classes

4. Prob: templates using nested classes in VC++

5. Multiples WebServices with the same namespace

6. .NET Webservices and Namespace Prefixes

7. Namespace Conflict - c# Class Library used by Web Service and ASP.NET Web App

8. export classes using std namespace (ex std::vector) in a DLL

9. BUG?: Cannot use designer for UserControl in nested namespace

10. Nested Namespace Question

11. MSVC 5.0 BUG: Compiler Seizes up on Templates in Nested Namespace

12. BUG: nested namespaces and __declspec(dllexport)

 

 
Powered by phpBB® Forum Software