Solved

Error Calling Soap Interface from PHP

Posted on 2013-06-25
5
639 Views
Last Modified: 2016-02-10
I have a soap interface (wsdl) that I need to call from a php script.  I have used wsdl2php to build the pcp file describing the classes and methods of the service.  I am getting the posted error when trying to call the service.  Attached, are the file built by WSDL2PHP and the test script to call it.  Also, how should I go about getting the updated header info into the CB_Server class?

When the call to the service is made at line 25:

print $result = $csa_service->GetPayableItemsList($PayableItemList);



Method at line 3598 of CB_Server.php (I get the error even with the code for the return statement removed)

  /**
   *
   *
   * @param GetPayableItemsList $parameters
   * @return GetPayableItemsListResponse
   */
  public function GetPayableItemsList(GetPayableItemsList $parameters) {
    return $this->__soapCall('GetPayableItemsList', array($parameters),       array(
            'uri' => 'https://apps.csa1.com/cmb',
            'soapaction' => ''
           )
      );
  }




I get the following error:
Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in C:\xampp\htdocs\csa_usaEpay\CB_Server.php:3603 Stack trace: #0 C:\xampp\htdocs\csa_usaEpay\CB_Server.php(3603): SoapClient->__soapCall('GetPayableItems...', Array, Array) #1 C:\xampp\htdocs\csa_usaEpay\soapcalltest.php(25): CB_Server->GetPayableItemsList(Object(GetPayableItemsList)) #2 {main} thrown in C:\xampp\htdocs\csa_usaEpay\CB_Server.php on line 3603
soapcalltest.php
CB-Server.php
0
Comment
Question by:sf_gray
  • 3
5 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39276448
Sounds like the server isn't coded properly. Are you sure you've set the values for the data you are sending to appropriate values? Perhaps the developer of the service missed a validation.
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 39278361
Ask the provider if there is a RESTful interface that you can choose instead.  The world is littered with the rotting carcasses of failed SOAP projects, but I have never seen a REST interface that you could not use immediately with ease.
0
 

Author Comment

by:sf_gray
ID: 39280003
I can call the server from SoapUI tool without issue.  RESTful service is not an option at this time.
0
 

Accepted Solution

by:
sf_gray earned 0 total points
ID: 39280119
Found it!

<?php
            require_once 'CB_Server.php';



            $MultiSpeakMsgHeader = new MultiSpeakMsgHeader('?', 'test', 'test123', '?', '?', '?', 'feet', '?', '?', '?', '?', '?', '?', '?');

            $header = new SoapHeader('http://www.multispeak.org/Version_3.0','MultiSpeakMsgHeader', $MultiSpeakMsgHeader);






            $PayableItemList = new GetPayableItemsList('200001-100001');

            //print $PayableItemList->accountNumber;

            $csa_service = new CB_Server();

            $csa_service->__setSoapHeaders($header);

            print_r($csa_service->__getFunctions());

            //print_r($csa_service->__getTypes());


            //print_r ($result = $csa_service->__SoapCall('GetPayableItemsList',array('GetPayableItemsList'=>(array('accountNumber' => '200001-100001')))));



            print_r ($result = $csa_service->__SoapCall('GetPayableItemsList',array('GetPayableItemsList'=>($PayableItemList))));

                    print "<br />\n Request : ".htmlspecialchars($csa_service->__getLastRequest());

                    print "<br />\n Response: ".htmlspecialchars($csa_service->__getLastResponse());



?>
0
 

Author Closing Comment

by:sf_gray
ID: 39289451
I found a solution to get the results needed.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
XML extra information 8 29
PHP Echo with auto submit 8 28
Restricting the scope of variables to private in OOP 4 22
JQuery Search Filter 2 29
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question