473,811 Members | 2,960 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Possible Bug : HttpPost and class name conflicts

Included below is a minimal web-service implementation to recreate a problem
I've encountered in a web service that has methods returning classes with the
same local name (but in different namespaces).

If only the SoapHttp protocol is enabled in the web.config, everything works
as expected - with the different "Something" classes being serialized in to
different XML namespaces as defined by the ResponseNamespa ce property of the
SoapDocumentMet hod attributes.

However - if HttpPost or HttpPostLocalho st are enabled (the latter being
enabled by default), and I browse to the asmx file in IE, I get this error :

Types NsProblem.B.Som ething and NsProblem.A.Som ething both use the XML type
name, Something, from namespace http://example/NsProblem/. Use XML attributes
to specify a unique XML name and/or namespace for the type.

If I un-comment both of the "XmlRoot" elements I get this error

The XML element named 'Something' from namespace 'http://example/NsProblem/'
references distinct types NsProblem.A.Som ething and NsProblem.B.Som ething.
Use XML attributes to specify another XML name or namespace for the element
or types.

Now for the really strange bit : leave one XmlRoot attribute commented, and
the other not, and it works!

When it is working, the example responses (on whatever.asmx?o p=GetArrayA)
don't appear to tbe any difference!

(aside: I also tried setting the responses to be different using Xml
Serialization attributes, i.e. putting [return: XmlElement(... )] on the
methods, but like the SoapDocumentMet hod attribute this only seemed to change
the response for the Soap method - making no difference to the HTTP POST
response)

Various workarounds are available
- disable (remove) "HttpPost" and "HttpPostLocalh ost" in web.config
- Rename the classes (making the namespaces redundant)
but I would prefer to be able to keep the class names as they are, and keep
the HttpPostLocalho st enabled for testing / debugging purposes - and I
anticipate needing to support 3 or more classes with the same local-name
across different namespaces.

Edmund Green.
http://www.greenius.ltd.uk/

---- Minimal test case ----

<%@ WebService Language="c#" Class="NsProble m.XmlTestSvc" %>
using System;
using System.Web.Serv ices;
using System.Web.Serv ices.Protocols;
using System.Xml.Seri alization;

namespace NsProblem.A
{
// [XmlRoot(Namespa ce="AAAA")]
public class Something { }
}

namespace NsProblem.B
{
// [XmlRoot(Namespa ce="BBBB")]
public class Something { }
}

namespace NsProblem
{
[WebService(Desc ription="Confli cting name problem example",
Namespace="http ://example/NsProblem/")]
public class XmlTestSvc : System.Web.Serv ices.WebService
{
[WebMethod]
[SoapDocumentMet hod(ResponseNam espace="http://example/NsProblem/A")]
public NsProblem.A.Som ething[] GetArrayA() { return null; }

[WebMethod]
[SoapDocumentMet hod(ResponseNam espace="http://example/NsProblem/B")]
public NsProblem.B.Som ething[] GetArrayB() { return null; }
}
}

Nov 23 '05 #1
0 1864

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

Similar topics

3
2507
by: Richard A. DeVenezia | last post by:
Any recommendations for deploying small to middling JavaScript system that encompasses 10-20 functions ? The problem is the potential that another other JavaScript system running on the same page wanting to use the same function name(s) as those in my system. I don't want to redefine that other systems functions, nor have mine redefined. So, is there any sort of 'package' concept
3
3869
by: tomek | last post by:
Can anybody explain why can I not get rid of the above message in the following class definition? Thank you in advance. class BasicMidReader : public TMemoryStream { //some private date public: BasicMidReader(char* FN)
14
2037
by: Pedro Werneck | last post by:
Hi I have a class A, with metaclass M_A, and class B, subclass of A, with metaclass M_B, subclass of M_A. A class C, subclass of B must have M_B or a subclass of it as metaclass, but what if I need to 'disable' the code in M_B on C ? The correct way to do that seems to be with a M_C metaclass, subclass of M_B, implementing but not calling parent class methods, or calling 'type' methods.
12
1804
by: christopherlmarshall | last post by:
Suppose you want to write a subclass of some existing class you are importing from a module you didn't write and that you don't want to study the internals of, and you want to define a data member i in your constructor. As in the following: from module1 import A class B(A):
2
1847
by: LoopyNZ | last post by:
Hi, (Access 97) I'm creating a query (QRY_SUMMARY) to join a query (QRY) to itself (QRY_1). I'm returning QRY.* and selected fields from QRY_1. With each field (field_name) I return from QRY_1 I'm appending "_1" to to the end to avoid name conflicts with the fields from QRY, i.e. "field_name" becomes "field_name_1".
0
1093
by: Matthew Lock | last post by:
Hello, I am enabling my web service via HttpPost so that a simple Javascript client can access web services by posting with XmlHttpRequest. I have added the following nodes into my web.config to enable remote access to the web service via post: <webServices> <protocols> <add name="HttpPost"/>
4
8001
by: zfareed | last post by:
#include <iostream> #include <fstream> using namespace std; template<class ItemType> class SortedList { private:
5
6495
by: Dave | last post by:
I'm writing an app that needs to send info to a client by their specs, m_request= "https://website.com/app?xml=xml_file&xmlString=<?xml version='1.0' encoding='utf-8' ?>xmlfilecontentset...etc</endfile>" HttpWebRequest request = (HttpWebRequest)WebRequest.Create(m_request); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Which works fine for a small file, 3k or less, but for a file with more items in the xml file the...
2
7219
by: Dinsdale | last post by:
We have created a object library that implements the INotifyPropertyChanged.PropertyChanged to bubble changes up to higher level classes. For instance, we have a person class that can have relationships with other persons. If there is a change in the relationship (i.e. status, type etc) then we want the PropertyChanged event to fire and notify the top level Person object of that change. The PropertyChanged event is implemented as follows:...
0
10653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10395
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7674
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6895
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5564
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4352
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3027
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.