简体   繁体   中英

PHP SOAP-ERROR: Parsing Schema: can't import schema from xsd

I am running some web services which are written using soap.

Some of the web services are running however those that try to import a local xsd are failing

<faultcode>WSDL</faultcode>
<faultstring>
    SOAP-ERROR: Parsing Schema: can't import schema from 'http://localhost/myproject/_xsd/1'
</faultstring>

The following is an extract from my wsdl

<definitions
        xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
        xmlns:wsp="http://www.w3.org/ns/ws-policy"
        xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy"
        xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        xmlns:tns="http://ws.platform.commersite.com/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="http://schemas.xmlsoap.org/wsdl/"
        targetNamespace="http://ws.platform.commersite.com/"
        name="PlatformControllerWSService">
<types>
    <xsd:schema>
        <xsd:import
                namespace="http://mysite/"
                schemaLocation="http://localhost/myproject/1" />
    </xsd:schema>
    <xsd:schema>
        <xsd:import
                namespace="http://somesite/"
                schemaLocation="http://localhost/myproject/_xsd/2" />
    </xsd:schema>
</types>

Loading the xsd files goes to a php function

public function _xsdAction($xsd) {
        $this->response->setHeader("Content-Type", "text/xml");

        $this->view->pick('server/_xsd' . $xsd);

        $this->view->setVars(array(
            'param1' => Server::config('param1'),
            'param2'  => Server::config('param2'),
        ));
}

Also worth mentioning is that xsd1 imports xsd2

<xs:import namespace="{{ param1 }}" schemaLocation="{{ param2 }}xsd/2"/>

I am not sure what the issue might be. Any help would be appreciated

Resolved!

The problem was the path being used to locate the xsd file was incorrect as it was already entering the /myproject/ folder and did not require me adding the location of /myproject/ manually.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM