Error un invoking a PHP Webservice using PHP itself

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aswathip
    New Member
    • Jan 2009
    • 16

    Error un invoking a PHP Webservice using PHP itself

    I am doing a Webservice in PHP for the first time. I have a service named as testWebService. php and testclient.php that consumes the service. Below is my testclient.php

    Code:
    <?php
    require_once 'includes/nusoap.php';
    $params = array('CardId' => 'sm_stu_id_001', 
    				'DeviceIp' => '192.168.60.68'
    			   );
    $client = new nusoap_client('testWebService.php',false);
    //+++++++++++++++++++++++++++++++++++++
    $soapError = $client->getError();
    if (! empty($soapError)) 
    {    
    	$errorMessage = 'Nusoap object creation failed: ' . $soapError;    
    	throw new Exception($errorMessage);
    }
    //+++++++++++++++++++++++++++++++++++++
    $result = $client->call('hello',$params);
    //+++++++++++++++++++++++++++++++++++++
    $soapError = $client->getError();
    if (! empty($soapError)) 
    {    
    	$errorMessage = 'SOAP method invocation (verifyT) failed: ' . $soapError;    
    	throw new Exception($errorMessage);
    }
    //+++++++++++++++++++++++++++++++++++++
    /echo "Result => ".$result;
    ?>
    This code generates an exception as below
    Fatal error: Uncaught exception 'Exception' with message 'SOAP method invocation (verifyT) failed: no transport found, or selected transport is not yet supported!' in E:\wamp\www\sma rtcard\Orginal\ testClient.php: 21 Stack trace: #0 {main} thrown in E:\wamp\www\sma rtcard\Orginal\ testClient.php on line 21.

    Can anyone please tell me what the problem may be.

    Thanks
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    that’s because you get a SOAP error (line 17) and therefore you throw an Exception (line 21). if you don’t catch the Exception (using try catch) and don’t have a default exception handler, the Exception causes the error observed.

    Comment

    • aswathip
      New Member
      • Jan 2009
      • 16

      #3
      thanx Dormilich. I tried it but the error remained.

      Comment

      • aswathip
        New Member
        • Jan 2009
        • 16

        #4
        I changed the path as

        $path = "http://192.168.60.26:8 1/sm/Org/testWebService. php";
        $client = new soapclientNusoa p($path,false);

        and the problem was solved. But this path may change latter. So i am looking for a better solution

        Comment

        Working...