带有肥皂的PHP - 文档末尾的额外内容

发布于 2025-01-23 06:12:05 字数 1671 浏览 0 评论 0原文

我开始使用SOAP学习PHP,但是在我的初始测试中,要查看它是如何工作的,我会遇到此错误,

Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL:
Couldn't load from 'http://localhost/M07_ACT5/servidor.php?wsdl' : 
Extra content at the end of the document in C:\xampp\htdocs\M07_ACT5\cliente.php:4 
Stack trace: 
#0 C:\xampp\htdocs\M07_ACT5\cliente.php(4):
SoapClient->__construct('http://localhos...') 
#1 {main} thrown in C:\xampp\htdocs\M07_ACT5\cliente.php on line 4

它将其扔到Soapclient构造函数上,但是 extra extrue content 是什么?

我确保我的php.ini文件允许使用肥皂。

Client.php

<?php

require_once("lib/nusoap.php");
$client = new soapclient('http://localhost/M07_ACT5/servidor.php?wsdl'); <---- HERE
$result = $client->holaMundo();
echo $result;

?>

这是我用于此测试的Server.php文件。我检查了名称空间是否正确,但它在正确的文件夹中。

<?php

require_once("lib/nusoap.php");
$namespace = "http://localhost/M07_ACT5/servidor.php";
$server = new soap_server();
$server->configureWSDL("MiServicioWeb", $namespace);
$server->schemaTargetNamespace = $namespace;
$server->soap_defencoding = 'UTF-8';

function holaMundo(){
    return "Hola, mundo!!!";
    }

    
    $server->register(
        'holaMundo',
        array(),
        array('return'=>'xsd:string'),
        $namespace,
        false,
        'rpc',
        'encoded',
        'Método HolaMundo '
        );
        
        $server->service(file_get_contents("php://input"));
?>

I'm starting to learn PHP with SOAP, but during my initial test to see how it works I run into this error

Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL:
Couldn't load from 'http://localhost/M07_ACT5/servidor.php?wsdl' : 
Extra content at the end of the document in C:\xampp\htdocs\M07_ACT5\cliente.php:4 
Stack trace: 
#0 C:\xampp\htdocs\M07_ACT5\cliente.php(4):
SoapClient->__construct('http://localhos...') 
#1 {main} thrown in C:\xampp\htdocs\M07_ACT5\cliente.php on line 4

It throws it on the soapclient constructor line, but what is the extra content?

I made sure that my php.ini file allows the use of SOAP.

Client.php

<?php

require_once("lib/nusoap.php");
$client = new soapclient('http://localhost/M07_ACT5/servidor.php?wsdl'); <---- HERE
$result = $client->holaMundo();
echo $result;

?>

This is my server.php file for this test. I checked if the name space is right but it's in the correct folder.

<?php

require_once("lib/nusoap.php");
$namespace = "http://localhost/M07_ACT5/servidor.php";
$server = new soap_server();
$server->configureWSDL("MiServicioWeb", $namespace);
$server->schemaTargetNamespace = $namespace;
$server->soap_defencoding = 'UTF-8';

function holaMundo(){
    return "Hola, mundo!!!";
    }

    
    $server->register(
        'holaMundo',
        array(),
        array('return'=>'xsd:string'),
        $namespace,
        false,
        'rpc',
        'encoded',
        'Método HolaMundo '
        );
        
        $server->service(file_get_contents("php://input"));
?>

This is my folder structure , maybe it has something to do with it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文