PHP不会加载WSDL,但是浏览器显示XML很好吗?

时间:2011-12-13 17:00:18

标签: php soap wsdl

我正在尝试通过SoapClient访问Windows服务。当我在浏览器中输入ip:port时,它会加载WSDL:

<wsdl:definitions name="RmJobService" targetNamespace="http://www.rimage.com/RmJobService">
    <wsdl:types>
        <xsd:schema targetNamespace="http://www.rimage.com/RmJobService/Imports">
            <xsd:import schemaLocation="http://ip:port/RmJobService.svc?xsd=xsd0" namespace="http://www.rimage.com/RmJobService"/>
            <xsd:import schemaLocation="http://ip:port/RmJobService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
            <xsd:import schemaLocation="http://ip:port/RmJobService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/Rimage.Web.Service"/>
            <xsd:import schemaLocation="http://ip:port/RmJobService.svc?xsd=xsd3" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
        </xsd:schema>
    </wsdl:types>
    ...etc...

但是当我尝试建立SoapClient时:

try 
{
    $sclient = new SoapClient('http://ip:port/RmJobService.svc?wsdl', array(
        "trace" => 1, "soap_version" => SOAP_1_1));
}
catch (SoapFault $ex)
{
    echo $exception->getMessage();
}

我收到此错误:

SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://ip:port/RmJobService.svc?wsdl' : Start tag expected, '<' not found 

即使尝试使用file_get_contents或cURL也会返回null。任何想法在这里发生了什么?

戴夫

1 个答案:

答案 0 :(得分:1)

这最终成为服务器防火墙问题。检查主机以确保它可以连接到源,一旦他们打开端口,一切正常。哑。