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>