Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date xsi:type #539

Closed
LazyTechwork opened this issue Aug 10, 2024 · 4 comments
Closed

Date xsi:type #539

LazyTechwork opened this issue Aug 10, 2024 · 4 comments

Comments

@LazyTechwork
Copy link

Q A
Version 4.0.0

Hello there! I'm facing a new issue with the mixed type, specifically related to the DateTimeInterface. I am using the same method as in #534 but now I need to pass xsi:type="date" with DateTimeInterface, but it's throwing an exception. The exception message is Failed encoding type LazyTechwork\\Parsec\\Types\\SetPersonExtraFieldValues as {http://parsec.ru/Parsec3IntergationService:setpersonextrafieldvalues}. Failed at path "Set Person Extra Field Values.values.ExtraFieldValue.VALUE".

Can you please help me with this?

@veewee
Copy link
Contributor

veewee commented Aug 10, 2024

You might need to change the date format for your specific service.

Can you paste the whole exceptions stack trace?

@LazyTechwork
Copy link
Author

LazyTechwork commented Aug 10, 2024

{
  "message": "Failed encoding type LazyTechwork\\Parsec\\Types\\SetPersonExtraFieldValues as {http://parsec.ru/Parsec3IntergationService:setpersonextrafieldvalues}. Failed at path \"SetPersonExtraFieldValues.values.ExtraFieldValue.VALUE\".",
  "exception": "Phpro\\SoapClient\\Exception\\SoapException",
  "file": "[/home/lazytechwork/dev/etu/pf/physaccess/vendor/phpro/soap-client/src/Phpro/SoapClient/Exception/SoapException.php](http://127.0.0.1:8001/home/lazytechwork/dev/etu/pf/physaccess/vendor/phpro/soap-client/src/Phpro/SoapClient/Exception/SoapException.php)",
  "line": 19,
  "trace": [
    {
      "file": "[/home/lazytechwork/dev/etu/pf/physaccess/vendor/phpro/soap-client/src/Phpro/SoapClient/Caller/EngineCaller.php](http://127.0.0.1:8001/home/lazytechwork/dev/etu/pf/physaccess/vendor/phpro/soap-client/src/Phpro/SoapClient/Caller/EngineCaller.php)",
      "line": 37,
      "function": "fromThrowable",
      "class": "Phpro\\SoapClient\\Exception\\SoapException",
      "type": "::"
    },
    {
      "file": "[/home/lazytechwork/dev/etu/pf/physaccess/vendor/phpro/soap-client/src/Phpro/SoapClient/Caller/EventDispatchingCaller.php](http://127.0.0.1:8001/home/lazytechwork/dev/etu/pf/physaccess/vendor/phpro/soap-client/src/Phpro/SoapClient/Caller/EventDispatchingCaller.php)",
      "line": 30,
      "function": "__invoke",
      "class": "Phpro\\SoapClient\\Caller\\EngineCaller",
      "type": "->"
    }
  ]
}

@veewee
Copy link
Contributor

veewee commented Aug 10, 2024

Hm yeah thats not really the trace I was looking for, rather the list of all previous exceptions.

However, The custom encoder you've added for the anyType is decorating the ScalarTypeEncoder. This encoder cannot deal with DateTimeImmutable, meaning you'll have to make your custom encoder smarter.
You can conditionally use the DateEncoder when the value is an instance of DateTimeInterface.

@veewee
Copy link
Contributor

veewee commented Aug 30, 2024

I consider this one resolved.
https://github.com/php-soap/encoding/releases/tag/0.10.0

@veewee veewee closed this as completed Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants