dongshao5573 2011-09-14 10:45
浏览 58

IE8没有显示XML但是弹出一个“你想要保存这个文件吗?”为什么?

I am testing a SOAP service that has a single operation that returns a string containing an XML document. My server and client are implemented in PHP.

Here is the source for my client:

<?php
header('Content-Type: text/xml, charset=iso-8859-1'); 
header("Content-Disposition: inline");
try{
  $sClient = new SoapClient('http://localhost/soap/test.wsdl');
  $response = $sClient->getDocument();
  echo($response);
} catch(SoapFault $e){
   var_dump($e);
}
?>

And this is the XML returned by the SOAP service and echoed by the client:

<?xml version="1.0" encoding="iso-8859-1" ?>
<root>
<form formname="test">
   <post postid="2000" userid="bbh" postdate="2011-09-14" posttime="11:03:32">
      <item name="Item1" value="123" />
      <item name="Item2" value="456" />
   </post>
</form>
</root>

When I test the SOAP client in Firefox for mac, Firefox for Windows and Safari, the XML returned by the SOAP service is correctly displayed in these browsers. However, when I test it on IE7 (on Windows 2003 Server) I get a blank screen even though I see the XML if I do a view source on the page. When I test it on IE8 (on Windows 7), I get a popup box saying "Do you want to save this file or find a program online to load it?".

Does anyone have any idea why the XML is not being displayed correctly in IE7 and IE8?

UPDATE:

Here are the HTTP headers which I got from Live HTTP headers in Firefox:

http://localhost/soap/testclient.php

GET /soap/testclient.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0.1) Gecko/20100101 Firefox/5.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Connection: keep-alive
Cookie: PHPSESSID=bo6dlobivah1iaeu6d53vt9s10
Cache-Control: max-age=0
HTTP/1.1 200 OK
Connection: close

Date: Wed, 14 Sep 2011 11:09:57 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET, PHP/5.2.1
Content-Type: text/xml, charset=iso-8859-1
  • 写回答

2条回答 默认 最新

  • douqiao6015 2011-09-14 10:50
    关注

    I guess that's the default action built-in for the XML mime type. You could try commenting the content-type header, or changing the mime type to text/html. Not really nice but could do the trick.

    评论

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line