尝试连接到SOAP Web服务(WSDL)时出错

时间:2015-07-17 06:28:52

标签: php wordpress web-services soap wsdl

我尝试连接到SOAP网络服务,但我收到了错误。

这是我得到的错误:

致命错误:未捕获的SoapFault异常:[Client] SoapClient :: SoapClient():/public_html/wp-content/themes/startuply-child/functions.php中的参数无效: 901

以下是代码:

    if(isset($_POST['input_1']))
    {   
        require_once('lib/nusoap.php');
        $proxyhost = '';
        $proxyport = '';
        $proxyusername = '';
        $proxypassword = '';

        $client = new soapclient('http://abr.business.gov.au/abrxmlsearch/ABRXMLSearch.asmx?WSDL', 'true', $proxyhost, $proxyport, $proxyusername, $proxypassword);
    $err = $client->getError();
    if ($err) 
    {
    echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
    }
    // Doc/lit parameters get wrapped



    $param = array('searchString' => '',
                'includeHistoricalDetails' => 'N',
                'authenticationGuid' => '');
    $result = $client->call('ABRSearchByABN', array('parameters' => $param), '', '', false, true);

    // Check for a fault
    if ($client->fault) 
    {
    echo '<h2>Fault</h2><pre>';
    print_r($result);
    echo '</pre>';
    } else 
    {
    // Check for errors
    $err = $client->getError();
    if ($err) 
    {
        // Display the error
        echo '<h2>Error</h2><pre>' . $err . '</pre>';
    } else 
    {

        $OutputGUID = $result['ABRPayloadSearchResults']['request']['identifierSearchRequest']['authenticationGUID'];

        $OutputABN = $result['ABRPayloadSearchResults']['response']['businessEntity']['ABN']['identifierValue'];
        $OutputABNStatus = $result['ABRPayloadSearchResults']['response']['businessEntity']['entityStatus']['entityStatusCode'];
        $OutputASICNumber = $result['ABRPayloadSearchResults']['response']['businessEntity']['ASICNumber'];
        $OutputEntityName = $result['ABRPayloadSearchResults']['response']['businessEntity']['mainName']['organisationName'];
        $OutputTradingName = $result['ABRPayloadSearchResults']['response']['businessEntity']['mainTradingName']['organisationName'];
        $OutputLegalName =  $result['ABRPayloadSearchResults']['response']['businessEntity']['legalName']['givenName'] . " " . 
                            $result['ABRPayloadSearchResults']['response']['businessEntity']['legalName']['otherGivenName'] . " " . 
                            $result['ABRPayloadSearchResults']['response']['businessEntity']['legalName']['familyName'];
        $OutputOrganisationType = $result['ABRPayloadSearchResults']['response']['businessEntity']['entityType']['entityDescription'];
        $OutputState = $result['ABRPayloadSearchResults']['response']['businessEntity']['mainBusinessPhysicalAddress']['stateCode'];
        $OutputPostcode = $result['ABRPayloadSearchResults']['response']    ['businessEntity']['mainBusinessPhysicalAddress']['postcode'];
            echo $OutputEntityName;             
            }
        }

    }

我试图创建一个表单,将ABN发送到ABN查找工具,然后返回某些字段,但我似乎无法连接到它。我认为这与代理登录细节有关。我不知道我是不是想把它们当作某种东西。我在服务器上安装了SOAP,但我使用的是nuSOAP。

非常感谢任何帮助。

干杯,

约旦

1 个答案:

答案 0 :(得分:0)

您正在使用nuSOAP,请在此处更新 -

自:

$client = new soapclient('http://abr.business.gov.au/abrxmlsearch/ABRXMLSearch.asmx?WSDL', 
  'true', $proxyhost, $proxyport, $proxyusername, $proxypassword);

要:

$client = new nusoap_client('http://abr.business.gov.au/abrxmlsearch/ABRXMLSearch.asmx?WSDL', 
  'true', $proxyhost, $proxyport, $proxyusername, $proxypassword);