未捕获的SoapFault异常:[客户端]函数(“方法名称”)不是此服务的有效方法

时间:2019-01-20 17:30:56

标签: php xml

尝试验证SOAP请求时出现以下错误

  

致命错误:未捕获的SoapFault异常:[Client]函数(“方法名”)不是C:\ xampp \ htdocs \ api.php:7中此服务的有效方法:堆栈跟踪:#0 C:\ xampp \ htdocs \ api.php(7):SoapClient-> __ call('methodname',Array)#1 C:\ xampp \ htdocs \ api.php(7):SoapClient-> methodname(Object(SoapHeader))#2 {main }在第7行的C:\ xampp \ htdocs \ api.php中抛出

以下是我编写的PHP代码:

<?php
$apiauth =array('Token'=>'string');
$wsdl = 'https://testtiwi.europaeiske.dk/ecommerceprivateservice.asmx?wsdl';
$header = new SoapHeader('http://webs.europaeiske.dk', 'SecurityToken', $apiauth);
$soap = new SoapClient($wsdl); 
$soap->__setSoapHeaders($header);       
$data = $soap->methodname($header); 
?>

以下是WSDL代码:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <SecurityToken xmlns="http://webs.europaeiske.dk">
            <Token>string</Token>
        </SecurityToken>
    </soap:Header>
    <soap:Body>
        <ProductTerms xmlns="http://webs.europaeiske.dk">
            <productCode>string</productCode>
            <tripData>
                <StartDate>string</StartDate>
                <EndDate>string</EndDate>
                <TripType>string</TripType>
                <GeographicalZone>string</GeographicalZone>
                <DestinationList>
                    <string>string</string>
                    <string>string</string>
                </DestinationList>
            </tripData>
        </ProductTerms>
    </soap:Body>
</soap:Envelope>

请帮助我解决该错误?

0 个答案:

没有答案