简体   繁体   中英

Prefix in Webservice with SOAP

i was cheaching this link:

http://es.w3support.net/index.php?db=so&id=665327

i this is part of what i need, i use the same kind of code with SoapDocumentMethodAttribute and the Invoke Method, and this is my question.

in the link they show how to get the response with the prefix, and works, but what abut the request?, i need to send to the client the xml strucuture with the prefix.

i try add XmlSerializerNamespaces xsn = new XmlSerializerNamespaces(); xsn.Add("mes-root", "CAP");

before the invoke method, but does not work

i hope some one can help me i'm really frustrated

First of all, unless you're stuck using .NET 2.0, you shouldn't be doing any new development using ASMX web services or clients. You should use "Add Service Reference", not "Add Web Reference".

Secondly, the article you linked to is a translated version of XML Serialization - Missing Namespace Prefix at client end .

Third, note that the person who asked that question was running .NET 1.1, posted incorrect XML, and never actually reported what the real problem was.

Finally, if your client requires a specific prefix, then they have a fatal, critical bug in their code: that would mean that they're not actually communicating using XML. In XML, the prefix is only an alias for the actual namespace. It shouldn't matter whether there is a prefix, much less what the actual prefix is. The following are all identical:

<root xmlns="somenamespace"/>

<a:root xmlns:a="somenamespace"/>

<b:root xmlns:b="somenamespace"/>

Note that the actual problem that the OP was having was that she was running .NET 1.1, which had several bugs in its handling of XML. The problem had nothing at all to do with prefixes!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM