Web reference is a generated proxy class... 
Author Message
 Web reference is a generated proxy class...

... so how can I force it to use my types?
I need to use my struct as a returned value, but VSDesigner generates new
definition for it.
Can it use some my namespace?

Aleksey.



Mon, 07 Feb 2005 22:46:04 GMT  
 Web reference is a generated proxy class...
Just put the struct in the Web Services namespace. Then 'refresh' your web reference,
the proxy will be regenerated and you can use your struct in the client.

--
Robert Jeppesen
MindCom AB
http://www.mindcom.se/

Quote:

> ... so how can I force it to use my types?
> I need to use my struct as a returned value, but VSDesigner generates new
> definition for it.
> Can it use some my namespace?

> Aleksey.



Tue, 08 Feb 2005 02:00:59 GMT  
 Web reference is a generated proxy class...


Quote:
> Just put the struct in the Web Services namespace. Then 'refresh' your web
reference,
> the proxy will be regenerated and you can use your struct in the client.

I tried to put it in the another cs file in the namespace of proxy class and
even in System.Web.Services namespace - it does not help. What do you mean
by "Web Services namespace"?

Aleksey.

Quote:

> --
> Robert Jeppesen
> MindCom AB
> http://www.mindcom.se/




Quote:
> > ... so how can I force it to use my types?
> > I need to use my struct as a returned value, but VSDesigner generates
new
> > definition for it.
> > Can it use some my namespace?

> > Aleksey.



Tue, 08 Feb 2005 18:57:09 GMT  
 Web reference is a generated proxy class...
Quick sample, not sure if this will compile, but this is basically how to do it.. :)

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;

namespace MyWebService
{
 public struct Product
 {
  public int ProductID;
  // Etc etc.
 }

 [WebService(Namespace="http://www.myurl.com/structsample/")]
 public class StructSample : System.Web.Services.WebService
 {
  public StructSample()
  {
  }

  [WebMethod]
  public Product GetProduct()
  {
   Product p = new Product();
   p.ProductID = 234256;
   return p;
  }
 }

Quote:
}

--
Robert Jeppesen
MindCom AB
http://www.mindcom.se/
Quote:



> > Just put the struct in the Web Services namespace. Then 'refresh' your web
> reference,
> > the proxy will be regenerated and you can use your struct in the client.

> I tried to put it in the another cs file in the namespace of proxy class and
> even in System.Web.Services namespace - it does not help. What do you mean
> by "Web Services namespace"?

> Aleksey.

> > --
> > Robert Jeppesen
> > MindCom AB
> > http://www.mindcom.se/



> > > ... so how can I force it to use my types?
> > > I need to use my struct as a returned value, but VSDesigner generates
> new
> > > definition for it.
> > > Can it use some my namespace?

> > > Aleksey.



Tue, 08 Feb 2005 19:34:44 GMT  
 Web reference is a generated proxy class...
using C# we began to understand each other... :-)

In your sample the definition of struct Product will appear in the
...localhost\reference.cs in the
namespace my_client.localhost
but I already have it defined in
namespace my_server
and used in the
namespace my_client
so I forced to write some converter between
my_client.localhost.Product and my_server.Product
or to change the localhost\reference.cs every time after updating web
reference.

The question is how to say to Microsoft.VSDesigner to use
namespace my_server
while generating
the localhost\reference.cs? :-)

MyWebService uses this namespace and my_client too. But the
my_client.localhost which is between them cannot use this namespace... This
looks strange.

Aleksey.


Quote:
> Quick sample, not sure if this will compile, but this is basically how to
do it.. :)

> using System;
> using System.Collections;
> using System.ComponentModel;
> using System.Data;
> using System.Diagnostics;
> using System.Web;
> using System.Web.Services;

> namespace MyWebService
> {
>  public struct Product
>  {
>   public int ProductID;
>   // Etc etc.
>  }

>  [WebService(Namespace="http://www.myurl.com/structsample/")]
>  public class StructSample : System.Web.Services.WebService
>  {
>   public StructSample()
>   {
>   }

>   [WebMethod]
>   public Product GetProduct()
>   {
>    Product p = new Product();
>    p.ProductID = 234256;
>    return p;
>   }
>  }
> }

> --
> Robert Jeppesen
> MindCom AB
> http://www.mindcom.se/




- Show quoted text -

Quote:



> > > Just put the struct in the Web Services namespace. Then 'refresh' your
web
> > reference,
> > > the proxy will be regenerated and you can use your struct in the
client.

> > I tried to put it in the another cs file in the namespace of proxy class
and
> > even in System.Web.Services namespace - it does not help. What do you
mean
> > by "Web Services namespace"?

> > Aleksey.

> > > --
> > > Robert Jeppesen
> > > MindCom AB
> > > http://www.mindcom.se/



> > > > ... so how can I force it to use my types?
> > > > I need to use my struct as a returned value, but VSDesigner
generates
> > new
> > > > definition for it.
> > > > Can it use some my namespace?

> > > > Aleksey.



Tue, 08 Feb 2005 22:37:53 GMT  
 Web reference is a generated proxy class...
Hi,

Thank you, this thing really works.

Aleksey.


Quote:
> Hi,
> Don't define the struct in the namespace my_client.
> Use it through the web service only.
> I've attached a sample project with both client and service.
> You'll need to make a virtual directory to run it, but I'm sure you know
that. :)

> Hope this helps.

> --
> Robert Jeppesen
> MindCom AB
> http://www.mindcom.se/




Quote:
> > using C# we began to understand each other... :-)

> > In your sample the definition of struct Product will appear in the
> > ...localhost\reference.cs in the
> > namespace my_client.localhost
> > but I already have it defined in
> > namespace my_server
> > and used in the
> > namespace my_client
> > so I forced to write some converter between
> > my_client.localhost.Product and my_server.Product
> > or to change the localhost\reference.cs every time after updating web
> > reference.

> > The question is how to say to Microsoft.VSDesigner to use
> > namespace my_server
> > while generating
> > the localhost\reference.cs? :-)

> > MyWebService uses this namespace and my_client too. But the
> > my_client.localhost which is between them cannot use this namespace...
This
> > looks strange.

> > Aleksey.



> > > Quick sample, not sure if this will compile, but this is basically how
to
> > do it.. :)

> > > using System;
> > > using System.Collections;
> > > using System.ComponentModel;
> > > using System.Data;
> > > using System.Diagnostics;
> > > using System.Web;
> > > using System.Web.Services;

> > > namespace MyWebService
> > > {
> > >  public struct Product
> > >  {
> > >   public int ProductID;
> > >   // Etc etc.
> > >  }

> > >  [WebService(Namespace="http://www.myurl.com/structsample/")]
> > >  public class StructSample : System.Web.Services.WebService
> > >  {
> > >   public StructSample()
> > >   {
> > >   }

> > >   [WebMethod]
> > >   public Product GetProduct()
> > >   {
> > >    Product p = new Product();
> > >    p.ProductID = 234256;
> > >    return p;
> > >   }
> > >  }
> > > }

> > > --
> > > Robert Jeppesen
> > > MindCom AB
> > > http://www.mindcom.se/




message

> > > > > Just put the struct in the Web Services namespace. Then 'refresh'
your
> > web
> > > > reference,
> > > > > the proxy will be regenerated and you can use your struct in the
> > client.

> > > > I tried to put it in the another cs file in the namespace of proxy
class
> > and
> > > > even in System.Web.Services namespace - it does not help. What do
you
> > mean
> > > > by "Web Services namespace"?

> > > > Aleksey.

> > > > > --
> > > > > Robert Jeppesen
> > > > > MindCom AB
> > > > > http://www.mindcom.se/



> > > > > > ... so how can I force it to use my types?
> > > > > > I need to use my struct as a returned value, but VSDesigner
> > generates
> > > > new
> > > > > > definition for it.
> > > > > > Can it use some my namespace?

> > > > > > Aleksey.



Wed, 09 Feb 2005 01:55:53 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Web Services: Proxy class make own class definition for user class

2. Controlling namespaces for VS.NET generated web proxies

3. ATLSOAP: sproxy generated SOAP proxy class fails when server responses include unknown elements

4. Generating ATL Proxy class from the command line

5. Web reference vs local reference

6. Merge Proxy/stub (in ATL) generated DLL does not change the Proxystubclsid32

7. How to generate the proxy/stub with VC.NET

8. OverLaoding an interface function gives problem when generating the proxy - stb dll

9. error while generating the proxy/stub dll :

10. !dea: want to develop a tool like WSDL.exe to generate proxy for FLASH ActionScript

11. Creating a Web service proxy using WSDL.exe

12. proxy for web service

 

 
Powered by phpBB® Forum Software