【问题标题】:PHP : SOAP - Returning HTTP Not FoundPHP:SOAP - 未找到返回 HTTP
【发布时间】:2017-02-15 03:57:35
【问题描述】:

我遇到了从 PHP 到 .NET Web 服务的 SOAP 调用问题。希望这是我所缺少的一些简单的东西,但如果有人可以提供帮助,那就太好了。肥皂电话如下:

// Start client:
$client = new SoapClient('http://connect7.gardners.com/priceavail.asmx?wsdl', array
(
    // Options:
    'trace' => 1
));

// Params:
$params = array(...)

// Call:
$response = $client->__soapCall("PriceAvailabilityRequest", array($params));

它会触发以下异常:

Fatal error: SOAP Fault: (faultcode: HTTP, faultstring: Not Found)

如果我在客户端调用 __getFunctions(),它会返回:

array(4) {
    [0]=> string(65) "Gardners_HelloResponse Gardners_Hello(Gardners_Hello $parameters)"
    [1]=> string(95) "PriceAvailabilityRequestResponse PriceAvailabilityRequest(PriceAvailabilityRequest $parameters)"
    [2]=> string(65) "Gardners_HelloResponse Gardners_Hello(Gardners_Hello $parameters)"
    [3]=> string(95) "PriceAvailabilityRequestResponse PriceAvailabilityRequest(PriceAvailabilityRequest $parameters)"
}

这是我在客户端调用 __getLastRequest 时生成的请求:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.bic.org.uk/webservices" xmlns:ns2="http://connect7.gardners.com/">
    <SOAP-ENV:Body>
        <ns2:PriceAvailabilityRequest>
            <ns2:PA_Request>
                <ns1:Header>
                    <ns1:ClientID>XXXXXX</ns1:ClientID>
                    <ns1:ClientPassword>XXXXXX</ns1:ClientPassword>
                    <ns1:AccountIdentifier>
                        <ns1:AccountIDType>02</ns1:AccountIDType>
                    </ns1:AccountIdentifier>
                    <ns1:SupplierIdentifier>
                        <ns1:SupplierIDType>02</ns1:SupplierIDType>
                    </ns1:SupplierIdentifier>
                    <ns1:SupplierRegionsCoded>
                         <ns1:SupplierRegionCodeType>01</ns1:SupplierRegionCodeType>
                    </ns1:SupplierRegionsCoded>
                    <ns1:CurrencyCode>GBP</ns1:CurrencyCode>
                </ns1:Header>
                <ns1:Product>
                    <ns1:EAN13>9780007185580</ns1:EAN13>
                    <ns1:ProductIdentifier>
                        <ns1:ProductIDType>15</ns1:ProductIDType>
                    </ns1:ProductIdentifier>
                </ns1:Product>
            <ns2:PA_Request>
        </ns2:PriceAvailabilityRequest>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

这是来自 web 服务文档的示例请求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:con="http://connect7.gardners.com/" xmlns:web="http://www.bic.org.uk/webservices">
    <soapenv:Header/> 
    <soapenv:Body>
        <con:PriceAvailabilityRequest>
            <con:PA_Request version="1.2">
                <web:Header>
                    <web:ClientID>XXXXXXX</web:ClientID>
                    <web:ClientPassword>XXXXXX</web:ClientPassword>
                    <web:AccountIdentifier>
                        <web:AccountIDType>02</web:AccountIDType> 
                    </web:AccountIdentifier>
                    <web:SupplierIdentifier>
                        <web:SupplierIDType>02</web:SupplierIDType> 
                    </web:SupplierIdentifier> 
                    <web:SupplierRegionsCoded>
                       <web:SupplierRegionCodeType>01</web:SupplierRegionCodeType> 
                    </web:SupplierRegionsCoded> 
                    <web:CurrencyCode>GBP</web:CurrencyCode>
                </web:Header>
                <web:Product>
                    <web:EAN13>9780762444205</web:EAN13> 
                    <web:ProductIdentifier>
                        <web:ProductIDType>15</web:ProductIDType> 
                    </web:ProductIdentifier>
                </web:Product> 
            </con:PA_Request>
        </con:PriceAvailabilityRequest> 
    </soapenv:Body>
</soapenv:Envelope>

我已尝试调查导致错误“未找到”的原因,但没有发现任何具体内容。从我发现命名空间的差异不应该引起问题吗?任何帮助将不胜感激。

【问题讨论】:

    标签: php xml web-services soap


    【解决方案1】:

    Faultcode "HTTP" 和 Faultstring "Not Found" 表示您的客户端无法访问服务器(端点)。

    WSDL 可用,但服务端点 http://connect7.gardners.com/PriceAvail/priceavail.asmx 似乎不可用。

    【讨论】:

    • 该项目被搁置,因此我延迟接受。但这很可能是原因。感谢您的回复。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-03-03
    • 2015-12-09
    • 2018-04-18
    • 1970-01-01
    • 2017-02-05
    • 2020-09-29
    • 1970-01-01
    相关资源
    最近更新 更多