Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / November 2004

Tip: Looking for answers? Try searching our database.

SoapEnvelope WebMethod Indentation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Raj - 03 Nov 2004 03:39 GMT
I am using a SOAP WebMethod -ASP.net (wse2.0)

[WebMethod(Description="This method receives requests for
processing.",EnableSession=false)]
public SoapEnvelope Request()
{
return SoapEnvelope
}

The results come back in an indented format as below even if I dont have any
newline or whitespaces as part of the SoapEnvelope even though I didnt have
it when I built my response messsage.Any idea how to make it not indent?

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
mlns:xsd="http://www.w3.org/2001/XMLSchema";>
<soap:Body>
</soap:Body>
</soap:Envelope>

Any help would be much appreciated
Thanks
Raj
Drew Marsh - 03 Nov 2004 04:58 GMT
> I am using a SOAP WebMethod -ASP.net (wse2.0)
>
[quoted text clipped - 8 lines]
> though I didnt have  it when I built my response messsage.Any idea how
> to make it not indent?

How exactly did you build your response message? Truthfully, it really doesn't matter how you build it because it gets loaded into an XmlDocument (SoapEnvelope's base class), so all that is retained is the infoset representation. To the best of my knowledge, there is no way to change the formatting. If you look at SoapEnvelope.Save in ildasm you'll see that it constructs it's XmlTextWriter over a Stream and simply specifies a text encoding. It doesn't set the XmlTextWriter.Formatting property anywhere, which is what controls the text represetation of the instance document as it is output.

HTH,
Drew
Drew Marsh - 03 Nov 2004 05:36 GMT
I wrote:

> To the best of my knowledge, there is no
> way to change the formatting. If you look at SoapEnvelope.Save in
> ildasm you'll see that it constructs it's XmlTextWriter over a Stream
> and simply specifies a text encoding. It doesn't set the
> XmlTextWriter.Formatting property anywhere, which is what controls the
> text represetation of the instance document as it is output.

On and just to be clear, you *could* Save the SoapEnvelope yourself yourself by passing an XmlTextWriter implementation configured how you like to the Save(XmlWriter) overload (inherited from XmlDocument). All I'm saying is that I don't see anyway, in the default architecture. You should definitely be able to cruft together your own custom configuration to acheive this. How much work it will be, I don't know. It looks like you might want to write your own ISoapFormatter. SoapPlainFormatter for example, simply calls SoapEnvelope.Save(Stream) which does what I explained earlier.

HTH,
Drew

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.