Solved

Error Calling Soap Interface from PHP

Posted on 2013-06-25
5
662 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 110

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

The task of choosing a web design company to build a website for your business should never be taken in a light manner. Provided the fact that your website will act as a representative to your business and will be responsible for imposing an online …
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

626 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