473,385 Members | 1,843 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.

Add Web Service advice

Hello all

We have an SOA application that includes an ASP.NET webservice and WinForms
client. My question is regarding the use of Add Web Reference in Visual
Studio. The tool is nice because it easilly creates and updates the
client-side proxies that we need to communicate with the webservice. The
problem is that our webservice methods accept and return business objects
and when generating the proxies, VS creates scoped versions of these
business objects for use with the webservice methods.

It is undesirable to have the proxy generator create these business objects
for several reasons:

1. There are some references to business objects that exist on separate
webservices. For example, Customer.asmx has a GetCustomer method that
returns a Customer object and Invoicing.asmx has a CreateInvoice method that
takes a Customer object. These are the same customer object in both cases,
so it would make sense that we could call Customer.GetCustomer and then pass
the Customer object to Invoicing.CreateInvoice. The problem is that the
proxy generator creates scoped versions of Customer when generating the
proxy for both webservices, which means a CustomerProxy.Customer cannot be
passed to a method expecting a InvoicingProxy.Customer.

2. The business objects contain helper methods that should ideally be
available to the client application, so we'd like to continue to reference
the business object library from the client as well.

3. The web service proxy generator changes properties to fields in the
business objects. This prevents the WinForms combobox from being able to
databind to a collection of the object with the DisplayMember and
ValueMember properties set.

For this reason, it seems ideal that the Client and Webservice should both
reference the same business object class library, and that the Add Web
Reference tool NOT create scoped versions of the business objects. Right
now, we are getting around the behavior of Add Web Reference by using
WSDL.exe to generate a proxy class and then removing the business object
definitions by hand. This is a bit tedious, however, and I would like to be
able to use Add Web Reference's functionality to both add new proxies and
update existing ones as the webservice changes.

Does anyone have any advice on what we can do here?

Thanks,
Eric
Nov 23 '05 #1
6 1850
Hi Eric,

I'm having this problem too. I want to return business objects from a web
service.
I delete the custom class which is generated in the proxy, I then add a
reference to the business object class library. I can return an object
fine, the trouble is when i try to deserialise it at the other end, the
object obtained is the object which is constructed by the default
constructor. Ie. to reconstruct the object, the deserialisation process
seems to use the default constructor and thus the values are incorrect.

Can you tell me how you solve this problem ?

Many thanks.

"Eric Guthmann" <Er**********@discussions.microsoft.com> wrote in message
news:eM**************@TK2MSFTNGP10.phx.gbl...
Hello all

We have an SOA application that includes an ASP.NET webservice and
WinForms client. My question is regarding the use of Add Web Reference in
Visual Studio. The tool is nice because it easilly creates and updates
the client-side proxies that we need to communicate with the webservice.
The problem is that our webservice methods accept and return business
objects and when generating the proxies, VS creates scoped versions of
these business objects for use with the webservice methods.

It is undesirable to have the proxy generator create these business
objects for several reasons:

1. There are some references to business objects that exist on separate
webservices. For example, Customer.asmx has a GetCustomer method that
returns a Customer object and Invoicing.asmx has a CreateInvoice method
that takes a Customer object. These are the same customer object in both
cases, so it would make sense that we could call Customer.GetCustomer and
then pass the Customer object to Invoicing.CreateInvoice. The problem is
that the proxy generator creates scoped versions of Customer when
generating the proxy for both webservices, which means a
CustomerProxy.Customer cannot be passed to a method expecting a
InvoicingProxy.Customer.

2. The business objects contain helper methods that should ideally be
available to the client application, so we'd like to continue to reference
the business object library from the client as well.

3. The web service proxy generator changes properties to fields in the
business objects. This prevents the WinForms combobox from being able to
databind to a collection of the object with the DisplayMember and
ValueMember properties set.

For this reason, it seems ideal that the Client and Webservice should both
reference the same business object class library, and that the Add Web
Reference tool NOT create scoped versions of the business objects. Right
now, we are getting around the behavior of Add Web Reference by using
WSDL.exe to generate a proxy class and then removing the business object
definitions by hand. This is a bit tedious, however, and I would like to
be able to use Add Web Reference's functionality to both add new proxies
and update existing ones as the webservice changes.

Does anyone have any advice on what we can do here?

Thanks,
Eric

Nov 23 '05 #2
its better to use interfaces to construct webservices...

"Eric Guthmann" <Er**********@discussions.microsoft.com> wrote in message
news:eM**************@TK2MSFTNGP10.phx.gbl...
Hello all

We have an SOA application that includes an ASP.NET webservice and
WinForms client. My question is regarding the use of Add Web Reference in
Visual Studio. The tool is nice because it easilly creates and updates
the client-side proxies that we need to communicate with the webservice.
The problem is that our webservice methods accept and return business
objects and when generating the proxies, VS creates scoped versions of
these business objects for use with the webservice methods.

It is undesirable to have the proxy generator create these business
objects for several reasons:

1. There are some references to business objects that exist on separate
webservices. For example, Customer.asmx has a GetCustomer method that
returns a Customer object and Invoicing.asmx has a CreateInvoice method
that takes a Customer object. These are the same customer object in both
cases, so it would make sense that we could call Customer.GetCustomer and
then pass the Customer object to Invoicing.CreateInvoice. The problem is
that the proxy generator creates scoped versions of Customer when
generating the proxy for both webservices, which means a
CustomerProxy.Customer cannot be passed to a method expecting a
InvoicingProxy.Customer.

2. The business objects contain helper methods that should ideally be
available to the client application, so we'd like to continue to reference
the business object library from the client as well.

3. The web service proxy generator changes properties to fields in the
business objects. This prevents the WinForms combobox from being able to
databind to a collection of the object with the DisplayMember and
ValueMember properties set.

For this reason, it seems ideal that the Client and Webservice should both
reference the same business object class library, and that the Add Web
Reference tool NOT create scoped versions of the business objects. Right
now, we are getting around the behavior of Add Web Reference by using
WSDL.exe to generate a proxy class and then removing the business object
definitions by hand. This is a bit tedious, however, and I would like to
be able to use Add Web Reference's functionality to both add new proxies
and update existing ones as the webservice changes.

Does anyone have any advice on what we can do here?

Thanks,
Eric

Nov 23 '05 #3
Greetings Eric,

One of the issues you've identified is the need to share data types
between web service proxies. This feature will be available in .NET 2.0
(http://www.theserverside.net/blogs/s...StrikesBackP6),
however, this does not address your immediate requirement.

Thinktecture have a VS addin available called Web Service Contract
First that provides data type sharing today
(http://www.thinktecture.com/Resource.../default.html).
It also generates properties instead of fields, which was one of the
other issues you identified.

With reference to sharing behaviour between tiers, strictly speaking,
this is a violation of one of the tenents of service orientation,
however, as always, there are times when rules can be broken. An
example in this case would be to share validation logic between the
tiers (as the implementation of this behaviour will be exactly the same
in each tier). Perhaps you can factor this logic into helper classes
that you can share between tiers instead? I wouldn't recommend sharing
behaviour more complex than this though.

Hope this helps.

Cheers,
Matt

Nov 23 '05 #4
Hi Matt,

Thank you for your comments and advice. I'll take a look at the
ThinkTecture proxy generator.

I would like to followup on your comments about "tenents of service
orientation" in order to understand the issues better. I do understand that
in many cases webservices are intended to be used by multiple foreign
clients that have no formal connection with the webservice provider so there
is little if any opportunity to share business object libraries. In a case
where there is a base client application and webservice that are compiled as
a unit, though, are there other reasons not to use a shared business object
library? For a foreign client, a webservice proxy could still be generated
that contains proxy business object classes, but for our in-house client
this allows us to share a great deal of functionality.

Eric

"Matt Dunn" <ma*********@hotmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Greetings Eric,

One of the issues you've identified is the need to share data types
between web service proxies. This feature will be available in .NET 2.0
(http://www.theserverside.net/blogs/s...StrikesBackP6),
however, this does not address your immediate requirement.

Thinktecture have a VS addin available called Web Service Contract
First that provides data type sharing today
(http://www.thinktecture.com/Resource.../default.html).
It also generates properties instead of fields, which was one of the
other issues you identified.

With reference to sharing behaviour between tiers, strictly speaking,
this is a violation of one of the tenents of service orientation,
however, as always, there are times when rules can be broken. An
example in this case would be to share validation logic between the
tiers (as the implementation of this behaviour will be exactly the same
in each tier). Perhaps you can factor this logic into helper classes
that you can share between tiers instead? I wouldn't recommend sharing
behaviour more complex than this though.

Hope this helps.

Cheers,
Matt

Nov 23 '05 #5
Hi Clemens,

Are you referring to using a base WSDL contract to describe the webservice
and then using the WSDL contract to generate client proxy and webservice
skeletons? If so, we would still have the issue of the client proxy
generator creating separately scoped versions of the business object classes
for each webservice, and also fields being changed to properties. Or am I
missing something?

Thanks,
Eric

"Clemens Reijnen" <Cl************@hotmail.com> wrote in message
news:e$**************@TK2MSFTNGP12.phx.gbl...
its better to use interfaces to construct webservices...

"Eric Guthmann" <Er**********@discussions.microsoft.com> wrote in message
news:eM**************@TK2MSFTNGP10.phx.gbl...
Hello all

We have an SOA application that includes an ASP.NET webservice and
WinForms client. My question is regarding the use of Add Web Reference
in Visual Studio. The tool is nice because it easilly creates and
updates the client-side proxies that we need to communicate with the
webservice. The problem is that our webservice methods accept and return
business objects and when generating the proxies, VS creates scoped
versions of these business objects for use with the webservice methods.

It is undesirable to have the proxy generator create these business
objects for several reasons:

1. There are some references to business objects that exist on separate
webservices. For example, Customer.asmx has a GetCustomer method that
returns a Customer object and Invoicing.asmx has a CreateInvoice method
that takes a Customer object. These are the same customer object in both
cases, so it would make sense that we could call Customer.GetCustomer and
then pass the Customer object to Invoicing.CreateInvoice. The problem is
that the proxy generator creates scoped versions of Customer when
generating the proxy for both webservices, which means a
CustomerProxy.Customer cannot be passed to a method expecting a
InvoicingProxy.Customer.

2. The business objects contain helper methods that should ideally be
available to the client application, so we'd like to continue to
reference the business object library from the client as well.

3. The web service proxy generator changes properties to fields in the
business objects. This prevents the WinForms combobox from being able to
databind to a collection of the object with the DisplayMember and
ValueMember properties set.

For this reason, it seems ideal that the Client and Webservice should
both reference the same business object class library, and that the Add
Web Reference tool NOT create scoped versions of the business objects.
Right now, we are getting around the behavior of Add Web Reference by
using WSDL.exe to generate a proxy class and then removing the business
object definitions by hand. This is a bit tedious, however, and I would
like to be able to use Add Web Reference's functionality to both add new
proxies and update existing ones as the webservice changes.

Does anyone have any advice on what we can do here?

Thanks,
Eric


Nov 23 '05 #6
Hi Eric,

Whilst there are numerous resources available declaring this tenant of
service orientation, there are limited resources explaining the
underlying reasoning.

The following are my thoughts on why sharing types should be avoided as
a starting point for distibuted applications. Perhaps the points raised
will not be relevant to your system, this will be for you to decide.

- Reduce coupling between services and their consumers

Increasing coupling between services and their consumers leads to the
following issues:

1. Difficulty maintaining shared functionality

When complex logic is shared between tiers, it can become quite
difficult to determine the implications of changes to the behaviour in
each of the tiers.

I have seen examples whereby such logic made extensive use of
interfaces to allow differing behaviour to be substituted in the
appropriate tiers, which made it difficult to see where behaviour was
actually implemented (as interfaces were referencing interfaces which
referenced further interfaces etc).

Perhaps this is more an example of over-engineering, however,
ultimately there was no reason to couple the tiers by using the same
logic, and would have been much simpler if each tier had independently
implemented its own functionality.

This is why I believe only sharing simple functionality (such as
validation) is appropriate.

2. Synchronisation/Versioning issues

Functionality deployed to both tiers must be synchronised for
consistency. If you have a sufficient client-side updating facility,
this issue may not be relevant.

- Security

Functionality deployed to the client is susceptible to intrusion.
Obfuscation, strong-naming and digital signing are mechanisms to deter
such compromises, however, not deploying functionality to the client
tier is an easier preventative measure. Furthermore, server-side
functionality can be secured via role based security and other
mechanisms provided by IIS/ASP.NET.

There may be other reasons for not sharing types between tiers that I
am not aware of, however, I hope this provides an insight into my
initial advice.

Cheers,
Matt

Nov 23 '05 #7

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

Similar topics

4
by: James Wong | last post by:
Hi everybody, I'm developing a web service using VB.NET which calls a web form to let user input something. In web service, I use Server.Execute ("WebForm.aspx") to load and execute the web...
2
by: WebBuilder451 | last post by:
I need to create something that just calls a web page once a day. It needs to be automatic. My guess is that it needs to be a service(?) or can it be a program that can be setup as a service. 'need...
1
by: Lee Greco | last post by:
I'm looking for some advice on how to proceed. Here's the scenario: I've got to develop a high availability VB.Net web service that basically acts as a middle man between the web service...
2
by: huz | last post by:
I need some advice, here is the situation: I have a web service (ASP 2.0) published on IIS, how can i make that only trusted (my) web applications consume it, and successfuly block all others???
2
by: Anders K. Olsen | last post by:
Hello group I would like some advice on how to model my webservices. Our application is made up of a number of independent modules that handle different parts of the application logic. It is a...
3
by: Joseph Geretz | last post by:
Our application is primarily VB6, however we are migrating toward .NET and a newer architecture. For the time being though, we're stuck with a hybrid approach with our ActiveX client application...
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...
7
by: Joseph Geretz | last post by:
I have a Service which runs OK, but I'm abviously not starting it properly. In my OnStart event I commence a long running process which polls a database table and performs various processing. Since...
0
by: Nic | last post by:
Hi, I am looking to publish a service and is currently developing an API that I intend to allow authenticated users to use. Having been away for a while from programming, I understand that...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.