Matt,
Yes it's possible.
Here is an example --- WebService --- Service1.asmx.cs file looks like ---
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
namespace WebService1
{
/// <summary>
/// Summary description for Service1.
/// </summary>
public class Service1 : System.Web.Services.WebService
{
public Service1()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}
[WebMethod]
public MyStruct HelloStruct()
{
MyStruct str = new MyStruct();
str.message = "Hello World !" ;
return str ;
}
#region Component Designer generated code
//Required by the Web Services Designer
private IContainer components = null;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
#endregion
}
public struct MyStruct
{
public string message;
}
}
.... The client application will call the above as ...
localhost.Service1 svc = new WindowsApplication1.localhost.Service1() ;
localhost.MyStruct str = svc.HelloStruct() ;
MessageBox.Show(str.message) ;
If instead of a struct you wish to a class; you will have to specify set
accessors for all public properties. Need I mention, the logic of the class
doesn't come thru WSDL.
Regards,
- Sahil Malik
You can reach me thru my blog
http://www.dotnetjunkies.com/weblog/sahilmalik
"Matt D" <md**********@yahoo.com> wrote in message
news:is********************************@4ax.com...
In my web service project I've imported an assembly (that I also have
the source to) that contains structs that are serializable. I've
created some web service methods that return and take as parameters
some of these structures. When adding a web reference to a client that
consumes these web services, reference.cs doesn't contain a definition
for any of the structures in the assembly. I know I can add a
reference to the assembly directly in the client project to make it
work, but is there a way that I can make it work without doing this?
How can I expose these structures so they are part of the wsdl file
and thus have proxy stubs created for them? I would like clients to be
able to use these web services without having to download and add a
reference to their project. Thanks.
Matt