0

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" => '[email protected]', 
            "ShippingAddress1" => 'site 15'
            );
    $result = $proxy->BayOneAddOrder($params);
    print_r($result);
6
  • The server had an error, possibly caused by invalid input to it. That is a .NET error message body. Why it didn't properly return a 5xx (barring a more graceful failure), made it be a double-fail on the server's part. Try to generate a valid SOAP message (use a UI for it of course!) to reproduce the issue; if/when you can, and it is verified to be a valid SOAP call per the API, send that information to whomever provides the API and tell them to fix it. Commented Sep 22, 2015 at 7:15
  • stackoverflow.com/questions/8085759/… Commented Sep 22, 2015 at 7:19
  • I tried the same request using SOAP UI and it is working fine there Commented Sep 22, 2015 at 7:20
  • Good start! Then find out what the difference is of the actual SOAP request between the two forms of sending. Commented Sep 22, 2015 at 7:21
  • request is same and still not getting response from SOAP client. Commented Sep 22, 2015 at 10:43

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.