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

Classes in webservice have the same name

We have a webservice that is a passthrough to a third party webservice.
The third party webservice uses the classes that are named the same for
both the submission and result message. We have separated these out to
different namespaces in our webservice. Eg.

SubmissionMessage.WebServiceMessage
ResultMessage.WebServiceMessage

When we import this webservice as a web reference into our web
application. These different namespaces aren't preserved. Instead we
get the following classes

OurWebservice.WebServiceMessage
OurWebservice.WebServiceMessage1

I would like to have these classes split out into different namespaces
on the consumer side instead of these classes with the 1 postfix. I can
manually change the Reference.cs file, but since these files are
generated any updates will cause my changes to be overwritten. Does
anyone have a good solution to this problem?

Sep 26 '06 #1
5 1689
q
Per the requirements of webservices, they can't have the same name.
They can't be overloaded and they can't differ only by case. If these
rules are violated they are no longer webservices, but are just
"services". They have to follow the specs...

ya****@gmail.com wrote:
We have a webservice that is a passthrough to a third party webservice.
The third party webservice uses the classes that are named the same for
both the submission and result message. We have separated these out to
different namespaces in our webservice. Eg.

SubmissionMessage.WebServiceMessage
ResultMessage.WebServiceMessage

When we import this webservice as a web reference into our web
application. These different namespaces aren't preserved. Instead we
get the following classes

OurWebservice.WebServiceMessage
OurWebservice.WebServiceMessage1

I would like to have these classes split out into different namespaces
on the consumer side instead of these classes with the 1 postfix. I can
manually change the Reference.cs file, but since these files are
generated any updates will cause my changes to be overwritten. Does
anyone have a good solution to this problem?
Sep 26 '06 #2
Couldn't they have the same name, but be in different namespaces? This
is the case. The VS auto generated code does not create these different
namespaces and instead just lumps them all in the same namespaces. This
requires that they have different names. Is there a workaround to not
have these classes in the same namespace?

Sep 26 '06 #3
<ya****@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
We have a webservice that is a passthrough to a third party webservice.
The third party webservice uses the classes that are named the same for
both the submission and result message.
First of all, what do you mean when you say that the third party web service
uses classes with the same name? Did you mean that it uses two complexType
declarations with the same "name" attribute but in different namespaces?
Could you provide a snippet of the schema illustrating the problem?
>We have separated these out to
different namespaces in our webservice. Eg.

SubmissionMessage.WebServiceMessage
ResultMessage.WebServiceMessage
Is your web service able to consume the 3rd party web service via a web
reference? How do the names of the 3rd party web service translate?

It's possible that, however it works with the 3rd party web service, that's
how it should work with yours.

Also, what do you mean when you talk about being a "passthrough"? Do you
mean that if the 3PWS (3rd party web service - I'm tired of spelling it
out!)...

when the 3PWS changes, you want your clients to see all of the same changes?
Every one?

You might consider being a facade to the 3PWS instead of just a passthrough.
That way, you can name your classes whatever you want, and whatever makes
the most sense to your clients.

John
Sep 26 '06 #4

John Saunders wrote:
First of all, what do you mean when you say that the third party web service
uses classes with the same name? Did you mean that it uses two complexType
declarations with the same "name" attribute but in different namespaces?
Could you provide a snippet of the schema illustrating the problem?
So for example the submission message looks like this:
<RootElement>
<SomeCommonElement>20000</SomeCommonElement>
</RootElement>

and the result message looks like this
<RootElement>
<SomeCommonElement>20000</SomeCommonElement>
<SomeResultElement>40000</SomeResultElement>
</RootElement>

notice how RootElement and SomeCommonElement are shared between the
submission and result message. They also usually have a different
schema. Unfortunately since we just post to an asp page we don't get to
import the references. Also we leave namespaces out when we construct
the xml document. And the result message also has no namespaces.
when the 3PWS changes, you want your clients to see all of the same changes?
Every one?

You might consider being a facade to the 3PWS instead of just a passthrough.
That way, you can name your classes whatever you want, and whatever makes
the most sense to your clients.
This is impractical since the 3PWS is very complex and we have no idea
how future clients may want to use it.

Oct 6 '06 #5
<ya****@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
>
John Saunders wrote:
>First of all, what do you mean when you say that the third party web
service
uses classes with the same name? Did you mean that it uses two
complexType
declarations with the same "name" attribute but in different namespaces?
Could you provide a snippet of the schema illustrating the problem?

So for example the submission message looks like this:
<RootElement>
<SomeCommonElement>20000</SomeCommonElement>
</RootElement>

and the result message looks like this
<RootElement>
<SomeCommonElement>20000</SomeCommonElement>
<SomeResultElement>40000</SomeResultElement>
</RootElement>

notice how RootElement and SomeCommonElement are shared between the
submission and result message. They also usually have a different
schema.
If they use different schemas, then they had better be in different
namespaces, and I don't see your namespace declarations in your examples.

This is likely the cause of your problem.
Unfortunately since we just post to an asp page we don't get to
import the references. Also we leave namespaces out when we construct
the xml document. And the result message also has no namespaces.
This is a critical mistake. The only time namespaces are truly optional is
when it two elements with the same name always have the same type. In your
case, they do not have the same type, so you need namespaces.
>when the 3PWS changes, you want your clients to see all of the same
changes?
Every one?

You might consider being a facade to the 3PWS instead of just a
passthrough.
That way, you can name your classes whatever you want, and whatever makes
the most sense to your clients.

This is impractical since the 3PWS is very complex and we have no idea
how future clients may want to use it.
I suppose this is ok, assuming that you properly emulate a client of the
3PWS. I expect your solution to break as soon as you look different than a
regular client. For instance, what happens when the 3PWS decides to
implement SOAP 1.2 for some of its operations? What happens if it decides to
use some end-to-end authentication scheme?

Your problem can be solved for today, but tomorrow, you might be in trouble.

John
Oct 6 '06 #6

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

Similar topics

5
by: Benne Smith | last post by:
Hi, I have three enviroments; a development, a testing and a production enviroment. I'm making a big application (.exe), which uses alot of different webservices. I don't use the webservices...
3
by: Elroyskimms | last post by:
I know that multiple class inheritance is not possible in VB.Net I also know that I can: inherit class a and in class a: inherit class b and in class b:
2
by: Burak | last post by:
Hello, I have a web service that has a two user defined public classes. For sake of brevity, I'll write them as follows Public Class Service1 Public Class Class1 Public x as integer End...
12
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
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() {
0
by: cnSoftware | last post by:
I have two classes as below: public class BaseClass { public BaseClass() { } public BaseClass(string name) { this._name = name; }
3
by: Dave | last post by:
Please - anyone that can help. I am getting confusing results while trying to expose a collection from a web service. I have a webservice in which a web method accepts a collection as a...
1
by: ThunderMusic | last post by:
Hi, I have many classes a user may need to call methods on my webservice. Some classes are "published" and some are not... I mean, when we do a Web reference from another project, we don't have...
2
by: stormogulen | last post by:
Hi! I'm having some problems figuring out how to organize the different tiers of an application using a webservice. The bottom layer is the DAL, and some of the objects in the DAL, I would...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
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...
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...

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.