details here
Release: 2.0.2 Community Version.
writing a service by adding the magento soap url as a service reference,
when calling the salesInvoiceRepositoryV1GetList i get an error with the framework tries to deserialise the data
Error in deserializing body of reply message for operation 'salesInvoiceRepositoryV1GetList'.
fiddler returns the data correctly, but unable to deserialize
found the culprits
the 3 properties being returned are null,
baseShippingDiscountTaxCompensationAmnt
baseDiscountTaxCompensationAmount
discountTaxCompensationAmount
the datatype is a float not nullable float data type, so either don't return the property in the soap xml if there is no value,
please fix this in the next version release
Created internal bug ( MAGETWO-50026 ) to track. Flagged architect to ensure we behave consistently with other services for this scenario.
add a few more to the list, these return and fails deserailsation
baseDiscountTaxCompensationInvoiced
baseDiscountTaxCompensationRefunded
discountTaxCompensationInvoiced
discountTaxCompensationRefunded
discountTaxCompensationCanceled
do we have some sort of idea when this will be fixed and which release will have the fix?
I am also having similar problem "Error in deserializing body of reply message for operation 'catalogProductRepositoryV1Get' " magento version 2.0.4. How do i fix this? could someone please help with this.
any ideas if this will be patch up in the next release?
could we get some updates regarding this bug? this should of been resolved for all people who wanting to use soap integration with other applications/services, but we can't cause of the serialization...
Now I gone back to 1.9 and the main reason being not able to use the soap.
just testet this example for baseShippingDiscountTaxCompensationAmnt.
To ensure that the correct type is returned it is mandatory to type cast the value when it is retrieved from the data model. I think this has to be added in many places but is quite easy to fix.
type casting this to float results in 0 beeing returned instead of null which shoul solve the problem
ok, the problem simply seems to be, that null is never type casted here: https://github.com/magento/magento2/blob/develop/lib/internal/Magento/Framework/Reflection/TypeCaster.php#L25
This is a Problem in languages with strict types since the scalar types are not allowed to be null, instead they have to be casted to "", 0 or 0.0 for example
Hello @lindows-xx, this issue has been fixed in the 2.1.0 Release, that's why I'm closing it. If you have any questions or additional information regarding the issue feel free to reopen it or create a new one.
Sorry for the confusion, we double checked, and unfortunately this issue didn't go to the 2.1.0 release, it will come to the next possible release.
any ideas of when the next release will be?
bump for updates?
The fix has been provided as a part of 2.0.9 release.
what about 2.1 ;) respectively when will 2.1.1 be released?
When is 2.1.1 release date?
Same error getting for shopping cart services also .Please fix.
Also for quoteCartRepositoryV1Save.
For save Additional information: The method 'quoteCartRepositoryV1Save' in type 'Magento2API.QuoteCartRepositoryServiceReference.quoteCartRepositoryV1PortType' is marked IsOneWay=true and declares one or more FaultContractAttributes. One-way methods cannot declare FaultContractAttributes. To fix it, change IsOneWay to false or remove the FaultContractAttributes.
The issue has been fixed in 2.1.1
Thanks Elen.
Can you let me know where to get 2.1.1 version.
If not when is the release date.
Dears,
We have upgraded to 2.1.1 version.Issue still exists.
@resmivarghese seems to be right. I did not test it yet but looking at the class, null values are still not type casted https://github.com/magento/magento2/blob/2.1/lib/internal/Magento/Framework/Reflection/TypeCaster.php
@resmivarghese could you please describe your steps of reproducing the issue?
I used SoapUI for my testing, disabled authorization checks and requested list of invoices(i had only one at that time) without any filtering. I've got a valid response.

To disable authorization check I commented lines
if (!$this->authorization->isAllowed($methodData[ServiceMetadata::KEY_ACL_RESOURCES])) {
unset($serviceMetadata[ServiceMetadata::KEY_SERVICE_METHODS][$methodName]);
} on code/Magento/Webapi/Model/AbstractSchemaGenerator.php and the whole operator if (!$this->authorization->isAllowed(.... on code/Magento/Webapi/Controller/Soap/Request/Handler.php.
the problem is, that you get null values for float types, which is not allowed by definition and results in errors when a client is created from the wsdl for example in Visual Studio.
Instead, the null value has to be type casted to float which results in 0.0 instead of null
rechecked on latest develop and 2.1.1 branches. Both returned correct response.
@davidverholen could you please describe how you managed to get null values for float types?
basically, the response is looking good. I just wonder, where this problem is fixed if not in this class:
Now the null values in the response seem to be fixed but strictly not typecasting null values in the typecaster class still seems wrong to be honest. So, why this exception?
@davidverholen the fix is here https://github.com/magento/magento2/commit/3467488060ceebaee770b69a10f1499d31ce86c4
@SerhiyShkolyarenko i firstly encountered the error in 2.0.2 when i add a product only filling in what was required (bare minimum)
details are in this post here link
there maybe other fields that could possibly return null which are float datatype that i didnt come across so best to check each of the fields if possible
in the example above, one of multiple examples would be the baseShippingDiscountTaxCompensationAmnt. This is a float field but a null value is provided. This should be 0.
@manhao-chen I checked all the fields that are marked as float not nullable on the Magento/Sales/Api/Data/InvoiceInterface.php, but all of them are filled with numbers in your example. Could you check again on Magento 2.1.1 or latest develop branch, if SoapUI is able to unserialize the server response?
@davidverholen now that field is declared as
/**
* Gets the base shipping discount tax compensation amount for the invoice.
*
* @return float|null Base shipping discount tax compensation amount.
*/
public function getBaseShippingDiscountTaxCompensationAmnt();
so, it's implied to be null or float.
@SerhiyShkolyarenko the fix you had just implemented, is it out in 2.1.1 or it will be in the next release?
@manhao-chen I figured out that the fix is not included in 2.1.1 release. As far as it's present on develop branch, it will be a part of the following release.
I am closing the issue on github now as far as the fix is delivered to develop branch, but feel free to leave comments if it won't work for you after update. Thank you for collaboration!
@SerhiyShkolyarenko i will test the next release and report back
@SerhiyShkolyarenko the problem is, that in strict typed languages, null is not allowed for float. It's not possible to define a value as float or null when you create a WSDL.
Even in php with strict mode enabled a float value must not be null. Here is an example (for php7) with strict mode enabled
<?php
declare(strict_types=1);
function returnFloat() : float
{
return null;
}
var_dump(returnFloat());
This throws an error since the function is not allowed to return null when strict typed to float.
So when you create a SOAP Client in strict typed languages and a field typed as float is null, this throws an error.
@davidverholen AFAIK C# supports nullable double. https://msdn.microsoft.com/en-us/library/2cf62fcy.aspx
Will it help?
@SerhiyShkolyarenko the problem is when the wsdl is generated, would the property datatype be in c#
double
or
nullable
the point is, wsdl definition does not support null for float types and yet there are null values in fields that are of type float
Only supported non numeric values are INF, -INF, and NaN
http://books.xmlschemata.org/relaxng/ch19-77095.html
https://www.w3.org/2001/XMLSchema.xsd
Reopened issue to clarify compatibility.
Hi, I'm getting the same issue when using Mage 2.1.1 catalogProductRepositoryV1Get to pull a product down to Visual Studio via WSDL SOAP. The pull worked fine then stopped working all of a sudden. Tracked it down to the Quantity against the product being "empty". Set the Qty to 0 and it started working. #davidverholen is correct in that the system is returning non-standard acceptable data.
The nullable float in C# is technically a different type to float, it's effectively a wrapper around float.
Edit: Also causing issues in catalogProductRepositoryV1Save. As the returned object doesn't have its quantity set it causes the method to throw a deserilization error.
Internal issue for investigation(and fixing) is MAGETWO-59017.
is there any idea as to when this will be fixed?
In addition to the fields mentioned above, we've experienced issues with <isCustomerNotified> field in salesOrderRepositoryV1's getList method (2.1.2. Magento)
In <statusHistories> node for orders being paid with Authorize.net, response contained empty field, when it should have been int.
<isCustomerNotified /> returned instead of <isCustomerNotified>0<isCustomerNotified> .
Casting to int fixed the issue (just like the float casting above).
I solved issue exposed by @epson121 editing the file History.php in /vendor/magento/module-sales/Model/Order/Status
I have modified the following function:
public function setIsCustomerNotified($flag = null)
{
if ($flag === null) {
$flag = 0;
}
return $this->setData('is_customer_notified', $flag);
}
public function getIsCustomerNotified()
{
$ret = $this->getData(OrderStatusHistoryInterface::IS_CUSTOMER_NOTIFIED);
if($ret) === null)
return 0;
else return $ret;
}
I'm closing this report as the issue has been fixed.
If you can still reproduce this issue, please create a new GitHub issue report.
Hi, I'm getting the same issue when using Mage 2.3.4 for SalesOrderRepositoryV1GetList
the fix you had just implemented, is it out in 2.3.4 or it will be in the next release?
I checked and salesInvoiceRepositoryV1GetList works fine but the same issue with SalesOrderRepositoryV1GetList on 2.3.4
Most helpful comment
do we have some sort of idea when this will be fixed and which release will have the fix?