Hi,
I have this issue trying to integrate a web application with Dynamics GP. I have followed the documentation for doing that but it returns an error. Going through the MicrosoftDynamicsWebServiceException Console reveals "Security object does not exist. Key = 0" as the error, which means that there was communication with GP service but there is no company with key 0. I have gone through a lot of blogs including this community but the recommendations are not giving any solution, also I found no response that resolved the issue. I also came accross this popular response: https://mbs.microsoft.com/knowledgebase/KBDisplay.aspx?WTNTZSMNWUKNTMMYVLXUZLWUKKQPOVRVTLKUSRMOQVVYUKKXRVYRTTWLZTPWKURU to no avail.
NB: I am not using ADAM for storage and the SQL check for company id returns the right ID (-1). I'm running in a domain environment within a development machine.
The XML request is as follows:
<?xml version="1.0"?>
<RequestObjects>
<Context xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/dynamics/2006/01">
<OrganizationKey xsi:type="CompanyKey">
<Id>0</Id>
</OrganizationKey>
<CurrencyType>Transactional</CurrencyType>
<TenantName />
</Context>
<GLAccountCriteria xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<IsActive>
<EqualValue xsi:nil="true" />
<NotEqualValue xsi:nil="true" />
</IsActive>
</GLAccountCriteria>
</RequestObjects>
while my code is:
Dim companyKey As CompanyKey
Dim context As Context
Dim GLAccountSummaryList() As GLAccountSummary
Dim GLAccountCriteria As GLAccountCriteria
Dim accountActiveRestriction As RestrictionOfNullableOfboolean
' Create an instance of the service
Dim wsDynamicsGP As New DynamicsGPClient()
' Create a context with which to call the service
context = New Context()
' Specify which company to use (sample company)
companyKey = New CompanyKey()
companyKey.Id = (-1)
' Set up the context
context.OrganizationKey = CType(companyKey, OrganizationKey)
'context.OrganizationKey = Nothing
' Set the criteria specifying wich accounts to retrieve
GLAccountCriteria = New GLAccountCriteria()
accountActiveRestriction = New RestrictionOfNullableOfboolean()
accountActiveRestriction.EqualValue = True
GLAccountCriteria.IsActive = accountActiveRestriction
' Retrieve the list of active accounts
GLAccountSummaryList = wsDynamicsGP.GetGLAccountList(GLAccountCriteria, context)
' Display the total number of active accounts
Dim message = New message
message.ShowAlert(Me, "Total active accounts:" & GLAccountSummaryList.Length.ToString())
' Close the service
If wsDynamicsGP.State <> CommunicationState.Faulted Then
wsDynamicsGP.Close()
End If
WebConfig:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="GPWebService" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" proxyAddress="http://localhost:2000"
textEncoding="utf-8" useDefaultWebProxy="false" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://SERVERNAME:48620/Dynamics/GPService/GPService"
binding="wsHttpBinding" bindingConfiguration="GPWebService"
contract="DynamicsGPService.DynamicsGP" name="GPWebService">
<identity>
<userPrincipalName value="Domain\UserID" />
</identity>
</endpoint>
</client>
</system.serviceModel>
I've been on this for a week now
Please help......
Thanks
*This post is locked for comments