473,386 Members | 1,712 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,386 software developers and data experts.

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 ResponseNamespace property of the
SoapDocumentMethod attributes.

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

Types NsProblem.B.Something and NsProblem.A.Something 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.Something and NsProblem.B.Something.
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?op=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 SoapDocumentMethod 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 "HttpPostLocalhost" 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 HttpPostLocalhost 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="NsProblem.XmlTestSvc" %>
using System;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;

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

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

namespace NsProblem
{
[WebService(Description="Conflicting name problem example",
Namespace="http://example/NsProblem/")]
public class XmlTestSvc : System.Web.Services.WebService
{
[WebMethod]
[SoapDocumentMethod(ResponseNamespace="http://example/NsProblem/A")]
public NsProblem.A.Something[] GetArrayA() { return null; }

[WebMethod]
[SoapDocumentMethod(ResponseNamespace="http://example/NsProblem/B")]
public NsProblem.B.Something[] GetArrayB() { return null; }
}
}

Nov 23 '05 #1
0 1846

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

Similar topics

3
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...
3
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...
14
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...
12
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...
2
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...
0
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...
4
by: zfareed | last post by:
#include <iostream> #include <fstream> using namespace std; template<class ItemType> class SortedList { private:
5
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'...
2
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...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.