473,385 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Web Service Question

Hi there,
I'm new to web services. I'm writing a basic file maintenance
application in asp.net. For example I'll fill a grid with all the records
from a table, then allow the user to select a record (row) and I'll show the
individual fields of the row in the form. The user can update the fields and
then I'd like to send the fields back through a web service for updating.
I've tried to specify a custom class as the parameter. See the example
below. My problem is that when I specify the class as a paramenterin the
client application I get a compile time error "Value of type
"IdealClass.atyMaint' cannot be converted to
'Ideal.updAccountType.atymaint." Atymaint is the name of my class. I have
this class defined in a project that is separate from my web service project
and my client project. I then reference this class from both the web service
and client projects. See the excerpts below.

From IdealClass project in atyMaint.vb

Public Class atyMaint

Public AMTYP as string
Public AMDESC as string
Public AMPRICE as string

End Class

From client project

dim atymaint as new idealclass.atymaint

atymaint.amtyp = me.txttype.text
atymaint.amdesc = me.txtdesc.text
atymaint.amprice = me.txtprice.text

dimWebservice as new updAccountType.updAccountType
errMsgString = Webservice.updAccountType(atymaint)

From web service project

<WebMethod () > _
Pubic Function updAccountType(ByVal atymaint as IdealClass.atyMaint) as
string

... stuff

End Function
Nov 19 '05 #1
1 1461
Hiya! :)

I hope I can provide some help for you, but I'm not quite sure of all the
details as I have forgotten all about VB since C# arrived. ;) Anyway, here's
some hints that might get it working..

When using a web reference you have to use the generated proxy class
'Ideal.updAccountType.atymaint' instead of 'IdealClass.atyMaint'. If you
want to do some plumbing, (and repetitive work :P) you can fix this by
clicking "Show all files" in the Solution Explorer, navigate to your web
reference, expand it and it's Reference.map document. Inside you should find
Reference.vb. Comment out the proxy class, and replace all references to
atyMaint with IdealClass.atyMaint. You have to redo this every time you
update the web reference. In addition, you have to specify how
IdealClass.atyMaint should serialize as XML. Add
<System.Xml.Serialization.XmlRoot("atyMaint")> above Public Class atyMaint,
and <System.Xml.Serialization.XmlElement("AMTYP")> above Public AMTYP as
string etc.

There's a nice tool for generating web service proxy classes called wsdl.exe
included in the .net framework you can use to get rid of the update web
reference problem though. You can read more about it here:
http://msdn.microsoft.com/library/de...rviceProxy.asp
There's also a lot more info on web services in the same folder as that
article. ;)

HTH,
Lars-Erik
"be********@online.nospam"
<be********************@discussions.microsoft.co m> wrote in message
news:8D**********************************@microsof t.com...
Hi there,
I'm new to web services. I'm writing a basic file maintenance
application in asp.net. For example I'll fill a grid with all the records
from a table, then allow the user to select a record (row) and I'll show
the
individual fields of the row in the form. The user can update the fields
and
then I'd like to send the fields back through a web service for updating.
I've tried to specify a custom class as the parameter. See the example
below. My problem is that when I specify the class as a paramenterin the
client application I get a compile time error "Value of type
"IdealClass.atyMaint' cannot be converted to
'Ideal.updAccountType.atymaint." Atymaint is the name of my class. I
have
this class defined in a project that is separate from my web service
project
and my client project. I then reference this class from both the web
service
and client projects. See the excerpts below.

From IdealClass project in atyMaint.vb

Public Class atyMaint

Public AMTYP as string
Public AMDESC as string
Public AMPRICE as string

End Class

From client project

dim atymaint as new idealclass.atymaint

atymaint.amtyp = me.txttype.text
atymaint.amdesc = me.txtdesc.text
atymaint.amprice = me.txtprice.text

dimWebservice as new updAccountType.updAccountType
errMsgString = Webservice.updAccountType(atymaint)

From web service project

<WebMethod () > _
Pubic Function updAccountType(ByVal atymaint as IdealClass.atyMaint) as
string

... stuff

End Function

Nov 19 '05 #2

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

Similar topics

1
by: Liza | last post by:
Hello, can you guys help me out here....? this is part of my masters degree and hence is very important to me..... my supervisor doesn't seem to be too interested in helping me and infact is...
5
by: Richard Steele | last post by:
I have created a WinForm application that needs to be run as a windows service (the PC is inaccesible by any user) i have successfully installed the application as a windows service. When i start...
2
by: Tom Simpson | last post by:
I have set up a Windows service in VB.NET, and created a 'Service Manager' Windows Forms app that can 'get' information from that service. The service consists of the basic service 'framework'...
2
by: John A | last post by:
I have a Web Service that I am reponsible for that we use for data integration purposes. Recently I have been tasked with sending some of this data to a third party. Because they need to receive...
17
by: UJ | last post by:
Is there any way for a windows service to start a windows program ? I have a service that will need to restart a windows app if it needs to. TIA - Jeff.
2
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app...
5
by: Tom | last post by:
Using multiple System.Timers.Timer objects in a Windows Service for performing multi-thread activities in a periodic fashion. Timers are AutoReset=false, to only have a single timer execution...
6
by: Joseph Geretz | last post by:
I have the following class which I am serializing and passing back and forth between my Web Service application and the client. public class Token : SoapHeader { public string SID; public...
5
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name?...
2
by: =?Utf-8?B?bXVyYWRqYW1lcw==?= | last post by:
Yes, sorry I tried to make it clear in the original question that I want to get the user token of the service - ie. the account the service is running under. I know services don't have user tokens...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.