首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >协同欺骗SOAP测试:在文档末尾的实体异常中的额外内容

协同欺骗SOAP测试:在文档末尾的实体异常中的额外内容
EN

Stack Overflow用户
提问于 2015-11-09 13:45:54
回答 1查看 360关注 0票数 0

我正在尝试使用calls测试我的SOAP调用,但我遇到了一些问题。当试图通过haveSoapHeader()方法传递auth标头时,我得到:

代码语言:javascript
复制
[PHPUnit_Framework_Exception] DOMDocument::loadXML(): Extra content at the end of the document in Entity, line: 2

api.suite.yml

代码语言:javascript
复制
class_name: ApiTester
modules:
    enabled:
        - \Helper\Api
        - PhpBrowser
        - SOAP
    config:
        PhpBrowser:
            url: 'http://localhost'
        SOAP:
            depends: PhpBrowser
            endpoint: http://localhost:888/soap

testCallCept.php

代码语言:javascript
复制
$I = new ApiTester($scenario);
$I->wantTo('perform actions and see result');
$I->haveSoapHeader(
    'authenticate',
    array(
        'username' => 'test',
        'password' => 'test'
    )
);

$I->sendSoapRequest('testCall');

在调试模式下运行此测试时,我得到以下信息:

代码语言:javascript
复制
C:\xampp\htdocs\xyz>php codecept.phar run api -d
Codeception PHP Testing Framework v2.1.3
Powered by PHPUnit 4.8.10 by Sebastian Bergmann and contributors.

←[1mApi Tests (1) ←[22m----------------------------------------------------------------------------------------------
Modules: ←[32m\Helper\Api, PhpBrowser, SOAP←[39m
------------------------------------------------------------------------------------------------------------
←[35;1mPerform actions and see result←[39;22m (testCallCept)
Scenario:
* I have soap header "authenticate",{"username":"test","password":"test"}
* I send soap request "test"

←[36m  [Request] <soapenv:Envelope xmlns:ns="" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">←[39m←[36m<authenticate>←[39m←[36m<username>←[39m←[36mtest←[39m←[36m</username>←[3
9m←[36m<password>←[39m←[36mtest←[39m←[36m</password>←[39m←[36m</authenticate>←[39m←[36m</soapenv:Header><soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><ns:testCall></ns:testCall></soapenv:Body></soapenv:Envelope>←[39m
←[36m  [Response] <br />
  <font size='1'><table class='xdebug-error xe-warning' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
  ←[39m←[36m<tr>←[39m←[36m<th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )←[39m←[36m</span>←[39m←[36m Warning: si←[39m
←[37;41m ERROR ←[39;49m

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
------------------------------------------------------------------------------------------------------------


Time: 554 ms, Memory: 9.50Mb

There was 1 error:

---------
1) Failed to perform actions and see result in ←[1mtestCallCept←[22m (tests\api\\testCallCept.php)

←[37;41m                                                                                                                     ←[39;49m
←[37;41m  [PHPUnit_Framework_Exception] DOMDocument::loadXML(): Extra content at the end of the document in Entity, line: 2  ←[39;49m
←[37;41m                                                                                                                     ←[39;49m
←[33m
Scenario Steps:
←[39m
←[1m 2. $I->sendSoapRequest("test")←[22m at ←[32mtests\api\testCallCept.php:14←[39m
 1. $I->haveSoapHeader("authenticate",{"username":"test","password":"test"}) at ←[32mtests\api\testCallCept.php:12←[39m

#1  Codeception\Subscriber\ErrorHandler->errorHandler
#2  Codeception\Module\SOAP->sendSoapRequest
#3  C:\xampp\htdocs\xyz\tests\_support\_generated\ApiTesterActions.php:2067
#4  C:\xampp\htdocs\xyz\tests\api\testCallCept.php:14
#5  C:\xampp\htdocs\xyz\codecept.phar:7

←[37;41mFAILURES!←[0m
←[37;41mTests: 1←[0m←[37;41m, Assertions: 0←[0m←[37;41m, Errors: 1←[0m←[37;41m.←[0m

我搜索了它可能存在的问题,并无意中发现了一个帖子,它是在xml结构无效时发生的,但只要我能看到,结构就应该是这样的,所以我真的不知道下一步该在哪里查找。

有人知道会有什么问题吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-11-09 14:25:53

我在SOAP服务器配置中出现了一个错误,因此得到了SOAP响应中的错误,而我一开始并没有注意到这个错误。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33610549

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档