期望开始标记,'<'没发现肥皂错误

时间:2015-07-13 11:01:02

标签: php web-services soap wsdl

我是php中的webservice新手

我有两页,比如

service.php代码为

<?php
//call library
require_once ('lib/nusoap.php');

//using soap_server to create server object
$server = new soap_server;


//register a function that works on server 
$server->register('get_message'); 

// create the function 
function get_message($your_name) 
{ 
if(!$your_name){ 
return new soap_fault('Client','','Put Your Name!'); 
} 
$result = "Welcome to ".$your_name .". Thanks for Your First Web Service Using PHP with SOAP"; 
return $result; 
} 
// create HTTP listener 
if ( !isset( $HTTP_RAW_POST_DATA ) ) $HTTP_RAW_POST_DATA =file_get_contents( 'php://input' );
$server->service($HTTP_RAW_POST_DATA);
exit(); 

?>

,另一个页面就像client.php

    <?php
    require_once ('lib/nusoap.php');

    $client = new soapclient('http://localhost/webservice/nusoap/service.php',array('soap_version'   => SOAP_1_2));
    //Give it value at parameter 
    $param = array( 'your_name' => 'Jayatna ROY'); 
    //Create object that referer a web services 

    //Call a function at server and send parameters too 
    $response = $client->call('get_message',$param); 
    //Process result 
    if($client->fault) 
    { 
    echo "FAULT: <p>Code: ".$client->faultcode."</p>"; 
    echo "String: ".$client->faultstring; 
    } 
    else 
    { 
    echo $response; 
    } 
    ?> 

我正在纠结这样的错误  致命错误:SOAP-ERROR:解析WSDL:无法从“http://localhost/webservice/nusoap/service.php”加载:期望开始标记,'&lt;'在第4行的C:\ wamp \ www \ webservice \ nusoap \ client.php中找不到

你能解决我的错误吗? 提前致谢

0 个答案:

没有答案