55629

PHP: Webservice error SoapClient

Question:

Request from SoapUI

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:not="http://xxx.xxx.xxx.com/"> <soapenv:Header/> <soapenv:Body> <not:SaasNotificationResponse> <hostID>UCALL</hostID> <orderID>1180000335810000000010</orderID> <custID>1180000335770000000010</custID> <typeTransaction>SUSPENSION</typeTransaction> <status>3</status> <message>SUSPENSION 1180000335770000000010</message> <notifyAttr> <name>?</name> <value>?</value> </notifyAttr> </not:SaasNotificationResponse> </soapenv:Body> </soapenv:Envelope>

Response From SoapUI:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:SaasNotificationResponseResponse xmlns:ns2="http://xxx.xxxx.xxx.com/"> <return>F</return> <return>Invalid TypeTransaction</return> </ns2:SaasNotificationResponseResponse> </S:Body> </S:Envelope> <hr />

Codding PHP Client;

require_once('lib/nusoap.php'); try { $client = new SoapClient("http://xxx.xxx.xxx/Notification?WSDL"); $data = array( 'hostID' => 'UCALL', 'orderID' => '1180000335810000000010', 'custID' => '1180000335810000000010', 'typeTransaction' => 'ACTIVATION', 'status' => '3', 'message' => 'Activation complete', 'notifyAttr' => array( array('name'=>'AccountID','value'=>'110022101010'), array('name'=>'PackageID','value'=>'1') ) ); $return=$client->SaasNotificationResponse($data); //$return=$client->call('SaasNotificationResponse',($data)); print_r($return); }catch (SoapFault $e){ echo $e; } <blockquote>

Error Application. <strong>Fatal error: Call to undefined method soapclient::SaasNotificationResponse() in C:\wamp\www\spgdtws\notification.php</strong>

</blockquote>

I have a problem in php webservice applications. if using soapUI. webservice server can be invoked. but when I use the application on the client. error occurs. please help

Answer1:

It seems that you are calling notification WSDL for Telkom's service. this code works for me

<?php function sendNotification($orderID,$custID,$typeTransaction,$status,$message) { try { $client = new SoapClient("XXXXXXXXX/Notification?wsdl",array("trace"=>1,"exceptions"=>1)); $data = array( 'hostID' => '', 'orderID' => $orderID, 'custID' => $custID, 'typeTransaction' => $typeTransaction, 'status' => $status, 'message' => $message, 'notifyAttr' => array( array('name'=>'','value'=>''), array('name'=>'','value'=>'') ) ); $return=$client->SaasNotificationResponse($data); var_dump($return); }catch (SoapFault $e){ echo $e; } } sendNotification('1180000339980000000010','4720562','TERMINATION','3','TERMINATION success'); ?>

You don't need to include nusoap. Use native PHP's SOAP instead. SoapClient class is belong to native PHP.

for reference : <a href="http://php.net/manual/en/class.soapclient.php" rel="nofollow">http://php.net/manual/en/class.soapclient.php</a>

Recommend

  • xpath Query for xpath extractor of Jmeter
  • Dynamic JAXB exceptions
  • Upload file using PHP from Compute Engine to Cloud Storage
  • No namespace in nested tags in SOAP message with JAX-WS
  • Google Cloud Platform - Vanity Nameservers
  • Attemping to change attributes of $(this) inside success function
  • MarkLogic Node.js Sort on “last-modified”
  • How to wait for all async tasks to finish in Node.js?
  • call a java program from a webapp in tomcat server - the java program is out side of tomcat server
  • Displaying a list of videos from a channel - Vimeo Advanced API
  • PWA with multiple pages
  • Should I be afraid to use UDP to make a client/server broadcast talk?
  • Ionic storage “get” returns null only on the second call within method
  • Google OAuth: can't get refresh token with authorization code
  • What command do i need to pass in SabreCommandLLSRQ to get current price of PNR?
  • PHP Listener Script for Paypal Webhooks
  • Can't delete or rename original file after resizing
  • Execute scripts AJAX returns
  • CakePHP ACL tutorial initDB function warnings
  • Spring Cloud Microservice Architecture Confusion
  • Transactional Create with Validation in ServiceStack Redis Client
  • Exception “firebase.functions() takes … no argument …” when specifying a region for a Cloud Function
  • Handling un-mapped Rest path
  • Seeking advice on Jetty HttpClient Hang
  • Using variable in a value field in jMeter
  • Why is an OPTIONS request sent to the server?
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • PHP - How to update data to MySQL when click a radio button
  • DotNetZip - Calculate final zip size before calling Save(stream)
  • How to add date and time under each post in guestbook in google app engine
  • Javascript + PHP Encryption with pidCrypt
  • Upload files with Ajax and Jquery
  • Do I've to free mysql result after storing it?
  • Numpy divide by zero. Why?
  • Is there a mandatory requirement to switch app.yaml?
  • File upload with ng-file-upload throwing error
  • A cron job substitute?
  • ExecuteAsync RestSharp to allow backgroundWorker CancellationPending c#
  • json Serialization in asp
  • AngularJs get employee from factory