Hello, i am totally new this might be a really simple question. What i need is to send to Dynamic GP a list of object (a complex order), no idea how but i want to start with something simple. I want to create a Vendor. For this i got this code (from MSDN - so should be fine):
CompanyKey companyKey;
Context context;
Vendor vendor;
VendorKey vendorKey;
Policy vendorPolicy;
DynamicsGP wsDynamicsGP = new DynamicsGP();
Console.WriteLine("DynamicsGP created");
wsDynamicsGP.UseDefaultCredentials = true;
NetworkCredential credentials = new NetworkCredential("asd", "asd", "asd");
wsDynamicsGP.Credentials = credentials;
context = new Context();
companyKey = new CompanyKey();
companyKey.Id = (-1);
context.OrganizationKey = companyKey;
vendorKey = new VendorKey();
vendorKey.Id = "TstVndr0001";
vendor = new Vendor();
vendor.Key = vendorKey;
vendor.Name = "TestVendor0001";
vendorPolicy = wsDynamicsGP.GetPolicyByOperation("CreateVendor", context);
wsDynamicsGP.CreateVendor(vendor, context, vendorPolicy);
And my config file looks like:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="GPWebService" closeTimeout="00:10:00" openTimeout="00:10:00"
receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<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://SQL01:48620/Dynamics/GPService/GPService"
binding="wsHttpBinding" bindingConfiguration="GPWebService"
contract="DynamicsGP" name="GPWebService">
<identity>
<userPrincipalName value="GPwebservices@comp.local" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
But every time an exception is raised:
"System.Net.WebException: The operation has timed out at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)"
when GetPolicyByOperation is called. I used windows service instead of the class generated by the service. This might be a problem?
Also when wsDynamicsGP is created is taking long time but al least is pass.
I am calling the service stored on another computer so the domain for sure is different, is this relevant somehow?
Can somebody help me?
Thanks!