cancel
Showing results for 
Search instead for 
Did you mean: 

C# - magento 2.0.2 - error deserialsing SOAP call salesInvoiceRepositoryV1GetList

C# - magento 2.0.2 - error deserialsing SOAP call salesInvoiceRepositoryV1GetList

using magento 2.0.2

 

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'.

 

this is my post

 

<?xml version="1.0"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <salesInvoiceRepositoryV1GetListRequest xmlns="http://localhost:8085/magento2_data/soap/default?services=salesInvoiceRepositoryV1">
      <searchCriteria xmlns="">
        <filterGroups>
          <item>
            <filters>
              <item>
                <field>entity_id</field>
                <value>0</value>
                <conditionType>gt</conditionType>
              </item>
            </filters>
          </item>
          <item>
            <filters>
              <item>
                <field>store_id</field>
                <value>1</value>
                <conditionType>eq</conditionType>
              </item>
            </filters>
          </item>
        </filterGroups>
      </searchCriteria>
    </salesInvoiceRepositoryV1GetListRequest>
  </s:Body>
</s:Envelope>

 

i can see data coming in fiddler and its correct

 

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://localhost:8085/magento2_data/soap/default?services=salesInvoiceRepositoryV1">
  <env:Body>
    <ns1:salesInvoiceRepositoryV1GetListResponse>
      <result>
        <items>
          <item>
            <baseCurrencyCode>NZD</baseCurrencyCode>
            <baseDiscountAmount>0</baseDiscountAmount>
            <baseGrandTotal>34</baseGrandTotal>
            <baseDiscountTaxCompensationAmount>0</baseDiscountTaxCompensationAmount>
            <baseShippingAmount>5</baseShippingAmount>
            <baseShippingDiscountTaxCompensationAmnt/>
            <baseShippingInclTax>5</baseShippingInclTax>
            <baseShippingTaxAmount>0</baseShippingTaxAmount>
            <baseSubtotal>29</baseSubtotal>
            <baseSubtotalInclTax>0</baseSubtotalInclTax>
            <baseTaxAmount>0</baseTaxAmount>
            <baseToGlobalRate>1</baseToGlobalRate>
            <baseToOrderRate>1</baseToOrderRate>
            <billingAddressId>2</billingAddressId>
            <canVoidFlag>0</canVoidFlag>
            <createdAt>2016-02-11 23:00:02</createdAt>
            <discountAmount>0</discountAmount>
            <entityId>1</entityId>
            <globalCurrencyCode>NZD</globalCurrencyCode>
            <grandTotal>34</grandTotal>
            <discountTaxCompensationAmount>0</discountTaxCompensationAmount>
            <incrementId>000000001</incrementId>
            <orderCurrencyCode>NZD</orderCurrencyCode>
            <orderId>1</orderId>
            <shippingAddressId>1</shippingAddressId>
            <shippingAmount>5</shippingAmount>
            <shippingDiscountTaxCompensationAmount>0</shippingDiscountTaxCompensationAmount>
            <shippingInclTax>5</shippingInclTax>
            <shippingTaxAmount>0</shippingTaxAmount>
            <state>2</state>
            <storeCurrencyCode>NZD</storeCurrencyCode>
            <storeId>1</storeId>
            <subtotal>29</subtotal>
            <subtotalInclTax>0</subtotalInclTax>
            <taxAmount>0</taxAmount>
            <totalQty>1</totalQty>
            <updatedAt>2016-02-11 23:00:02</updatedAt>
            <items>
              <item>
                <baseDiscountTaxCompensationAmount/>
                <basePrice>0</basePrice>
                <baseRowTotal>0</baseRowTotal>
                <entityId>1</entityId>
                <discountTaxCompensationAmount/>
                <name>Iris Workout Top-XS-Red</name>
                <orderItemId>1</orderItemId>
                <parentId>1</parentId>
                <price>0</price>
                <productId>1420</productId>
                <qty>1</qty>
                <rowTotal>0</rowTotal>
                <sku>WS03-XS-Red</sku>
              </item>
            </items>
            <comments/>
          </item>
          <item>
            <baseCurrencyCode>NZD</baseCurrencyCode>
            <baseDiscountAmount>0</baseDiscountAmount>
            <baseGrandTotal>37</baseGrandTotal>
            <baseDiscountTaxCompensationAmount>0</baseDiscountTaxCompensationAmount>
            <baseShippingAmount>5</baseShippingAmount>
            <baseShippingDiscountTaxCompensationAmnt/>
            <baseShippingInclTax>5</baseShippingInclTax>
            <baseShippingTaxAmount>0</baseShippingTaxAmount>
            <baseSubtotal>32</baseSubtotal>
            <baseSubtotalInclTax>0</baseSubtotalInclTax>
            <baseTaxAmount>0</baseTaxAmount>
            <baseToGlobalRate>1</baseToGlobalRate>
            <baseToOrderRate>1</baseToOrderRate>
            <billingAddressId>4</billingAddressId>
            <canVoidFlag>0</canVoidFlag>
            <createdAt>2016-02-11 23:00:05</createdAt>
            <discountAmount>0</discountAmount>
            <entityId>2</entityId>
            <globalCurrencyCode>NZD</globalCurrencyCode>
            <grandTotal>37</grandTotal>
            <discountTaxCompensationAmount>0</discountTaxCompensationAmount>
            <incrementId>000000002</incrementId>
            <orderCurrencyCode>NZD</orderCurrencyCode>
            <orderId>2</orderId>
            <shippingAddressId>3</shippingAddressId>
            <shippingAmount>5</shippingAmount>
            <shippingDiscountTaxCompensationAmount>0</shippingDiscountTaxCompensationAmount>
            <shippingInclTax>5</shippingInclTax>
            <shippingTaxAmount>0</shippingTaxAmount>
            <state>2</state>
            <storeCurrencyCode>NZD</storeCurrencyCode>
            <storeId>1</storeId>
            <subtotal>32</subtotal>
            <subtotalInclTax>0</subtotalInclTax>
            <taxAmount>0</taxAmount>
            <totalQty>1</totalQty>
            <updatedAt>2016-02-11 23:00:05</updatedAt>
            <items>
              <item>
                <baseDiscountTaxCompensationAmount/>
                <basePrice>0</basePrice>
                <baseRowTotal>0</baseRowTotal>
                <entityId>2</entityId>
                <discountTaxCompensationAmount/>
                <name>Minerva LumaTech&amp;trade; V-Tee-XS-Blue</name>
                <orderItemId>2</orderItemId>
                <parentId>2</parentId>
                <price>0</price>
                <productId>1483</productId>
                <qty>1</qty>
                <rowTotal>0</rowTotal>
                <sku>WS08-XS-Blue</sku>
              </item>
            </items>
            <comments/>
          </item>
          <item>
            <baseCurrencyCode>NZD</baseCurrencyCode>
            <baseDiscountAmount>0</baseDiscountAmount>
            <baseGrandTotal>117</baseGrandTotal>
            <baseDiscountTaxCompensationAmount>0</baseDiscountTaxCompensationAmount>
            <baseShippingAmount>0</baseShippingAmount>
            <baseShippingDiscountTaxCompensationAmnt/>
            <baseShippingInclTax>0</baseShippingInclTax>
            <baseShippingTaxAmount>0</baseShippingTaxAmount>
            <baseSubtotal>117</baseSubtotal>
            <baseSubtotalInclTax>117</baseSubtotalInclTax>
            <baseTaxAmount>0</baseTaxAmount>
            <baseToGlobalRate>1</baseToGlobalRate>
            <baseToOrderRate>1</baseToOrderRate>
            <billingAddressId>5</billingAddressId>
            <canVoidFlag>0</canVoidFlag>
            <createdAt>2016-02-27 07:46:54</createdAt>
            <discountAmount>0</discountAmount>
            <entityId>3</entityId>
            <globalCurrencyCode>NZD</globalCurrencyCode>
            <grandTotal>117</grandTotal>
            <discountTaxCompensationAmount>0</discountTaxCompensationAmount>
            <incrementId>000000003</incrementId>
            <orderCurrencyCode>NZD</orderCurrencyCode>
            <orderId>3</orderId>
            <shippingAmount>0</shippingAmount>
            <shippingDiscountTaxCompensationAmount>0</shippingDiscountTaxCompensationAmount>
            <shippingInclTax>0</shippingInclTax>
            <shippingTaxAmount>0</shippingTaxAmount>
            <state>2</state>
            <storeCurrencyCode>NZD</storeCurrencyCode>
            <storeId>1</storeId>
            <storeToBaseRate>0</storeToBaseRate>
            <storeToOrderRate>0</storeToOrderRate>
            <subtotal>117</subtotal>
            <subtotalInclTax>117</subtotalInclTax>
            <taxAmount>0</taxAmount>
            <totalQty>6</totalQty>
            <updatedAt>2016-02-27 07:46:54</updatedAt>
            <items>
              <item>
                <baseDiscountTaxCompensationAmount>0</baseDiscountTaxCompensationAmount>
                <basePrice>39</basePrice>
                <basePriceInclTax>39</basePriceInclTax>
                <baseRowTotal>39</baseRowTotal>
                <baseRowTotalInclTax>39</baseRowTotalInclTax>
                <baseTaxAmount>0</baseTaxAmount>
                <entityId>3</entityId>
                <discountTaxCompensationAmount>0</discountTaxCompensationAmount>
                <name>Lotus Flower T-shirt</name>
                <orderItemId>3</orderItemId>
                <parentId>3</parentId>
                <price>39</price>
                <priceInclTax>39</priceInclTax>
                <productId>2047</productId>
                <qty>1</qty>
                <rowTotal>39</rowTotal>
                <rowTotalInclTax>39</rowTotalInclTax>
                <sku>012151</sku>
                <taxAmount>0</taxAmount>
              </item>
              <item>
                <baseDiscountTaxCompensationAmount/>
                <basePrice>0</basePrice>
                <entityId>4</entityId>
                <discountTaxCompensationAmount/>
                <name>2MR5aa-M</name>
                <orderItemId>4</orderItemId>
                <parentId>3</parentId>
                <price>0</price>
                <productId>2049</productId>
                <qty>1</qty>
                <sku>012151</sku>
              </item>
              <item>
                <baseDiscountTaxCompensationAmount>0</baseDiscountTaxCompensationAmount>
                <basePrice>39</basePrice>
                <basePriceInclTax>39</basePriceInclTax>
                <baseRowTotal>39</baseRowTotal>
                <baseRowTotalInclTax>39</baseRowTotalInclTax>
                <baseTaxAmount>0</baseTaxAmount>
                <entityId>5</entityId>
                <discountTaxCompensationAmount>0</discountTaxCompensationAmount>
                <name>Namaste T-shirt</name>
                <orderItemId>5</orderItemId>
                <parentId>3</parentId>
                <price>39</price>
                <priceInclTax>39</priceInclTax>
                <productId>2057</productId>
                <qty>1</qty>
                <rowTotal>39</rowTotal>
                <rowTotalInclTax>39</rowTotalInclTax>
                <sku>012015</sku>
                <taxAmount>0</taxAmount>
              </item>
              <item>
                <baseDiscountTaxCompensationAmount/>
                <basePrice>0</basePrice>
                <entityId>6</entityId>
                <discountTaxCompensationAmount/>
                <name>2MR2-Black-M</name>
                <orderItemId>6</orderItemId>
                <parentId>3</parentId>
                <price>0</price>
                <productId>2052</productId>
                <qty>1</qty>
                <sku>012015</sku>
              </item>
              <item>
                <baseDiscountTaxCompensationAmount>0</baseDiscountTaxCompensationAmount>
                <basePrice>39</basePrice>
                <basePriceInclTax>39</basePriceInclTax>
                <baseRowTotal>39</baseRowTotal>
                <baseRowTotalInclTax>39</baseRowTotalInclTax>
                <baseTaxAmount>0</baseTaxAmount>
                <entityId>7</entityId>
                <discountTaxCompensationAmount>0</discountTaxCompensationAmount>
                <name>Namaste T-shirt</name>
                <orderItemId>7</orderItemId>
                <parentId>3</parentId>
                <price>39</price>
                <priceInclTax>39</priceInclTax>
                <productId>2057</productId>
                <qty>1</qty>
                <rowTotal>39</rowTotal>
                <rowTotalInclTax>39</rowTotalInclTax>
                <sku>012055</sku>
                <taxAmount>0</taxAmount>
              </item>
              <item>
                <baseDiscountTaxCompensationAmount/>
                <basePrice>0</basePrice>
                <entityId>8</entityId>
                <discountTaxCompensationAmount/>
                <name>2MR2-White-M</name>
                <orderItemId>8</orderItemId>
                <parentId>3</parentId>
                <price>0</price>
                <productId>2055</productId>
                <qty>1</qty>
                <sku>012055</sku>
              </item>
            </items>
            <comments/>
          </item>
        </items>
        <searchCriteria/>
        <totalCount>3</totalCount>
      </result>
    </ns1:salesInvoiceRepositoryV1GetListResponse>
  </env:Body>
</env:Envelope>

 

but again, it can't deserialise into the object for c# .net

2 REPLIES 2

Re: C# - magento 2.0.2 - error deserialsing SOAP call salesInvoiceRepositoryV1GetList

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, 

 

 

 

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://localhost:8085/magento2_data/soap/default?services=salesInvoiceRepositoryV1">
  <env:Body>
    <ns1:salesInvoiceRepositoryV1GetListResponse>
      <result>
        <items>
          <item>
            <baseShippingDiscountTaxCompensationAmnt/>
            <items>
              <item>
                <baseDiscountTaxCompensationAmount/>
                <discountTaxCompensationAmount/>
              </item>
            </items>
            <comments/>
          </item>
        </items>
        <searchCriteria/>
        <totalCount>1</totalCount>
      </result>
    </ns1:salesInvoiceRepositoryV1GetListResponse>
  </env:Body>
</env:Envelope>

 

 

Re: C# - magento 2.0.2 - error deserialsing SOAP call salesInvoiceRepositoryV1GetList

just an FYI for everyone, this is now logged https://github.com/magento/magento2/issues/3605