soap-client icon indicating copy to clipboard operation
soap-client copied to clipboard

Support for simple XSD types?

Open infabo opened this issue 4 years ago • 4 comments

Q A
Version 1.6.0

Support Question

Does the generator support xsd simple types?

I get a lot of typehints like Type\Integer or Type\Boolean -> but no class generated for it.

Also, some soap functions have native xsd-types as params like xsd:string - but $this->call() requires the second parameter to be of RequestInterface - so you can't pass native php-datatypes.

WSDL can be found here: https://test.wamtek.eu/test03/services/UMXF0014Port?wsdl

infabo avatar Jun 17 '21 18:06 infabo

Generated code looks like:

<?php

namespace ACME\Soap;

use ACME\Soap\Type;
use \;
use Phpro\SoapClient\Type\RequestInterface;
use Phpro\SoapClient\Type\ResultInterface;
use Phpro\SoapClient\Exception\SoapException;

class SoapClient extends \Phpro\SoapClient\Client
{

    /**
     * @param RequestInterface|\string $in0
     * @return ResultInterface|Type\Integer
     * @throws SoapException
     */
    public function deleteUser(string $in0) : \ACME\Soap\Type\Integer
    {
        return $this->call('deleteUser', $in0);
    }

infabo avatar Jun 17 '21 18:06 infabo

Thanks for reporting!

The Type\ prefix is a bug. The generated payload currently doesn't take into account the internal xsd types.

For using scalar arguments inside a request, you have to wrap it in a Phpro\SoapClient\Type\MultiArgumentRequestInterface. That way it passes along the scalar types that you provide as a valid soap RequestInterface internally.

Additional info:

  • https://github.com/phpro/soap-client/blob/a91e2feb00391dcc67dc4cd46cca1a652c46c89e/src/Phpro/SoapClient/CodeGenerator/Model/ClientMethod.php#L88-L91
  • Should be more in line with : https://github.com/phpro/soap-client/blob/a91e2feb00391dcc67dc4cd46cca1a652c46c89e/src/Phpro/SoapClient/CodeGenerator/Model/Property.php#L64-L71

veewee avatar Jun 18 '21 05:06 veewee

Thanks for reporting!

The Type\ prefix is a bug. The generated payload currently doesn't take into account the internal xsd types.

As far as I had a look, the result is either a Type-object or MixedResult otherwise.

No chance that it ever can return a simple type like string|int|bool|...

infabo avatar Jun 18 '21 08:06 infabo

Indeed, that is a correct vision. It looks like there is room for improvement for generating the clients with scalar IO.

veewee avatar Jun 18 '21 08:06 veewee

Closing this one - will be dealt with in #464

veewee avatar Apr 03 '23 14:04 veewee