By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,743 Members | 1,018 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,743 IT Pros & Developers. It's quick & easy.

xml-stylesheets and web-service

P: n/a
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.

Nov 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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.


Nov 23 '05 #2

P: n/a
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

Nov 23 '05 #3

P: n/a
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


Nov 23 '05 #4

P: n/a
Dan, thanks again for you response...

A number of items to clarify.

1) I've already worked out a solution to my particular problem, so our
discussion is now somewhat "academic"

2) My Web Service is only implemented wtih HTTP "POST" bindings, I'm not
using SOAP for the transactions.

3) This is my first forai into Web Service implementation so my
understanding of the issues is very basic

So to recap the problem I was having...

I return and XML document/stream with a processing instruction of the form,

<?xml-stylesheet href = 'StyleSheet.xsl' type = 'text/xsl'?>

the XML is sent back in response to a POST, so the brower receives the full
XML response, what happanes then is the IE comes back with a HTTP GET of the
form

GET /MyWS/MyWS.asmx/StyleSheet.xsl

(http://server-root//MyWS/MyWS.asmx/StyleSheet.xsl), since this is
referenced relative to the web-service asmx _file_, the GET fails

Again, I appreciate your time, and I do understand if this is too mundane
and issue for further response.

Regards,

"Gardar" wrote:
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

Nov 23 '05 #5

P: n/a
Hi Gardar,

My point is that WS is not intended to be called by browsers, and thus if
you are called by a web service proxy, you will not be able to insert the
processing instruction under the SOAP:Body. As a service endpoint, you
don't (theoretically) control the client's technology - you are just
serving up SOAP (assuming you're doing an ASP.Net web service).

For the kind of form post, browser facing, XML slinging application you are
describing, you will have far better luck making this a simple web
applicaiton and avoiding adding in the Web Service stack at all.

I hope this helps

Dan
--------------------
Thread-Topic: xml-stylesheets and web-service
thread-index: AcTcvyZmR8m+tAdrRRKbffodUjLdXw==
X-WBNR-Posting-Host: 198.169.188.226
From: =?Utf-8?B?R2FyZGFy?= <Ga****@discussions.microsoft.com>
References: <22**********************************@microsoft.co m>
<Gm**************@cpmsftngxa10.phx.gbl>
<92**********************************@microsoft.co m>
Subject: RE: xml-stylesheets and web-service
Date: Tue, 7 Dec 2004 16:45:01 -0800
Lines: 113
Message-ID: <B8**********************************@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:7976
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

Dan, thanks again for you response...

A number of items to clarify.

1) I've already worked out a solution to my particular problem, so our
discussion is now somewhat "academic"

2) My Web Service is only implemented wtih HTTP "POST" bindings, I'm not
using SOAP for the transactions.

3) This is my first forai into Web Service implementation so my
understanding of the issues is very basic

So to recap the problem I was having...

I return and XML document/stream with a processing instruction of the form,

<?xml-stylesheet href = 'StyleSheet.xsl' type = 'text/xsl'?>

the XML is sent back in response to a POST, so the brower receives the full
XML response, what happanes then is the IE comes back with a HTTP GET of
the
form

GET /MyWS/MyWS.asmx/StyleSheet.xsl

(http://server-root//MyWS/MyWS.asmx/StyleSheet.xsl), since this is
referenced relative to the web-service asmx _file_, the GET fails

Again, I appreciate your time, and I do understand if this is too mundane
and issue for further response.

Regards,

"Gardar" wrote:
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


Nov 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.