duanli0162 2011-11-11 12:19
浏览 75

PHP SoapServer:不解析XML(WSDL文件) - 没有XML文件 - 在URL上使用“?wsdl”

I'm having problems with my Soap Server implemented on PHP on my production server (remote one).

I've implemented a simple Soap Server (native PHP class) with just on function on WSDL mode.

So my code looks like:

ini_set("soap.wsdl_cache_enabled", "0");

$server = new SoapServer("wsSeguimiento.wsdl");

$server->addFunction("ResultadoDetalleExtendido");

$server->handle();

Now, as you know, when you call the server via web-browser with the url like "http://localhost/soapserver/wsServer.php", you got a blank page - in my case - or whatever you've programmed there (server code).

But if you call the same URL with the "?wsdl" at the end "http://localhost/soapserver/wsServer.php?wsdl", then the server (handle function I guess) resolves the XML wsdl on the web browser, so you get a text/xml content type and you can see the XML definition itself.

Now, it works on my development environment. No problems. I've created a Soap client to test my own server, and to see if it return the expeted response, and everything works fine. But when I upload the code to the production server, it doesn't work.

Firefox shows on the url with "?wsdl" call, the typical error saying "XML malformed", but in this particular case it's from the beginning, like if there were no XML file at all. And if I use my client, I get the error:

SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://.../SOAP_SERVER/seguimientoServer.php?wsdl' : Start tag expected, '<' not found

I've correctly changed namespaces and URLs in the WSDL XML file. So it have to work properly. But it doesn't.

I've found that there are existing bugs related with HTTP header itself, based on chunked data, content-length, X-powered-by, whatever...

But I don't see a solution.

I've done a little hack on my server based on this (after handle() call):

if( isset($_REQUEST['wsdl']) )
{
    ob_clean();
    echo file_get_contents( "wsSeguimiento.wsdl" );
}

And with this, it really works! But I'm sure that this doesn't have to be the way to solve it...

  • 写回答

1条回答 默认 最新

  • duanjiao6735 2011-11-11 12:49
    关注

    looks like there is an invalid character at the beginning of your wsdl. maybe a space?

    评论

报告相同问题?

悬赏问题

  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入