472,805 Members | 1,225 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Consuming multiple web services with a .disco file

I've got two web services that use the same data types and that
clients will have to consume. I read the msdn article on sharing types
(http://msdn.microsoft.com/library/de...ce07162002.asp)
but I don't want clients to have to add two web references and then
manually have to edit the proxy classes. After doing some searching I
found that putting references to multiple web services in a .disco
file and then having the clients point to the .disco file when adding
a web reference will enable them to use multiple web services under
one namespace without any additional editing. When I tried this the
generated proxy class contains code only for the first web service in
the disco file. I do see that both wsdl files are imported under the
web reference though. Is it possbile to get VS.NET to generate proxy
class code for both services and put it in the same proxy file
(reference.cs)? Below is the .disco file I created. Thanks for any
help.

<?xml version="1.0" encoding="utf-8"?>
<discovery xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef
ref="http://localhost/ReservationsMiddleTierWebServiceAPI/customerwebservice.asmx?wsdl"
docRef="http://localhost/ReservationsMiddleTierWebServiceAPI/customerwebservice.asmx"
xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap
address="http://localhost/ReservationsMiddleTierWebServiceAPI/customerwebservice.asmx"
xmlns:q1="http://reservationsmiddletier.uhaul.com/webservice"
binding="q1:CustomerWebServiceSoap"
xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<contractRef
ref="http://localhost/ReservationsMiddleTierWebServiceAPI/locationwebservice.asmx?wsdl"
docRef="http://localhost/ReservationsMiddleTierWebServiceAPI/locationwebservice.asmx"
xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap
address="http://localhost/ReservationsMiddleTierWebServiceAPI/locationwebservice.asmx"
xmlns:q1="http://reservationsmiddletier.uhaul.com/webservice"
binding="q1:LocationWebServiceSoap"
xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>
Nov 23 '05 #1
3 6393
Hi,

This is a classic partitioning problem. The real issue is that the proxy
class is an assembly, and not an XML data structure. As an assembly, it
has a .NET namespace. What the article you read is trying to accomplish is
to put both of your sets of service methods in the same namespace. There
are a few ways to do this - and the best way I know of is to not use the
automatically generated proxy, but instead to provide a set of custom
proxies for your .NET clients to use. You can create these by copying the
generated proxy code into two class files - give them a namepace of your
choosing. For the shared types, factor them out of your server application
into a separate assembly, and reference that assembly from not only your
server side code, but also from your custom proxies.

What you are encountering in the auto-generated proxies is .NET strong
naming. Even though the two class shadows that are generated are identical
(presumably), the difference in the name assigned to your proxies is
causing the cast of either one to fail when trying to copy/pass/cast the
data.

You could try naming your proxies the same thing as your server side
namespace. Since you are separately adding two, this could cause a name
collision in the project artifacts. But there is no issue in having both
proxies in the same namespace.

Finallly, have you considered that you may have actually improperly
partitioned your web service design? Since you intend for both services to
live together and be used together, have you considered combining them into
a single service implementation? This would make them share a WSDL file -
and this would solve the issues that relying on the "free for nothing"
generated proxy is providing.

I like to think of the generated proxy as a favor. It isn't required to
call a service, and any number of equivalent proxies can exist that are all
correct for a given service. The fact that the behavior of the proxy that
is generated doesn't meet your needs drives some to say "hey, it's just
code, I own that". Others for some reason treat it as if it were sacred -
as if it was ever safe to regenerate it (hint, if you have to refresh the
proxy ever, you haven't created a stable service contract, so you're still
early on in development anyway). After you've shipped it is NOT OK to
expect proxies to be refreshed - not from a service level management
perspective anyhow.

I hope this helps

Dan Rogers
Microsoft Corporation
--------------------
NNTP-Posting-Date: Wed, 22 Dec 2004 16:45:54 -0600
From: Matt D <md**********@yahoo.com>
Newsgroups: microsoft.public.dotnet.framework.webservices
Subject: Consuming multiple web services with a .disco file
Date: Wed, 22 Dec 2004 15:45:54 -0700
Message-ID: <pu********************************@4ax.com>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 39
X-Trace:
sv3-VGgayvZ8JsqDpwtKvdaOFHVFYPGT+MO+hdu0IKRn4dCAR4aQ9K JtemSFwWdFXHwwQULaP07L
YnOVnII!X78l0Wg07TrQqLR2AoEa4V85zafGdYAdzkCjksbhrK oN3U0vQnoBvFaNMh14Il/U/HB/
X-Complaints-To: ab***@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
complaint properly
X-Postfilter: 1.3.22
Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFT NGP08.phx.gbl!news-out.cwi
x.com!newsfeed.cwix.com!border1.nntp.dca.giganews. com!nntp.giganews.com!loca
l1.nntp.dca.giganews.com!news.giganews.com.POSTED! not-for-mail
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices:8274
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

I've got two web services that use the same data types and that
clients will have to consume. I read the msdn article on sharing types
(http://msdn.microsoft.com/library/de...-us/dnservice/
html/service07162002.asp)
but I don't want clients to have to add two web references and then
manually have to edit the proxy classes. After doing some searching I
found that putting references to multiple web services in a .disco
file and then having the clients point to the .disco file when adding
a web reference will enable them to use multiple web services under
one namespace without any additional editing. When I tried this the
generated proxy class contains code only for the first web service in
the disco file. I do see that both wsdl files are imported under the
web reference though. Is it possbile to get VS.NET to generate proxy
class code for both services and put it in the same proxy file
(reference.cs)? Below is the .disco file I created. Thanks for any
help.

<?xml version="1.0" encoding="utf-8"?>
<discovery xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef
ref="http://localhost/ReservationsMiddleTierWebServiceAPI/customerwebservice
.asmx?wsdl"
docRef="http://localhost/ReservationsMiddleTierWebServiceAPI/customerwebserv
ice.asmx"
xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap
address="http://localhost/ReservationsMiddleTierWebServiceAPI/customerwebser
vice.asmx"
xmlns:q1="http://reservationsmiddletier.uhaul.com/webservice"
binding="q1:CustomerWebServiceSoap"
xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<contractRef
ref="http://localhost/ReservationsMiddleTierWebServiceAPI/locationwebservice
.asmx?wsdl"
docRef="http://localhost/ReservationsMiddleTierWebServiceAPI/locationwebserv
ice.asmx"
xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap
address="http://localhost/ReservationsMiddleTierWebServiceAPI/locationwebser
vice.asmx"
xmlns:q1="http://reservationsmiddletier.uhaul.com/webservice"
binding="q1:LocationWebServiceSoap"
xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>

Nov 23 '05 #2
Hi Dan. Thanks for the help. I think I was unclear by mentioning the
"types" article and kind of got off track. I've spent quite a bit of
time designing the web services and data types that will be used so
I'm pretty satisfied with the design. I am definitely aware of the
fact that the web service interface should never change and that
creating a custom proxy that is given to the clients is a good option.
But it would be nice if I could get the auto generated proxy to work
right. The question that I really wanted to know is why isn't the
proxy file correctly generated when multiple web services are added to
a .disco file. It seems to only generate a proxy class for the first
web service that is in the .disco file. The reason I want to combine
web services in a .disco file is because I have a total of six web
services that can be used totally independently and they all use the
same custom types. Some clients will only use one of the web services.
But some will use all six. So I wanted to create .disco files that
have all of the possible combinations of web services that a client
could use. I got the idea about using .disco files from the following
posts:

http://groups-beta.google.com/group/...9056c71cd83830
http://groups-beta.google.com/group/...a642c500262e17

From these posts I would assume that VS.NET should be able to generate
the correct proxy and that I'm doing something wrong. Thanks for any
help.

On Wed, 22 Dec 2004 23:05:19 GMT, da***@microsoft.com (Dan Rogers)
wrote:
Hi,

This is a classic partitioning problem. The real issue is that the proxy
class is an assembly, and not an XML data structure. As an assembly, it
has a .NET namespace. What the article you read is trying to accomplish is
to put both of your sets of service methods in the same namespace. There
are a few ways to do this - and the best way I know of is to not use the
automatically generated proxy, but instead to provide a set of custom
proxies for your .NET clients to use. You can create these by copying the
generated proxy code into two class files - give them a namepace of your
choosing. For the shared types, factor them out of your server application
into a separate assembly, and reference that assembly from not only your
server side code, but also from your custom proxies.

What you are encountering in the auto-generated proxies is .NET strong
naming. Even though the two class shadows that are generated are identical
(presumably), the difference in the name assigned to your proxies is
causing the cast of either one to fail when trying to copy/pass/cast the
data.

You could try naming your proxies the same thing as your server side
namespace. Since you are separately adding two, this could cause a name
collision in the project artifacts. But there is no issue in having both
proxies in the same namespace.

Finallly, have you considered that you may have actually improperly
partitioned your web service design? Since you intend for both services to
live together and be used together, have you considered combining them into
a single service implementation? This would make them share a WSDL file -
and this would solve the issues that relying on the "free for nothing"
generated proxy is providing.

I like to think of the generated proxy as a favor. It isn't required to
call a service, and any number of equivalent proxies can exist that are all
correct for a given service. The fact that the behavior of the proxy that
is generated doesn't meet your needs drives some to say "hey, it's just
code, I own that". Others for some reason treat it as if it were sacred -
as if it was ever safe to regenerate it (hint, if you have to refresh the
proxy ever, you haven't created a stable service contract, so you're still
early on in development anyway). After you've shipped it is NOT OK to
expect proxies to be refreshed - not from a service level management
perspective anyhow.

I hope this helps

Dan Rogers
Microsoft Corporation

Nov 23 '05 #3
Hi.

I'm from the 70's, and Disco is dead... ;)

Seriously... the purpose of a disco file is to allow a visual studio tool's
add-web-reference proxy to find what services are on a given server.
You're supposed to select one of the services from the list of available
services, and then generate the proxy.

As far as I know, once you've made the selection, it'll generate a proxy
for the one you selected. From my own experience, you may be
encountering a usability gotcha - the list is displayed, and the first one
is selected for you. If you don't change the selection (double click it)
you will always get the proxy for the default one.

I hope this helps

Dan
--------------------
NNTP-Posting-Date: Tue, 28 Dec 2004 11:35:31 -0600
From: Matt D <md**********@yahoo.com>
Newsgroups: microsoft.public.dotnet.framework.webservices
Subject: Re: Consuming multiple web services with a .disco file
Date: Tue, 28 Dec 2004 10:35:31 -0700
Message-ID: <eg********************************@4ax.com>
References: <pu********************************@4ax.com>
<zn**************@cpmsftngxa10.phx.gbl>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 76
X-Trace:
sv3-yxazzPDhaX9ZDhUUWguChn9PyY3yobV75z8r++a+UoXf/spnyZST87XPrQU5tngrlqKWrUJ/
zFX5RcT!uc8CXUu5aop56tgzjYuo6BKqYWbibCHty9cs7ePqOW i3Ie8kKruAocKlgLS/GmUH2qgI
X-Complaints-To: ab***@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
complaint properly
X-Postfilter: 1.3.22
Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFT NGP08.phx.gbl!newsfeed00.s
ul.t-online.de!t-online.de!border2.nntp.dca.giganews.com!border1.nn tp.dca.gi
ganews.com!nntp.giganews.com!local1.nntp.dca.gigan ews.com!news.giganews.com.
POSTED!not-for-mail
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices:8327
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

Hi Dan. Thanks for the help. I think I was unclear by mentioning the
"types" article and kind of got off track. I've spent quite a bit of
time designing the web services and data types that will be used so
I'm pretty satisfied with the design. I am definitely aware of the
fact that the web service interface should never change and that
creating a custom proxy that is given to the clients is a good option.
But it would be nice if I could get the auto generated proxy to work
right. The question that I really wanted to know is why isn't the
proxy file correctly generated when multiple web services are added to
a .disco file. It seems to only generate a proxy class for the first
web service that is in the .disco file. The reason I want to combine
web services in a .disco file is because I have a total of six web
services that can be used totally independently and they all use the
same custom types. Some clients will only use one of the web services.
But some will use all six. So I wanted to create .disco files that
have all of the possible combinations of web services that a client
could use. I got the idea about using .disco files from the following
posts:

http://groups-beta.google.com/group/...amework/msg/d2
9056c71cd83830
http://groups-beta.google.com/group/...amework.aspnet
.webservices/msg/14a642c500262e17

From these posts I would assume that VS.NET should be able to generate
the correct proxy and that I'm doing something wrong. Thanks for any
help.

On Wed, 22 Dec 2004 23:05:19 GMT, da***@microsoft.com (Dan Rogers)
wrote:
Hi,

This is a classic partitioning problem. The real issue is that the proxy
class is an assembly, and not an XML data structure. As an assembly, it
has a .NET namespace. What the article you read is trying to accomplish isto put both of your sets of service methods in the same namespace. There
are a few ways to do this - and the best way I know of is to not use the
automatically generated proxy, but instead to provide a set of custom
proxies for your .NET clients to use. You can create these by copying the
generated proxy code into two class files - give them a namepace of your
choosing. For the shared types, factor them out of your server applicationinto a separate assembly, and reference that assembly from not only your
server side code, but also from your custom proxies.

What you are encountering in the auto-generated proxies is .NET strong
naming. Even though the two class shadows that are generated are identical(presumably), the difference in the name assigned to your proxies is
causing the cast of either one to fail when trying to copy/pass/cast the
data.

You could try naming your proxies the same thing as your server side
namespace. Since you are separately adding two, this could cause a name
collision in the project artifacts. But there is no issue in having both
proxies in the same namespace.

Finallly, have you considered that you may have actually improperly
partitioned your web service design? Since you intend for both services tolive together and be used together, have you considered combining them intoa single service implementation? This would make them share a WSDL file -
and this would solve the issues that relying on the "free for nothing"
generated proxy is providing.

I like to think of the generated proxy as a favor. It isn't required to
call a service, and any number of equivalent proxies can exist that are allcorrect for a given service. The fact that the behavior of the proxy that
is generated doesn't meet your needs drives some to say "hey, it's just
code, I own that". Others for some reason treat it as if it were sacred -
as if it was ever safe to regenerate it (hint, if you have to refresh the
proxy ever, you haven't created a stable service contract, so you're still
early on in development anyway). After you've shipped it is NOT OK to
expect proxies to be refreshed - not from a service level management
perspective anyhow.

I hope this helps

Dan Rogers
Microsoft Corporation


Nov 23 '05 #4

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

Similar topics

2
by: Rob Schieber | last post by:
Hello, I was curious if anyone knows of a tool that can 1. Catalog/Document what web services are running on a server. 2. Catalog/Document method sigs, parms, references for each service ...
1
by: Greg | last post by:
Here is a question: Contoso Inc. is moving it's point-of-sales operations online. You have created an XML Web Service, which takes the product code as input and returns the discount on that...
3
by: J Chambers | last post by:
hey all, i'm having some troubles in the class generation (client) for some oblix web services. here's the scenario: we have two configs that we're dealing with in this particular case, one a...
1
by: BestofAbhi | last post by:
I am consuming Java Web Services in .NET. The Java Web Services have been coded using Apache Axis. The binding style in the WSDL is 'Document' and type is 'Literal'. I have added these Java...
0
by: Peter Theill | last post by:
I have these two web services: namespace WebService1 { public class Service1 : System.Web.Services.WebService { public Service1() { } public string HelloWorld() {
5
by: Arpan | last post by:
A Discovery file named "Calculator.disco" exists in "C:\Inetpub\wwwroot\ASPX\WEBSERVICES" folder. Now when I enter the following command in the command prompt (at the...
3
by: Arpan | last post by:
A Discovery file (residing in C:\Inetpub\wwwroot\ASPX\WEBSERVICES) named "Calculator.disco" has the following code: <?xml version="1.0" ?> <disco:discovery...
3
by: Jeremy Chapman | last post by:
I've writtin a very simple web service in axis which returns an array of classes. I consume it in a .net app. When receiving the response, my .net app generates an error "Cannot assign object...
4
by: =?Utf-8?B?Z3Jhenph?= | last post by:
Hello If someone can help me with this it would be greatly appreciated. I’m no web service expert but I don't think i'm trying to do anything too special. I think i must be missing something...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?

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.