Problems with SoapClient PHP7

I recently upgraded from PHP5.4 to PHP7. The boy was that change, but that is irrelevant.

I am having problems with SoapService since the update.

This is what my SoapRequest looked like in PHP5.4:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:usaepay" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
<env:Body>
    <ns1:searchTransactions env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
    <Token xsi:type="ns1:ueSecurityToken">
        <ClientIP xsi:type="xsd:string">*redacted*</ClientIP>
        <PinHash xsi:type="ns1:ueHash">
            <HashValue xsi:type="xsd:string">*redacted*</HashValue>
            <Seed xsi:type="xsd:string">*redacted*</Seed>
            <Type xsi:type="xsd:string">sha1</Type>
        </PinHash>
        <SourceKey xsi:type="xsd:string">*redacted*</SourceKey>
    </Token>
    <Search enc:itemType="ns1:SearchParam" enc:arraySize="3" xsi:type="ns1:SearchParamArray">
        <item xsi:type="ns1:SearchParam">
            <Field xsi:type="xsd:string">created</Field>
            <Type xsi:type="xsd:string">gt</Type>
            <Value xsi:type="xsd:string">2016-07-26</Value>
        </item>
        <item xsi:type="ns1:SearchParam">
            <Field xsi:type="xsd:string">created</Field>
            <Type xsi:type="xsd:string">lt</Type>
            <Value xsi:type="xsd:string">2016-07-27</Value>
        </item>
        <item xsi:type="ns1:SearchParam">
            <Field xsi:type="xsd:string">response</Field>
            <Type xsi:type="xsd:string">eq</Type>
            <Value xsi:type="xsd:string">A</Value>
        </item>
    </Search>
    <MatchAll xsi:type="xsd:boolean">true</MatchAll>
    <Start xsi:type="xsd:integer">0</Start>
    <Limit xsi:type="xsd:integer">9999</Limit>
    <Sort xsi:type="xsd:string">TransID</Sort>
</ns1:searchTransactions>
</env:Body>
</env:Envelope>

Here's what the request to execute the same code in PHP7 looks like:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:usaepay" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
<env:Body>
    <ns1:searchTransactions env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
    <Token xsi:type="ns1:ueSecurityToken">
        <ClientIP xsi:type="xsd:string">*redacted*</ClientIP>
        <PinHash xsi:type="ns1:ueHash">
            <HashValue xsi:type="xsd:string">*redacted*</HashValue>
            <Seed xsi:type="xsd:string">*redacted*</Seed>
            <Type xsi:type="xsd:string">sha1</Type>
        </PinHash>
        <SourceKey xsi:type="xsd:string">*redacted*</SourceKey>
    </Token>
    <Search enc:itemType="ns2:Map" enc:arraySize="3" xsi:type="ns1:SearchParamArray">
        <item xsi:type="ns2:Map">
            <item>
                <key xsi:type="xsd:string">Field</key>
                <value xsi:type="xsd:string">created</value>
            </item>
            <item>
                <key xsi:type="xsd:string">Type</key>
                <value xsi:type="xsd:string">gt</value>
            </item>
            <item>
                <key xsi:type="xsd:string">Value</key>
                <value xsi:type="xsd:string">2016-07-26</value>
            </item>
        </item>
        <item xsi:type="ns2:Map">
            <item>
                <key xsi:type="xsd:string">Field</key>
                <value xsi:type="xsd:string">created</value>
            </item>
            <item>
                <key xsi:type="xsd:string">Type</key>
                <value xsi:type="xsd:string">lt</value>
            </item>
            <item>
                <key xsi:type="xsd:string">Value</key>
                <value xsi:type="xsd:string">2016-07-26</value>
            </item>
        </item>
        <item xsi:type="ns2:Map">
            <item>
                <key xsi:type="xsd:string">Field</key>
                <value xsi:type="xsd:string">response</value>
            </item>
            <item>
                <key xsi:type="xsd:string">Type</key>
                <value xsi:type="xsd:string">eq</value>
            </item>
            <item>
                <key xsi:type="xsd:string">Value</key>
                <value xsi:type="xsd:string">A</value>
            </item>
        </item>
    </Search>
    <MatchAll xsi:type="xsd:boolean">true</MatchAll>
    <Start xsi:type="xsd:integer">0</Start>
    <Limit xsi:type="xsd:integer">9999</Limit>
    <Sort xsi:type="xsd:string">created</Sort>
</ns1:searchTransactions>
</env:Body>
</env:Envelope>

Here is the relevant PHP code: (Note $ sec) is the security information that has been edited.

$param = array(
            array('Field' => 'created', 'Type' => 'gt', 'Value' => date('Y-m-d', strtotime('2016-07-26'))), 
            array('Field' => 'created', 'Type' => 'lt', 'Value' => date('Y-m-d', strtotime('2016-07-26'))),
            array('Field' => 'response', 'Type' => 'eq', 'Value' => 'A')
            );

$matchAll = true;
$start = 0;
$limit = 9999;
$sort = 'TransID';

$this->advClient = new SoapClient($this->adv_wsdl, array('trace' => 1, 'exceptions' => 1, 'cache_wsdl' => WSDL_CACHE_BOTH, 'soap_version' => SOAP_1_2));
$result = $this->advClient->searchTransactions($sec, $searchParam, $matchAll, $start, $limit, $sort);

As a result, I am wrong. I think the problem is that in PHP7 it wraps and adds additional "item" tags. However, some of the features still do not work. Has anyone else come across this?

+4
source share
1 answer

, wsdltophp.com WSDL, .

+2

Source: https://habr.com/ru/post/1649410/


All Articles