471,599 Members | 1,489 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,599 software developers and data experts.

Webservice and browser

Hi,
I have a small HTML page which posts requests to a web service. I am
using a IFRAME for that so that the entire page wont reload. All is working
fine except that the respose from the web service changes once it reaches the
client. i.e it adds all javascript for handling + and - events when an xml
file is rendered. I need to avoid that and I need only the pure XML response
from the web service. I added a SoapExtension on my web service and found
that the servcie is working fine and respose is
-----SoapResponse at 7/18/2005 2:35:29 PM
<?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"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><getnameResponse
xmlns="http://tempuri.org/"><getnameResult>Hello</getnameResult></getnameResponse></soap:Body></soap:Envelope>
but whe is reaches the browser
its somethisng like this
**********<HEAD>
<STYLE>BODY{font:x-small 'Verdana';margin-right:1.5em}
..c{cursor:hand}
..b{color:red;font-family:'Courier New';font-weight:bold;text-decoration:none}
..e{margin-left:1em;text-indent:-1em;margin-right:1em}
..k{margin-left:1em;text-indent:-1em;margin-right:1em}
..t{color:#990000}
..xt{color:#990099}
..ns{color:red}
..dt{color:green}
..m{color:blue}
..tx{font-weight:bold
..db{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;border-left:1px solid #CCCCCC;font:small Courier}
..di{font:small Courier}
..d{color:blue}
..pi{color:blue
..cb{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;font:small Courier;color:#888888}
..ci{font:small Courier;color:#888888}
PRE{margin:0px;display:inline}</STYLE>

<SCRIPT><!--
function f(e){
if (e.className=="ci"){if (e.children(0).innerText.indexOf("\n")>0)
fix(e,"cb");}
if (e.className=="di"){if (e.children(0).innerText.indexOf("\n")>0)
fix(e,"db");}
e.id="";
}
function fix(e,cl){
e.className=cl;
e.style.display="block";
j=e.parentElement.children(0);
j.className="c";
etc etc and then the actual response.

How to avoid this ?
Any Suggestions?

Nov 17 '05 #1
2 1275
Ravi,

The problem here is that the mime type of the returned content is
text/xml, so IE shows you that view by default. In order to get around
that, I would use the XmlHttpRequest (I think that is the name) object on
the client to post your request and get your response. You can then take
the XML and set the document content to that XML document (in text form, of
course).

This would also allow you to get rid of the IFRAME as well.

If you don't want to use that on the client side, I would create another
page which will forward the call to the web service for you, and set the
content type on the response to "text/plain" instead of "text/xml" (you
shouldn't modify the original web service to do this). IE might still
process it as XML though, since it sniffs content for types in case the
headers are wrong. However, I believe there are headers you can set to tell
IE to not do that.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ravi" <Ra**@discussions.microsoft.com> wrote in message
news:36**********************************@microsof t.com...
Hi,
I have a small HTML page which posts requests to a web service. I am
using a IFRAME for that so that the entire page wont reload. All is
working
fine except that the respose from the web service changes once it reaches
the
client. i.e it adds all javascript for handling + and - events when an xml
file is rendered. I need to avoid that and I need only the pure XML
response
from the web service. I added a SoapExtension on my web service and found
that the servcie is working fine and respose is
-----SoapResponse at 7/18/2005 2:35:29 PM
<?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"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><getnameResponse
xmlns="http://tempuri.org/"><getnameResult>Hello</getnameResult></getnameResponse></soap:Body></soap:Envelope>
but whe is reaches the browser
its somethisng like this
**********<HEAD>
<STYLE>BODY{font:x-small 'Verdana';margin-right:1.5em}
.c{cursor:hand}
.b{color:red;font-family:'Courier
New';font-weight:bold;text-decoration:none}
.e{margin-left:1em;text-indent:-1em;margin-right:1em}
.k{margin-left:1em;text-indent:-1em;margin-right:1em}
.t{color:#990000}
.xt{color:#990099}
.ns{color:red}
.dt{color:green}
.m{color:blue}
.tx{font-weight:bold}
.db{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;border-left:1px
solid #CCCCCC;font:small Courier}
.di{font:small Courier}
.d{color:blue}
.pi{color:blue}
.cb{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;font:small
Courier;color:#888888}
.ci{font:small Courier;color:#888888}
PRE{margin:0px;display:inline}</STYLE>

<SCRIPT><!--
function f(e){
if (e.className=="ci"){if (e.children(0).innerText.indexOf("\n")>0)
fix(e,"cb");}
if (e.className=="di"){if (e.children(0).innerText.indexOf("\n")>0)
fix(e,"db");}
e.id="";
}
function fix(e,cl){
e.className=cl;
e.style.display="block";
j=e.parentElement.children(0);
j.className="c";
etc etc and then the actual response.

How to avoid this ?
Any Suggestions?

Nov 17 '05 #2
Thanks. That really helped. I'll have a look at the options specified.
-- Ravi

"Nicholas Paldino [.NET/C# MVP]" wrote:
Ravi,

The problem here is that the mime type of the returned content is
text/xml, so IE shows you that view by default. In order to get around
that, I would use the XmlHttpRequest (I think that is the name) object on
the client to post your request and get your response. You can then take
the XML and set the document content to that XML document (in text form, of
course).

This would also allow you to get rid of the IFRAME as well.

If you don't want to use that on the client side, I would create another
page which will forward the call to the web service for you, and set the
content type on the response to "text/plain" instead of "text/xml" (you
shouldn't modify the original web service to do this). IE might still
process it as XML though, since it sniffs content for types in case the
headers are wrong. However, I believe there are headers you can set to tell
IE to not do that.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ravi" <Ra**@discussions.microsoft.com> wrote in message
news:36**********************************@microsof t.com...
Hi,
I have a small HTML page which posts requests to a web service. I am
using a IFRAME for that so that the entire page wont reload. All is
working
fine except that the respose from the web service changes once it reaches
the
client. i.e it adds all javascript for handling + and - events when an xml
file is rendered. I need to avoid that and I need only the pure XML
response
from the web service. I added a SoapExtension on my web service and found
that the servcie is working fine and respose is
-----SoapResponse at 7/18/2005 2:35:29 PM
<?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"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><getnameResponse
xmlns="http://tempuri.org/"><getnameResult>Hello</getnameResult></getnameResponse></soap:Body></soap:Envelope>
but whe is reaches the browser
its somethisng like this
**********<HEAD>
<STYLE>BODY{font:x-small 'Verdana';margin-right:1.5em}
.c{cursor:hand}
.b{color:red;font-family:'Courier
New';font-weight:bold;text-decoration:none}
.e{margin-left:1em;text-indent:-1em;margin-right:1em}
.k{margin-left:1em;text-indent:-1em;margin-right:1em}
.t{color:#990000}
.xt{color:#990099}
.ns{color:red}
.dt{color:green}
.m{color:blue}
.tx{font-weight:bold}
.db{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;border-left:1px
solid #CCCCCC;font:small Courier}
.di{font:small Courier}
.d{color:blue}
.pi{color:blue}
.cb{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;font:small
Courier;color:#888888}
.ci{font:small Courier;color:#888888}
PRE{margin:0px;display:inline}</STYLE>

<SCRIPT><!--
function f(e){
if (e.className=="ci"){if (e.children(0).innerText.indexOf("\n")>0)
fix(e,"cb");}
if (e.className=="di"){if (e.children(0).innerText.indexOf("\n")>0)
fix(e,"db");}
e.id="";
}
function fix(e,cl){
e.className=cl;
e.style.display="block";
j=e.parentElement.children(0);
j.className="c";
etc etc and then the actual response.

How to avoid this ?
Any Suggestions?


Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Nalaka | last post: by
2 posts views Thread by Sergio Cossa | last post: by
5 posts views Thread by Daniel Wilson | last post: by
2 posts views Thread by joelcochran | last post: by
7 posts views Thread by Amirallia | last post: by
2 posts views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.