Namespaces problem??

R

Raed Sawalha

I have create a Component using Class Library the namespace isn imsgCOM
the imsgCOM has (one struct(structUser) , one enum(UsersEnum), and two
classes (SingleUser,MultiUsers))


then i created a web service and attach the reference for the component to
it.
the web service namespace is MsgWebServices.

I already have a windows application , in Form1.cs I attach in WebReferences
my WebService DLL
and in References the component DLL, the PROBLEM that when I use the
webservice namespace like

MsgWebServices then . to see the contents,, the structures and enums and
classes in the imsgCOM component is listed in webservice namespace ,,WHY
this happending .
the webservice and component using different name spaces and each has its
own DLL

why the content of component listed in webservices namespace?


Regards
 
P

Patrik Löwendahl [C# MVP]

This is a feuture ;)

Kidding aside,

When your webservice is exposing information about the returned types, it
does so as if the service owned the types itself. This will effectivly fool
the wsdl.exe, which creates your webservice proxy, to think that the types
should be in the same namespace as the service.

As far as I know, the only workaround for this problem is to put a reference
to the dll in your windows forms application as well.
 
R

Raed Sawalha

Got it thanx

Patrik Löwendahl said:
This is a feuture ;)

Kidding aside,

When your webservice is exposing information about the returned types, it
does so as if the service owned the types itself. This will effectivly fool
the wsdl.exe, which creates your webservice proxy, to think that the types
should be in the same namespace as the service.

As far as I know, the only workaround for this problem is to put a reference
to the dll in your windows forms application as well.

--
Patrik Löwendahl [C# MVP]
www.cshrp.net - "Elegant code by witty programmers"

Raed Sawalha said:
I have create a Component using Class Library the namespace isn imsgCOM
the imsgCOM has (one struct(structUser) , one enum(UsersEnum), and two
classes (SingleUser,MultiUsers))


then i created a web service and attach the reference for the component to
it.
the web service namespace is MsgWebServices.

I already have a windows application , in Form1.cs I attach in WebReferences
my WebService DLL
and in References the component DLL, the PROBLEM that when I use the
webservice namespace like

MsgWebServices then . to see the contents,, the structures and enums and
classes in the imsgCOM component is listed in webservice namespace ,,WHY
this happending .
the webservice and component using different name spaces and each has its
own DLL

why the content of component listed in webservices namespace?


Regards
 
S

Scott Allen

If those types are used as parameters or return values from your web
method, the client has to know about the types in order to pass and
receive them. If they are an implementation detail and don't need to
be visible, use the internal keyword to limit their visibility.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top