Support for simple XSD types?
| 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
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);
}
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
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|...
Indeed, that is a correct vision. It looks like there is room for improvement for generating the clients with scalar IO.
Closing this one - will be dealt with in #464