Ask a Question related to ASP.NET Web Services, Design and Development.
-
Russ #1
Data transfer
I'm still very new to .NET. I managed to write a web service using
managed extensions for C++ and integrate it with existing business
logic. The web client is written in C#. To receive bunch of strings
from the server, the client does this:
String [] n = ws.GetEmployeeInfo (empno);
Name.Text = n [0];
Department.Text = n [1];
Type.Text = n [2];
Period.Text = n [3];
PayType.Text = n [4];
PayRate.Text = n [5];
CheckDate.Text = n [6];
This works, but now I need to retrieve more hetrogeneous data. What I
would like to do is create a class and pass it from the service to the
client (and vice versa at times). So the code would then look more
like:
MyClass data = ws.GetEmployeeInfo (empno);
Name.Text = data.Name;
Department.Text = data.Dept;
etc, and then I could have other data types in the class such as bool
and double..
My problem is how does the C++ service and the C# client each know
what the class looks like? Is there a way to put the class definition
in a header file and include it in both sources? I realize that the
data is passed via XML and so the field names and types are passed,
but again, how do I tell the server to use a class that the client
will understand?
I have tried to understand the concept of a dataset and see if it
could be used, but it incapsulates way more functionality than I need,
and I still don't see how the C++ web service can know what it looks
like, and how to fill it. This data does not come out of a relational
database, so using SQL, OleDB and OBDC does not make any sense (at
least to me).
Thanks for any help.
Russ
Russ Guest
-
Unable to transfer data
I have a connection problem in Contribute. The first time I connected it worked just fine. The second time it didn't work anymore. It shows an... -
Batch Transfer data into
I'm not sure if this is the right forum... I have a file with basically 2 fields - filename and subject - and 1000s of records I have 1000s of... -
How do I transfer data from one pg to the next pg?
I have a registration page that I would like to go to a welcome page when registration is complete. The welcome page will say "Welcome (name) your... -
perl data transfer
SRam wrote: TCP streams? Have a look at the Net:: family of modules via search.cpan.org Steffen -- @n=(,,,,,);$b=6;@c=' -/\_|'=~/./g... -
How to transfer data files...
I need help on file transfers, to and from, web servers to remote user computers. If anyone knows of a good reference I'd appreciate the tip. If... -
Dino Chiesa [Microsoft] #2
Re: Data transfer
"Russ" <russk2@eticomm.net> wrote in message
news:broeb0duam423u01hfio2jj11vrausliel@4ax.com...In C#, I would code a webmethod that does this, like so:> I'm still very new to .NET. I managed to write a web service using
> managed extensions for C++ and integrate it with existing business
> logic. The web client is written in C#. To receive bunch of strings
> from the server, the client does this:
>
> String [] n = ws.GetEmployeeInfo (empno);
> Name.Text = n [0];
> Department.Text = n [1];
> Type.Text = n [2];
> Period.Text = n [3];
> PayType.Text = n [4];
> PayRate.Text = n [5];
> CheckDate.Text = n [6];
>
> This works, but now I need to retrieve more hetrogeneous data. What I
> would like to do is create a class and pass it from the service to the
> client (and vice versa at times). So the code would then look more
> like:
>
> MyClass data = ws.GetEmployeeInfo (empno);
> Name.Text = data.Name;
> Department.Text = data.Dept;
>
public class MyClass {
public string Name;
public int Dept;
public bool Verified;
public AnotherClass[] ArrayOfSomething;
// etc....
}
[WebService]
public class MyService {
[webMethod]
public MyClass GetEmployeeInfo(int empno) {
....
}
}
Sorry I don't know the C++ syntax.
Yes, such classes as are used in the webservice are included in the WSDL> My problem is how does the C++ service and the C# client each know
> what the class looks like? Is there a way to put the class definition
> in a header file and include it in both sources?
(Webservices Definition Language), which is like an IDL (Interface
Definition language) file if you know CORBA or DCE. For the client-proxy
generation, you run "Add Web Reference" in visual studio, or you run
wsdl.exe if you develop with just the .NET SDK. You pass in the WSDL to
either of these, and the output is a client proxy, complete with a generated
version of "MyClass".
You don't. You generate a class for use within the client according to the> how do I tell the server to use a class that the client
> will understand?
>
published interface (the WSDL).
maybe this will help?
-Dino
Dino Chiesa [Microsoft] Guest
-
Russ #3
Re: Data transfer
Dino, thanks for your response. Having had the long holiday weekend
to mull it over I had come to the conclusion that I should try
something about like you showed. So I will try it and see if it
works. The only part that confuses me is in the client, where you do:
How does the client C# code know what MyClass looks like? I guess> public MyClass GetEmployeeInfo(int empno) {
this is some magic of the SOAP protocol, but I know that in C++ if I
tried to do that without declaring and defining the class first, I
would get a compile error.
Still, I will try it shortly (and report back here if I still cannot
make it work.)
Trying to learn about web programming AND C# at the same time is a
bear...
Thanks again, Russ
On Tue, 1 Jun 2004 15:55:03 -0400, "Dino Chiesa [Microsoft]"
<dinoch@online.microsoft.com> wrote:
>
>
>"Russ" <russk2@eticomm.net> wrote in message
>news:broeb0duam423u01hfio2jj11vrausliel@4ax.com.. .>>> I'm still very new to .NET. I managed to write a web service using
>> managed extensions for C++ and integrate it with existing business
>> logic. The web client is written in C#. To receive bunch of strings
>> from the server, the client does this:
>>
>> String [] n = ws.GetEmployeeInfo (empno);
>> Name.Text = n [0];
>> Department.Text = n [1];
>> Type.Text = n [2];
>> Period.Text = n [3];
>> PayType.Text = n [4];
>> PayRate.Text = n [5];
>> CheckDate.Text = n [6];
>>
>> This works, but now I need to retrieve more hetrogeneous data. What I
>> would like to do is create a class and pass it from the service to the
>> client (and vice versa at times). So the code would then look more
>> like:
>>
>> MyClass data = ws.GetEmployeeInfo (empno);
>> Name.Text = data.Name;
>> Department.Text = data.Dept;
>>
>In C#, I would code a webmethod that does this, like so:
>
> public class MyClass {
> public string Name;
> public int Dept;
> public bool Verified;
> public AnotherClass[] ArrayOfSomething;
> // etc....
> }
>
> [WebService]
> public class MyService {
> [webMethod]
> public MyClass GetEmployeeInfo(int empno) {
> ....
> }
> }
>
>Sorry I don't know the C++ syntax.
>
>>>> My problem is how does the C++ service and the C# client each know
>> what the class looks like? Is there a way to put the class definition
>> in a header file and include it in both sources?
>Yes, such classes as are used in the webservice are included in the WSDL
>(Webservices Definition Language), which is like an IDL (Interface
>Definition language) file if you know CORBA or DCE. For the client-proxy
>generation, you run "Add Web Reference" in visual studio, or you run
>wsdl.exe if you develop with just the .NET SDK. You pass in the WSDL to
>either of these, and the output is a client proxy, complete with a generated
>version of "MyClass".
>
>
>>>> how do I tell the server to use a class that the client
>> will understand?
>>
>You don't. You generate a class for use within the client according to the
>published interface (the WSDL).
>
>maybe this will help?
>
>-Dino
>
>Russ Guest
-
Dino Chiesa [Microsoft] #4
Re: Data transfer
> works. The only part that confuses me is in the client, where you do:
Maybe you figured this out by now but....that GetEmployeeInfo method is>>> > public MyClass GetEmployeeInfo(int empno) {
> How does the client C# code know what MyClass looks like? I guess
exposed in the WSDL, which is the interface definition. When you build the
client, you run wsdl.exe (or "Add Web Ref") and the client-side proxy class
that is generated includes a definition for MyClass.
Dino Chiesa [Microsoft] Guest
-
Russ #5
Re: Data transfer
Yes, I did figure it out. Thanks much for your help.
Russ
On Wed, 2 Jun 2004 15:22:15 -0400, "Dino Chiesa [Microsoft]"
<dinoch@online.microsoft.com> wrote:
>>> works. The only part that confuses me is in the client, where you do:
>>>>>> > public MyClass GetEmployeeInfo(int empno) {
>> How does the client C# code know what MyClass looks like? I guess
>Maybe you figured this out by now but....that GetEmployeeInfo method is
>exposed in the WSDL, which is the interface definition. When you build the
>client, you run wsdl.exe (or "Add Web Ref") and the client-side proxy class
>that is generated includes a definition for MyClass.
>
>Russ Guest



Reply With Quote

