简体   繁体   中英

Getting object reference not set to an instance of an object PHP Soap Client

I am trying to call a courier api with specified method. I am able to connect with the api using soapclient but getting following error:

Object reference not set to an instance of an object

I am using following code and data

    $proxy = new SoapClient($my_api_url);
    $params = array(
            "UserName" => '****',
            "Password" => '****',
            "OrderNumber" => '41111',
            "ClientName" => 'My Name',
            "ContactNumber1" => '123456789', 
            "EmailAddress" => 'testapi@rohitdhiman.in', 
            "ShippingAddress1" => 'site 15'
            );
    $result = $proxy->BayOneAddOrder($params);
    print_r($result);

If it works using SOAP UI then you can try using a PHP tool like https://providr.io as it will give you the exact PHP request using OOP approach.

If you do not want to use the online tool, then you can generate your own PHP package from your WSDL using PackageGenerator so you'll send request easily still using OOP approach.

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