Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Error Calling Soap Interface from PHP

Posted on 2013-06-25
5
Medium Priority
?
677 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 111

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Online collaboration is quickly becoming embedded in the workplace, and its benefits are tangible. See what the current landscape looks like and what the future holds for collaboration tools and the future of work.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

721 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