Search code examples
phpsoapwsdl

PHP won't load WSDL, but browser displays XML fine?


I am trying to access a Windows Service via SoapClient. When I type the ip:port in my browser, it loads the WSDL fine:

<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...

But when I try to establish a 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();
}

I get this error:

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

Even trying to use file_get_contents or cURL returns null. Any ideas what is going on here?

Dave


Solution

  • This ended up being a server firewall issue. Check with the host to make sure it could connect to the source and once they opened the port, everything worked fine. Dumb.