Error in deserializing body when consuming getSalesOrder Business Service in .NET

walterhuang

Member
I follow @ONYX's steps to consume BSSV in .NET Visual Studio:
https://www.jdelist.com/vb4/showthread.php/42405-Consume-Business-Service-in-NET/page2

I can getAddressBook and lookupWorkOrders with success. But when I try getSalesOrder it throws an exception:
Error in deserializing body of reply message for operation 'getSalesOrder'.
There is an error in XML document (1, 5084).
Input string was not in a correct format.

getSalesOrder works in SoapUI but I notice that rateExchangeOverride = 0E-7 may ruin the deserialization. After modifying rateExchangeOver from type decimal to double. getSalesOrder works.

But I still prefer keep my rateExchangeOverride decimal and don't want to modify manually everytime when service get updated.

Any suggestions will be appreciated. Below is my code for reference

Code:
SalesOrderManagerClient client = new SalesOrderManagerClient();
InitializeCrendential(client);
var data = client.getSalesOrder(new getSalesOrder
{
    header = new getSalesHeader
    {
        salesOrderKey = new salesOrderKey
        {
            documentNumber = documentNumber,
            documentNumberSpecified = true
        }
    }
});

Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
  </startup>
  <system.serviceModel>
    <bindings>
      <customBinding>
        <binding name="SalesOrderManagerPortBinding">
          <security authenticationMode="UserNameOverTransport" />
          <textMessageEncoding messageVersion="Soap11" />
          <httpsTransport />
        </binding>
      </customBinding>
    </bindings>
    <client>
      <endpoint address="[URL]https://localhost:7012/DV920/SalesOrderManager[/URL]"
        binding="customBinding" bindingConfiguration="SalesOrderManagerPortBinding"
        contract="ServiceReference2.SalesOrderManager" name="SalesOrderManagerPort" />
    </client>
  </system.serviceModel>
</configuration>
 
Top