Advertisement
Guest User

Untitled

a guest
Jan 12th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.13 KB | None | 0 0
  1. The application encountered an unhandled system exception. Contact your system administrator for details.
  2.  
  3. <?xml version="1.0" encoding="utf-8" ?>
  4. <configuration>
  5. <system.serviceModel>
  6. <bindings>
  7. <wsHttpBinding>
  8. <binding name="GPWebService" closeTimeout="00:01:00"
  9. openTimeout="00:01:00" receiveTimeout="00:10:00"
  10. sendTimeout="00:01:00" bypassProxyOnLocal="false"
  11. transactionFlow="false" hostNameComparisonMode="StrongWildcard"
  12. maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
  13. messageEncoding="Text" textEncoding="utf-8"
  14. useDefaultWebProxy="true" allowCookies="false">
  15. <readerQuotas maxDepth="32" maxStringContentLength="8192"
  16. maxArrayLength="16384" maxBytesPerRead="4096"
  17. maxNameTableCharCount="2147483647" />
  18. <reliableSession ordered="true" inactivityTimeout="00:10:00"
  19. enabled="false" />
  20. <security mode="Message">
  21. <transport clientCredentialType="Windows"
  22. proxyCredentialType="None" realm="" />
  23. <message clientCredentialType="Windows"
  24. negotiateServiceCredential="true" algorithmSuite="Default"
  25. establishSecurityContext="true" />
  26. </security>
  27. </binding>
  28. </wsHttpBinding>
  29. </bindings>
  30. <client>
  31. <endpoint address="http://WSGP:48620/Dynamics/GPService/GPService"
  32. binding="wsHttpBinding" bindingConfiguration="GPWebService"
  33. contract="GPWebService.DynamicsGP" name="GPWebService">
  34. <identity>
  35. <userPrincipalName value="WSGPAdministrator" />
  36. </identity>
  37. </endpoint>
  38. </client>
  39. </system.serviceModel>
  40. </configuration>
  41.  
  42. CompanyKey companyKey;
  43. Context context;
  44. SalesOrder salesOrder;
  45. SalesDocumentTypeKey salesOrderType;
  46. CustomerKey customerKey;
  47. BatchKey batchKey;
  48. SalesOrderLine salesOrderLine;
  49. ItemKey orderedItem;
  50. Quantity orderedAmount;
  51. Policy salesOrderCreatePolicy;
  52. // Create an instance of the service
  53. DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();
  54. // Create a context with which to call the service
  55. wsDynamicsGP.ClientCredentials.Windows.ClientCredential.UserName = "Administrator";
  56. wsDynamicsGP.ClientCredentials.Windows.ClientCredential.Password = "Server123";
  57. wsDynamicsGP.ClientCredentials.Windows.ClientCredential.Domain = "WSGP";
  58. System.ServiceModel.WSHttpBinding binding;
  59. binding = new System.ServiceModel.WSHttpBinding(System.ServiceModel.SecurityMode.None);
  60. //wsDynamicsGP.ClientCredentials.Windows.ClientCredential.Domain = "wsgp";
  61. context = new Context();
  62. // Specify which company to use (sample company)
  63. companyKey = new CompanyKey();
  64. companyKey.Id = (-1);
  65. // Set up the context object
  66. context.OrganizationKey = (OrganizationKey)companyKey;
  67. // Create a sales order object
  68. salesOrder = new SalesOrder();
  69. // Create a sales document type key for the sales order
  70. salesOrderType = new SalesDocumentTypeKey();
  71. salesOrderType.Type = SalesDocumentType.Order;
  72. // Populate the document type key of the sales order object
  73. salesOrder.DocumentTypeKey = salesOrderType;
  74. // Create a customer key
  75. customerKey = new CustomerKey();
  76. customerKey.Id = "121001";
  77. // Set the customer key property of the sales order object
  78. salesOrder.CustomerKey = customerKey;
  79. // Create a batch key
  80. batchKey = new BatchKey();
  81. batchKey.Id = "RMS";
  82. // Set the batch key property of the sales order object
  83. salesOrder.BatchKey = batchKey;
  84. // Create a sales order line to specify the ordered item
  85. salesOrderLine = new SalesOrderLine();
  86. // Create an item key
  87. orderedItem = new ItemKey();
  88. orderedItem.Id = "8011172009618";
  89. // Set the item key property of the sales order line object
  90. salesOrderLine.ItemKey = orderedItem;
  91. // Create a sales order quantity object
  92. orderedAmount = new Quantity();
  93. orderedAmount.Value = 4;
  94. // Set the quantity of the sales order line object
  95. salesOrderLine.Quantity = orderedAmount;
  96. // Create an array of sales order lines
  97. // Initialize the array with sales order line object
  98. SalesOrderLine[] orders = { salesOrderLine };
  99. // Add the sales order line array to the sales order
  100. salesOrder.Lines = orders;
  101. // Get the create policy for the sales order object
  102. salesOrderCreatePolicy = wsDynamicsGP.GetPolicyByOperation("CreateSalesOrder", context);
  103. // Create the sales order
  104. wsDynamicsGP.CreateSalesOrder(salesOrder, context, salesOrderCreatePolicy);
  105. // Close the service
  106. if (wsDynamicsGP.State != CommunicationState.Faulted)
  107. {
  108. wsDynamicsGP.Close();
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement