473,804 Members | 3,247 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebService

I have to write a program to pass data through a web service, Ill use two
strongly typed dataset enbedded in a library class, a "request" and an
"answer" dataset.
I've wrote the program and the web service and placed in the references the
library class, but when I tried to use the web method, I coudn't pass the
dataset of the library class. The web service has changed the reference to
the dataset and I have to reference the dataset of the web service!?! But
why if they are the same datasets? Why the web service has to change the
namespace of my library class?

Web service:

public class Test: System.Web.Serv ices.WebService {

public Test(){}
[WebMethod]

public LibraryClass.An swer SetDataSet(Libr aryClass.Reques t dsRequest)

{

LibraryClass.An swer dsAnswer=new LibreryClass.An swer();

....

return dsAnswer;

}

}

When I try in the program to use the web service method SetDataSet, it gives
me the following info:

"test" is the reference name of the web service

test.Test wsTest=new test.Test();

"test.Answe r Test.SetDataSet (test.Request dsRequest)"

Why it changes the reference of LibraryClass to "test"?


Nov 15 '05 #1
2 1926
This happens because the relatively simple-minded WSDL.exe utility creates a
new wrapper class named test.LibraryCla ss, and *that* is what's returned
from the web service proxy. You can see this yourself if you look at the
proxy code generated by Visual Studio. Follow thse steps:

- Open Solution Explorer, and click the Show All Files icon (it looks like
a set of documents - hover to get the tooltip)
- Expand your web reference through the reference.map subtree - there will
be a C# file down there somewhere.
- If you open the file, you'll see the definition of text.LibraryCla ss.

So there you are. Assuming you want to reference, the One True LibraryClass
assembly, and not the ersatz shadow given to you by Visual Studio, you can
modify the source in this C# file, but be aware that:
- You'll need to have the type broken out into an assembly that is shared
by client and web service.
- This file will be overwritten when you update the web service reference.
You can mitigate the pain by saving the modified version of the file, and
using a diff tool after updates.
- You'll open up a possibility of type versioning issues when the client
and server versions of the assembly drift. If types have different XML
serialization semantics, you'll have unexpected results.

Here's what you can do:
- Remove the definition of the test.ClassLibra ry type from the reference C#
file.
- Optionally, add a using statement to this C# file to include the
namespace.
- Add a reference to the assembly that defines the ClassLibrary type

Recompile - it should work. Or at least it might work, if I didn't leave any
steps out ;) Seriously, we have a few applications that use a similar
approach, except that we generally have a client-side assembly that rolls-up
all of the client-side proxies. The problem is that it add a bit more work
to the management of your client-side code, although it does make it
possible to share types among multiple endpoints.

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com
"Zürcher See" <aq****@cannabi smail.com> wrote in message
news:O%******** ********@TK2MSF TNGP10.phx.gbl. ..
I have to write a program to pass data through a web service, Ill use two
strongly typed dataset enbedded in a library class, a "request" and an
"answer" dataset.
I've wrote the program and the web service and placed in the references the library class, but when I tried to use the web method, I coudn't pass the
dataset of the library class. The web service has changed the reference to
the dataset and I have to reference the dataset of the web service!?! But
why if they are the same datasets? Why the web service has to change the
namespace of my library class?

Web service:

public class Test: System.Web.Serv ices.WebService {

public Test(){}
[WebMethod]

public LibraryClass.An swer SetDataSet(Libr aryClass.Reques t dsRequest)

{

LibraryClass.An swer dsAnswer=new LibreryClass.An swer();

....

return dsAnswer;

}

}

When I try in the program to use the web service method SetDataSet, it gives me the following info:

"test" is the reference name of the web service

test.Test wsTest=new test.Test();

"test.Answe r Test.SetDataSet (test.Request dsRequest)"

Why it changes the reference of LibraryClass to "test"?


Nov 15 '05 #2
Thanks, but I've found another problem, and a solution for both. The data I
have to send are too big, more the 10 MB, yes you can change the
configuration of the webserver ....
Because the dataset of the webservice and LibraryClass are the same, I copy
the rows from one to the other

WebServiceDataS et.Request.Rows .Add(row.ItemsA rray());

I copy about 2 MB, and I post it, get the answer, copy the rows from the
webservice answer table to my libraryclass dataset table, and so on till i
sended all the data.

I know, it's not very "clean", but so I lost two problems in one.

Thank's for the help anyway

"Mickey Williams" <my first name at servergeek.com> schrieb im Newsbeitrag
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
This happens because the relatively simple-minded WSDL.exe utility creates a new wrapper class named test.LibraryCla ss, and *that* is what's returned
from the web service proxy. You can see this yourself if you look at the
proxy code generated by Visual Studio. Follow thse steps:

- Open Solution Explorer, and click the Show All Files icon (it looks like a set of documents - hover to get the tooltip)
- Expand your web reference through the reference.map subtree - there will be a C# file down there somewhere.
- If you open the file, you'll see the definition of text.LibraryCla ss.

So there you are. Assuming you want to reference, the One True LibraryClass assembly, and not the ersatz shadow given to you by Visual Studio, you can
modify the source in this C# file, but be aware that:
- You'll need to have the type broken out into an assembly that is shared
by client and web service.
- This file will be overwritten when you update the web service reference. You can mitigate the pain by saving the modified version of the file, and
using a diff tool after updates.
- You'll open up a possibility of type versioning issues when the client
and server versions of the assembly drift. If types have different XML
serialization semantics, you'll have unexpected results.

Here's what you can do:
- Remove the definition of the test.ClassLibra ry type from the reference C# file.
- Optionally, add a using statement to this C# file to include the
namespace.
- Add a reference to the assembly that defines the ClassLibrary type

Recompile - it should work. Or at least it might work, if I didn't leave any steps out ;) Seriously, we have a few applications that use a similar
approach, except that we generally have a client-side assembly that rolls-up all of the client-side proxies. The problem is that it add a bit more work
to the management of your client-side code, although it does make it
possible to share types among multiple endpoints.

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com
"Zürcher See" <aq****@cannabi smail.com> wrote in message
news:O%******** ********@TK2MSF TNGP10.phx.gbl. ..
I have to write a program to pass data through a web service, Ill use two strongly typed dataset enbedded in a library class, a "request" and an
"answer" dataset.
I've wrote the program and the web service and placed in the references

the
library class, but when I tried to use the web method, I coudn't pass the dataset of the library class. The web service has changed the reference to the dataset and I have to reference the dataset of the web service!?! But why if they are the same datasets? Why the web service has to change the
namespace of my library class?

Web service:

public class Test: System.Web.Serv ices.WebService {

public Test(){}
[WebMethod]

public LibraryClass.An swer SetDataSet(Libr aryClass.Reques t dsRequest)
{

LibraryClass.An swer dsAnswer=new LibreryClass.An swer();

....

return dsAnswer;

}

}

When I try in the program to use the web service method SetDataSet, it

gives
me the following info:

"test" is the reference name of the web service

test.Test wsTest=new test.Test();

"test.Answe r Test.SetDataSet (test.Request dsRequest)"

Why it changes the reference of LibraryClass to "test"?



Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
425
by: DraguVaso | last post by:
Hi, I'm new to WebServices, and I'm doing some tests (with a small VB.NET-application) to know the performance-difference between a WebService and the 'normal'-way of getting data (just connecting directly with a SqlDataAdapter to the SQL Server). The WebMethod simply gives a DataSet back, and does exactly the same actions as the normal-Method does. The difference are enormous in my opinion: 1 record:
6
768
by: Davie | last post by:
I want to authorise a user of a web service by using the AuthHeaderValue for some reason I keep getting a null reference exception when I try to run the following code: It seems to work fine on a .NET Framework application, but just not on the .NET CF version. Can anyone suggest anything that might be wrong with the code? (I could post the app and webservice, but i was hoping that you might have noticed something from the supplied...
1
2113
by: Nalaka | last post by:
Hi, I am testing with Visual studio 2005, web projects. Situation: I have one solution with two web projects, created as file system projects. (I am tesing using the built in server, not IIS) First project is a webService. Second consumes the webservices by the first.
2
5714
by: Miguel | last post by:
Hi, I'm developing an application in C# with Windows Forms for my company that is similar to the MSN Messenger. This application uses a webservice for registering users, etc... and as 2 webbrowser controls on it. Besides that i'm using the firewall client for isa server 2004 and it seems that the browsers aren't able to pass thru it... if i disable the firewall the browsers work fine, if i don't, the 2 browsers just stay there...
7
2029
by: Alessandro Benedetti | last post by:
Hi. I'm calling two methods of a .NET Webservice (A) from another Webservice (B). The A Webservice is made like this: public class WSA: System.Web.Services.WebService { private int X = 0;
7
2929
by: Nalaka | last post by:
Hi, I created a sinple web service that returns a dataSet. Then I created a client program that uses this web service (that returns the Dataset). My question is, how did the client figure out to create a "DataSet" as the return type from the webservice?
5
3800
by: AliR | last post by:
Hi Everyone, I have a Visual C++ MFC program, and I am trying to use a webservice written in C#. When I add the webservice to my project using Add Web Reference the sproxy compiler complains about one of the object wanting to extend MarshalByRefObject object, and I get an error SDL1030. I can use the webservice in a C# project just fine but not the C++. Can anyone help me out with this?
5
6279
by: | last post by:
Hi, How long do webservice objects live for? In particular, if i have static variables filled with data from a static constructor in a webservice, how long will that data persist? thxs
0
2682
by: =?Utf-8?B?TWFuaQ==?= | last post by:
Hi All, Problem in deploying my WebService developed using Asp.net WebServices 2005. I have designed simple WebService using Asp.net Webservices 2.0 , The webservice look this , using System; using System.Web; using System.Web.Services; using System.Web.Services.Protocols;
4
8064
by: =?Utf-8?B?QmlsbEF0V29yaw==?= | last post by:
Hi, We recently converted a 1.1 project to 2.0 and this included a webservice which accepted XML for one of the parameters. Since converting to 2.0 I am getting the following message: --- A potentially dangerous Request.Form value was detected from the client (myparam="<root><blah...."). --- The fix used for ASPX pages is to include the @Page directive with
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9588
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10327
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7625
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2999
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.