Skip to content

Issue in XML parser in SOAP function #7

@javigomez

Description

@javigomez

If I do:

        $xml = new \Codeception\Util\XmlBuilder();
        $xml->name->val('test')->parent()
            ->catid->val(4);

        $I->sendSoapRequest('create', $xml);

The soap request works:

[Request] <soapenv:Envelope xmlns:ns="http://localhost/administrator.contact.1.0.0.wsdl" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"></soapenv:Header><soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><ns:create><name>test</name><catid>4</catid></ns:create></soapenv:Body></soapenv:Envelope>

However if I do:

$I->sendSoapRequest('create', '<name>test</name><catid>4</catid>');

It says:


  [PHPUnit_Framework_Exception] DOMDocument::loadXML(): Extra content at the end of the document in Entity, line: 1  


The problem I think is here: https://github.com/Codeception/Codeception/blob/2.1/src/Codeception/Util/Xml.php#L27-L57

The parser seems able to parse a xml string wrapped in an outer tag ():

$I->sendSoapRequest('create', '<user><name>test</name><catid>4</catid><user>');

but not like:

$I->sendSoapRequest('create', '<name>test</name><catid>4</catid>');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions