Skip to content

AbusedClient::__doRequest Argument #5 ($oneWay) type error #109

@brianfy1

Description

@brianfy1

I did install your package (v2.0.0-beta.3) and wanted to give it a quick run.
But I immediately running into this error.

Error Message:

Phpro\SoapClient\Soap\HttpBinding\SoapRequest::__construct(): Argument #5 ($oneWay) must be of type int, bool given, called in /home/vagrant/code/vendor/codedredd/laravel-soap/src/Driver/ExtSoap/AbusedClient.php on line 23

Routes:

// routes/web.php

use Illuminate\Support\Facades\Route;

Route::get('/', function () {
    $response = CodeDredd\Soap\Facades\Soap::baseWsdl('http://www.dneonline.com/calculator.asmx?wsdl')
        ->call('Add', [
            'intA', 4,
            'intB', 5
        ]);

    return $response;
});

Packages:

// composer.json
{
    "name": "laravel/laravel",
    "require": {
        "php": "^7.3|^8.0",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "laravel/framework": "^8.12",
        "laravel/tinker": "^2.5",
        "codedredd/laravel-soap": "^2",
        "ext-soap": "*"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.5",
        "facade/ignition": "^2.5",
        "fakerphp/faker": "^1.9.1",
        "laravel/homestead": "^12.1",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.2",
        "nunomaduro/collision": "^5.0",
        "phpunit/phpunit": "^9.3.3"
    }
}

Caused by this file

// CodeDredd/Soap/Driver/ExtSoap/AbusedClient.php

declare(strict_types=1);

namespace CodeDredd\Soap\Driver\ExtSoap;

use Phpro\SoapClient\Soap\Driver\ExtSoap\AbusedClient as PhproAbusedClient;
use Phpro\SoapClient\Soap\Driver\ExtSoap\ExtSoapOptions;
use Phpro\SoapClient\Soap\HttpBinding\SoapRequest;
use Phpro\SoapClient\Xml\SoapXml;

class AbusedClient extends PhproAbusedClient
{
    public static function createFromOptions(ExtSoapOptions $options): PhproAbusedClient
    {
        return new self($options->getWsdl(), $options->getOptions());
    }

    public function __doRequest($request, $location, $action, $version, $oneWay = 0)
    {
        $xml = SoapXml::fromString($request);
        $action = $action ?? $xml->getBody()->firstChild->localName;
        $this->storedRequest = new SoapRequest($request, $location, $action, $version, $oneWay);  // <-- line 23

        return $this->storedResponse ? $this->storedResponse->getResponse() : '';
    }
}

I'm still new to SOAP.
Does it require to feed Soap::baseWsdl()->call() with more options to make it pass?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions