error when trying to connect to SOAP web service (WSDL)

I’m trying to connect to a SOAP web service but I’m getting an error.

This is the error I’m getting:

Read More

Fatal error: Uncaught SoapFault exception: [Client] SoapClient::SoapClient(): Invalid parameters in /public_html/wp-content/themes/startuply-child/functions.php:901

Here is the code:

    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;             
            }
        }

    }

I’m trying to make a form which sends an ABN to the ABN lookup tool and then returns certain fields but I can’t seem to connect to it. I think it is something to do with the Proxy log in details. I don’t know if i am meant to set these as something. I have SOAP installed on the server but I am using nuSOAP.

Any help would be greatly appreciated.

Cheers,

Jordan

Related posts

1 comment

  1. You are using nuSOAP, update here –

    From:

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

    To:

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

Comments are closed.