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 / December 2004

Tip: Looking for answers? Try searching our database.

xml-stylesheets and web-service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gardar - 06 Dec 2004 14:41 GMT
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.
Dan Rogers - 06 Dec 2004 20:57 GMT
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?= <Gardar@discussions.microsoft.com>
Subject: xml-stylesheets and web-service
Date: Mon, 6 Dec 2004 06:41:01 -0800
Lines: 22
Message-ID: <226924E0-67BB-44BF-A3A1-701C236222AB@microsoft.com>
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!TK2MSFTNGXA03.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.
Gardar - 07 Dec 2004 03:35 GMT
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,

> Hi,
>
[quoted text clipped - 51 lines]
>
> Regards
Dan Rogers - 07 Dec 2004 20:49 GMT
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?= <Gardar@discussions.microsoft.com>
References:  <226924E0-67BB-44BF-A3A1-701C236222AB@microsoft.com>
<GmPQyY92EHA.3388@cpmsftngxa10.phx.gbl>
Subject: RE: xml-stylesheets and web-service
Date: Mon, 6 Dec 2004 19:35:03 -0800
Lines: 78
Message-ID: <92EE3398-3AE4-4479-87C6-BAB23FEBDDF9@microsoft.com>
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,
>
[quoted text clipped - 51 lines]
>
> Regards
Gardar - 08 Dec 2004 00:45 GMT
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,

> Thanks for the response Dan.
>
[quoted text clipped - 72 lines]
> >
> > Regards
Dan Rogers - 13 Dec 2004 20:09 GMT
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?= <Gardar@discussions.microsoft.com>
References:  <226924E0-67BB-44BF-A3A1-701C236222AB@microsoft.com>
<GmPQyY92EHA.3388@cpmsftngxa10.phx.gbl>
<92EE3398-3AE4-4479-87C6-BAB23FEBDDF9@microsoft.com>
Subject: RE: xml-stylesheets and web-service
Date: Tue, 7 Dec 2004 16:45:01 -0800
Lines: 113
Message-ID: <B817961C-873F-4BF1-92E0-71998036DCF7@microsoft.com>
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,

> Thanks for the response Dan.
>
[quoted text clipped - 74 lines]
> >
> > Regards

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.