[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

RK

7/14/2003 6:24:00 PM

I created a small web service with a single method that
returns XmlElement back to the client. This method is
working fine if I return string using OuterXml property,
but when I am trying to return XmlElement it is throwing
error. could anybody give me hint, what could be the
problem..


thanx in advance
RK



webservice is something like this..

[WebService(Namespace="http://www.xyz.com/mySer...)]
public class myWebService:System.Web.Services.WebService
{

[WebMethod]
public XmlElement getXML(string strNumber)
{
XmlDocument objXML = new XmlDocument();
objXML.LoadXml("<topElement></topElement>");

/**nodeOne and nodeTwo are coming from dll
* component using some methods */

objXML.DocumentElement.AppendChild(nodeOne);
objXML.DocumentElement.AppendChild(nodeTwo);

return objXML.DocumentElement;

}

}

It is throwing an error like

System.InvalidOperationException: There was an error
generating the XML document. --->
System.ArgumentException: Cannot use a prefix with an
empty namespace.
at System.Xml.XmlTextWriter.WriteStartElement(String
prefix, String localName, String ns)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteContentTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteContentTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at
System.Xml.Serialization.XmlSerializationWriter.WriteElemen
t(XmlNode node, String name, String ns, Boolean any)
at
System.Xml.Serialization.XmlSerializationWriter.WriteElemen
tLiteral(XmlNode node, String name, String ns, Boolean
isNullable, Boolean any)
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializat
ionWriter1.Write1_Item(Object o)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize
(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces
namespaces)
at System.Xml.Serialization.XmlSerializer.Serialize
(TextWriter textWriter, Object o, XmlSerializerNamespaces
namespaces)
at System.Xml.Serialization.XmlSerializer.Serialize
(TextWriter textWriter, Object o)
at System.Web.Services.Protocols.XmlReturnWriter.Write
(HttpResponse response, Stream outputStream, Object
returnValue)
at
System.Web.Services.Protocols.HttpServerProtocol.WriteRetur
ns(Object[] returnValues, Stream outputStream)
at
System.Web.Services.Protocols.WebServiceHandler.WriteReturn
s(Object[] returnValues)
at
System.Web.Services.Protocols.WebServiceHandler.Invoke()
at
System.Web.Services.Protocols.WebServiceHandler.CoreProcess
Request()





3 Answers

Raymond C. Fischer, 90 Hunt Way, Campbell, CA 95008; 408-374-1969

7/25/2011 3:40:00 AM

0

The DemocRAT Hall Of Shame http://www.democrathallof... asks
"Why do you always LIE?"

[Courtesy of Buster Norris]

On 14 Jul 2011 16:42:27 GMT, rfischer@sonic.net (Ray Fischer) wrote:
> In fact nearly all of the deficit is the result
>of the Republicans' insane policies.

LIAR!!!!!!!!!!!!!!!!!!!!!!!

"President Barack Obama proposed his 2011 budget during February 2010.
He has indicated that jobs, health care, clean energy, education, and
infrastructure will be priorities. Total requested spending is $3.83
trillion and the federal deficit is forecast to be $1.56 trillion in
2010 and $1.27 trillion in 2011."
http://en.wikipedia.org/wiki/2011_United_States_fede...

Posted from:
The DemocRATs Hall of Shame!
http://www.democrathallof...

rfischer

7/25/2011 4:54:00 AM

0

Harold Burton <hal.i.burton@hotmail.com> wrote:
> rfischer@sonic.net (Ray Fischer) wrote:
>> Bob <dalnetbob@att.net> wrote:

>> >Putting pressure on an already lousy job market, the mass layoff is making a
>> >comeback. In the past week, Cisco, Lockheed Martin and Borders announced a
>> >combined 23,000 in job cuts. (See: Another Retailer Bites the Dust: Borders
>> >Doomed by Amazon Deal, Davidowitz Says)
>>
>> Impossible. We have been assured by Republicans countless times that
>> tax cuts for corporations will result in more hiring. The tax cuts
>> have happened, corporations are reporting record profits. According
>> to the GOP, unemployment must be very low.
>
>Much like we've been assured by Dumbocraps countless times that idiotic
>programs like cash for clunkers will rescue us from the Obama recession.

Care to provide an actual cite for such a claim?

Didn't think so.

Run along, rightard.

--
Ray Fischer | Mendocracy (n.) government by lying
rfischer@sonic.net | The new GOP ideal

Harold Burton

7/25/2011 11:18:00 PM

0

In article <4e2cf6d3$0$2131$742ec2ed@news.sonic.net>,
rfischer@sonic.net (Ray Fischer) wrote:

> Harold Burton <hal.i.burton@hotmail.com> wrote:
> > rfischer@sonic.net (Ray Fischer) wrote:
> >> Bob <dalnetbob@att.net> wrote:
>
> >> >Putting pressure on an already lousy job market, the mass layoff is
> >> >making a
> >> >comeback. In the past week, Cisco, Lockheed Martin and Borders announced
> >> >a
> >> >combined 23,000 in job cuts. (See: Another Retailer Bites the Dust:
> >> >Borders
> >> >Doomed by Amazon Deal, Davidowitz Says)
> >>
> >> Impossible. We have been assured by Republicans countless times that
> >> tax cuts for corporations will result in more hiring. The tax cuts
> >> have happened, corporations are reporting record profits. According
> >> to the GOP, unemployment must be very low.


> >Much like we've been assured by Dumbocraps countless times that idiotic
> >programs like cash for clunkers will rescue us from the Obama recession.


> Care to provide an actual cite for such a claim?




sure, just like you provided a cite for your claim.


snicker