TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
liviu popovici
NA
1
4.2k
The message could not be processed. This is most likely because the action
Nov 8 2012 3:44 AM
I am trying to access Microsoft Dynamics GP service.
Why is this happening?
This is my code (i got if from MSDN so should be fine):
CompanyKey companyKey;
Context context;
SalesOrder salesOrder;
SalesDocumentTypeKey salesOrderType;
CustomerKey customerKey;
BatchKey batchKey;
SalesOrderLine salesOrderLine;
ItemKey orderedItem;
Quantity orderedAmount;
Policy salesOrderCreatePolicy;
DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();
context = new Context();
companyKey = new CompanyKey();
companyKey.Id = (-1);
context.OrganizationKey = (OrganizationKey)companyKey;
salesOrder = new SalesOrder();
salesOrderType = new SalesDocumentTypeKey();
salesOrderType.Type = SalesDocumentType.Order;
salesOrder.DocumentTypeKey = salesOrderType;
customerKey = new CustomerKey();
customerKey.Id = "AARONFIT0001";
salesOrder.CustomerKey = customerKey;
batchKey = new BatchKey();
batchKey.Id = "SALES ORDERS";
salesOrder.BatchKey = batchKey;
salesOrderLine = new SalesOrderLine();
orderedItem = new ItemKey();
orderedItem.Id = "32X IDE";
salesOrderLine.ItemKey = orderedItem;
orderedAmount = new Quantity();
orderedAmount.Value = 4;
salesOrderLine.Quantity = orderedAmount;
SalesOrderLine[] orders = { salesOrderLine };
salesOrder.Lines = orders;
Console.WriteLine("Call GetPolicyByOperation");
salesOrderCreatePolicy = wsDynamicsGP.GetPolicyByOperation("CreateSalesOrder", context);
Console.WriteLine("Call CreateSalesOrder");
wsDynamicsGP.CreateSalesOrder(salesOrder, context, salesOrderCreatePolicy);
And my config:
?xml version="1.0" encoding="utf-8"?>
<configuration>
<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="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="None">
<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="
[email protected]
" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
But i got:
The caller was not authenticated by the service. ---> System.ServiceModel.FaultException: The request for security token could not be satisfied because authentication failed
Changed the
<security mode="None">
to
<security mode="Message">
but now i got "The caller was not authenticated by the service. "
I used credentials
wsDynamicsGP.ClientCredentials.Windows.ClientCredential.UserName = @"asd";
wsDynamicsGP.ClientCredentials.Windows.ClientCredential.Password = "asd";
wsDynamicsGP.ClientCredentials.Windows.ClientCredential.Domain = "asd";
OR
wsDynamicsGP.ClientCredentials.UserName.UserName = @"asd";
wsDynamicsGP.ClientCredentials.UserName.Password = "asd";
But the same error. Another thing: i am logging in windows with this kind of username: comp\name and this is the name used as username, is this correct?
Another thing, my domain is different than theirs, this might be a problem?
Reply
Answers (
0
)
Query data base every minute and pass the JobID to a Service that will take more then 30 mins to execute.Shall i use duplex binding
How can i call json parameteries Wcf service form cs code ?