Hi,
The issues that makes web service unsuitable in this case are purely
technical and related to what is allowed in a SOAP message. Specifically:
1. You can't insert a processing instruction for the style sheet into the
SOAP Body. Nor is the processing instruction valid at the top of the XML
in the HTTP response since this would cause the XML processor to convert
the response to HTML - which would make most web service clients fail.
2. You _could_ place the name of the style sheet in a SOAP header - e.g.
send back the URL of the style sheet to the caller and let them get it from
you at the location you provide.
Now, you can serve up regular files from the VROOT where your web service
lives. Are you saying that if you say, put in a .txt file, and asked via
IE to get that specific file that ASP.net is refusing? This is likely an
IIS setting. Alternately you can put your style sheets in a regular VROOT
and make the SOAP headers that you return with the URL for each document
point to some web site of your choice where these style sheets live.
In short, SOAP isn't intended to be consumed directly by browser clients.
Dan
--------------------
Thread-Topic: xml-stylesheets and web-service
thread-index: AcTcDbyWazufCXMjSHeZnrmwxfgJaw==
X-WBNR-Posting-Host: 198.169.189.226
From: =?Utf-8?B?R2FyZGFy?= <Ga****@discussions.microsoft.com>
References: <22**********************************@microsoft.co m>
<Gm**************@cpmsftngxa10.phx.gbl>
Subject: RE: xml-stylesheets and web-service
Date: Mon, 6 Dec 2004 19:35:03 -0800
Lines: 78
Message-ID: <92**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices:7933
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
Thanks for the response Dan.
Couple of things ---
1) I did manage to "kludge" in the behaviour I wanted by creating a
WebMethod with the same name as the stylesheet file, and then just respond
with the file when invoked via the GET operation described. This is good
enough for now.
2) It's does not seem unresonable to expect the behaviour I'm looking for:
That is an xml web service responds with an xml file that the client can
either process as it sees fit, or use an author supplied stylesheet to
render
the xml in a "mindless" fashion. Certainly xml and stylesheets seem
designed
with this in mind. If this is not possible with ASP.NET WebServices, then
that seems more a reflection of MS's design/implementation, rather than a
"missuse" of XML Web Service intended use/design.
Again I appreciate your response.
Thanks,
"Dan Rogers" wrote:
Hi,
You can probably do this better as an ASP.net page, instead of a web
service. The only protocol that will successfully process this type of
setup is a browser based HTTP request (e.g. HTTP GET). Web services
aren't intended to work this way.
Regards
Dan Rogers
Microsoft Corporation
--------------------
Thread-Topic: xml-stylesheets and web-service
thread-index: AcTboZs6YO3gPnHQTuKsCW/8+wqyJQ==
X-WBNR-Posting-Host: 198.169.189.226
From: =?Utf-8?B?R2FyZGFy?= <Ga****@discussions.microsoft.com>
Subject: xml-stylesheets and web-service
Date: Mon, 6 Dec 2004 06:41:01 -0800
Lines: 22
Message-ID: <22**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFT NGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices:7890
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
I have a .net webservice, developed with c++ managed extensions.
The websrvice returns an xml-document with a reference to a server side
xml-stylesheet in the format
<?xml-stylesheet href = 'StyleSheet.xsl' type = 'text/xsl'?>
This allows the client to retrieve the stylesheet for rendering the xml,
if needed. When I test this with IE it detects the stylesheet reference and
tries to get the stylesheet file with the following "GET"
GET /MyWS/MyWS.asmx/StyleSheet.xsl
How can I configure the web-service to return the StyleSheet.xsl file,
without any special coding.
Appreciate your help.
Regards