Re: RequestElementName is being changed
- From: stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng[MSFT])
- Date: Wed, 07 Sep 2005 02:46:25 GMT
{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fprq2\fcharset0 MS Sans Serif;}{\f1\fmodern\fprq6\fcharset134 \'cb\'ce\'cc\'e5;}}
\viewkind4\uc1\pard\lang2052\f0\fs20 Thanks for Marvin's input,
\par
\par Hi MR,
\par
\par For XML Webservice, the request/response document is a standard xml document so all the element in it conform to the XML 1.0/namepsace standards. The prefix you mentioned just actually called namespace prefix which is just an alias of a certain namespace URI, for example:
\par
\par <element xmlns:ns1="urn:test:method" ....>
\par
\par the ns1 is just alias of "urn:test:method" , so the important value is the "urn:test:method" rathe\f1 r than "ns1". We can replace the "ns1" with whatever prefix we like, in other words, the following three ones are identical([1] ,[2] and [3]:
\par [1]
\par <element xmlns:ns1="urn:test:method">
\par <ns1:sub />
\par </element>
\par
\par [2]
\par <element xmlns:ns3="urn:test:method">
\par <ns3:sub />
\par </element>
\par \f0
\par [3]
\par
\par <element xmlns="urn:test:method">
\par <sub />
\par </element>
\par
\par
\par So for your scenario, if your concern is only the namespace prefix, I don't think you need to worry about it. Just set the correct "RequestElementName" and "RequestNamespace" is enough. For example, the following webmethod:
\par
\par [WebMethod]
\par \tab\tab [SoapDocumentMethod(RequestElementName="submitOrderBatch",RequestNamespace="urn:OrderOperations",
\par \tab\tab\tab ResponseElementName="submitOrderBatchResponse", ResponseNamespace="urn:OrderOperations"
\par
\par \tab\tab\tab )]
\par \tab\tab
\par \tab\tab public string SubmitOrderBatch()
\par \tab\tab\{
\par \tab\tab\tab return "Hello World";
\par \tab\tab\}
\par
\par
\par will generate the below output:
\par
\par <?xml version="1.0" encoding="utf-8"?>
\par <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
\par <soap:Body>
\par <submitOrderBatch xmlns="urn:OrderOperations" />
\par </soap:Body>
\par </soap:Envelope>
\par
\par it is identical to this one in XML perspective:
\par
\par <?xml version="1.0" encoding="utf-8"?>
\par <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
\par <soap:Body>
\par <ns1:submitOrderBatch xmlns:ns1="urn:OrderOperations" />
\par </soap:Body>
\par </soap:Envelope>
\par
\par
\par Thanks,
\par
\par
\par Steven Cheng
\par Microsoft Online Support
\par
\par Get Secure! www.microsoft.com/security
\par (This posting is provided "AS IS", with no warranties, and confers no rights.)
\par
\par \pard\li720 --------------------
\par From: Marvin Smit <marvin.smit@xxxxxxxxx>
\par Newsgroups: microsoft.public.dotnet.framework.webservices
\par Subject: Re: RequestElementName is being changed
\par Date: Tue, 06 Sep 2005 17:04:39 +0200
\par Message-ID: <pmbrh1lqt95u0mnsb0g9ll6pv0qat8ugfj@xxxxxxx>
\par References: <OQ6LT6ssFHA.1172@xxxxxxxxxxxxxxxxxxxx> <jntqh19o7fncq71edmb031i79fdr49r0ct@xxxxxxx> <e75LeRtsFHA.3040@xxxxxxxxxxxxxxxxxxxx>
\par X-Newsreader: Forte Free Agent 3.0/32.763
\par MIME-Version: 1.0
\par Content-Type: text/plain; charset=us-ascii
\par Content-Transfer-Encoding: 7bit
\par X-Complaints-To: abuse@xxxxxxxxx
\par Organization: chello.nl
\par Lines: 77
\par NNTP-Posting-Host: 62.194.138.116 (62.194.138.116)
\par NNTP-Posting-Date: Tue, 06 Sep 2005 17:04:54 +0200
\par X-Trace: bd352431db0169b672fd105055
\par Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!fr.ip.ndsoftware.net!213.239.142.2.MISMATCH!feeder.xsnews.nl!tudelft.nl!txtfeed2.tudelft.nl!amsnews11.chello.com!amsnews14.chello.com!news.chello.nl.POSTED!not-for-mail
\par Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework.webservices:7791
\par X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
\par
\par Hi..
\par
\par Ehh... AFAIK Axis works using the WSDL, SOAP, XSD, XML standards (WS
\par Stack). Thats essentially what being a WebService is all about. Since
\par this is XML based, the prefix cannot be important. The prefix is
\par nothing else than an 'alias' to the, usualy pretty-, large namespace
\par uri.
\par
\par If on the other hand the implementation uses string manipulation,
\par regular expressions or anything else than a real XML parser.. it could
\par be a problem.
\par
\par Hope this helps,
\par
\par Marvin Smit.
\par
\par On Tue, 6 Sep 2005 14:15:58 +0300, "MR" <comconix@xxxxxxxxxxxxxxxx>
\par wrote:
\par
\par >thanks, except that the web service (apache) i am talking to requires that
\par >prefix.
\par >is there a workaround?
\par >
\par >"Marvin Smit" <marvin.smit@xxxxxxxxx> wrote in message
\par >news:jntqh19o7fncq71edmb031i79fdr49r0ct@xxxxxxxxxx
\par >> Hi,
\par >>
\par >> you don't have the control over the prefix use. With the two
\par >> attributes you're almost right. Just remove the prefix from the
\par >> values. So,
\par >>
\par >> [SoapDocumentMethod( RequestElementName="submitOrderBatch",
\par >> RequestNamespace="urn:OrderOperations")]
\par >>
\par >> should do it.
\par >>
\par >> Hope this helps,
\par >>
\par >> Marvin Smit
\par >>
\par >> On Tue, 6 Sep 2005 13:34:31 +0300, "MR" <comconix@xxxxxxxxxxxxxxxx>
\par >> wrote:
\par >>
\par >>>Why does the string value assigned to the RequestElementName in the
\par >>>SoapDocumentMethodAttribute get changed?
\par >>>
\par >>>The value below with a colon is changed to the hex value surrounded by
\par >>>underscores. this doesn't happen to the RequestNameSpace.
\par >>>
\par >>>How can i prevent it from being changed?
\par >>>
\par >>>thanks
\par >>>
\par >>>m
\par >>>
\par >>>
\par >>>
\par >>>[System.Web.Services.Protocols.SoapDocumentMethodAttribute
\par >>>
\par >>>("",
\par >>>
\par >>>RequestElementName = @"ns1:submitOrderBatch",
\par >>>
\par >>>RequestNamespace="urn:OrderOperations",
\par >>>
\par >>>
\par >>>
\par >>>Use=System.Web.Services.Description.SoapBindingUse.Literal,
\par >>>
\par >>>ParameterStyle= System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
\par >>>
\par >>>
\par >>>
\par >>>the SOAP body then contains: <ns1_x003A_submitOrderBatch
\par >>>xmlns="urn:OrderOperations">
\par >>>
\par >
\par \pard
\par
\par }
- Follow-Ups:
- Re: RequestElementName is being changed
- From: Steven Cheng[MSFT]
- Re: RequestElementName is being changed
- References:
- RequestElementName is being changed
- From: MR
- Re: RequestElementName is being changed
- From: Marvin Smit
- Re: RequestElementName is being changed
- From: MR
- Re: RequestElementName is being changed
- From: Marvin Smit
- RequestElementName is being changed
- Prev by Date:
Re: Attachments.Add - Object reference not set to an instance of an object. - Next by Date:
WebService - Multiple Access - Previous by thread:
Re: RequestElementName is being changed - Next by thread:
Re: RequestElementName is being changed - Index(es):