Hi,
I am trying to host Dynamics GP WCF service in IIS. But I am facing two warning like this:
1) Argument 'debug' did not match any attributes
2) No attributes found to remove
This is my "Web.config" code:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation targetFramework="4.0"/>
<httpRuntime targetFramework="4.0"/>
</system.web>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="GPWebService"/>
</wsHttpBinding>
<webHttpBinding>
<binding contentTypeMapper="JsonContentTypeMapper.Mapping, JsonContentTypeMapper, version=1.0.0.0, Culture=neutral,publicKeyToken=null"/>
</webHttpBinding>
</bindings>
<client>
<endpoint address="http://WIN-CMP7MKTCB96:48620/Dynamics/GPService/GPService" binding="wsHttpBinding" bindingConfiguration="GPWebService" contract="DynamicsGPService.DynamicsGP" name="GPWebService">
<identity>
<userPrincipalName value="GPSERVER\administrator"/>
</identity>
</endpoint>
</client>
<services>
<service name="SalesOrderWCFService.SalesOrderProcessor" behaviorConfiguration="serviceBehavior">
<endpoint address="rest" binding="webHttpBinding" behaviorConfiguration="restBehavior" contract="SalesOrderWCFService.ISalesOrderProcessor">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"/>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="restBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
This is my "ISalesOrderProcessor.cs" code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.IO;
namespace SalesOrderWCFService
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "ISalesOrderProcessor" in both code and config file together.
[ServiceContract]
public interface ISalesOrderProcessor
{
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "CreateSalesOrder", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
// void salesOrder();
[return: MessageParameter(Name = "response")]
string sales(Stream stream);
}
// Use a data contract as illustrated in the sample below to add composite types to service operations.
/*[DataContract]
public class SalesOrderRequest
{
[DataMember(Name = "response")]
public string Id { get; set; }
}*/
[DataContract]
public class OrderRequest
{
string orderProcess;
string customerId;
string itemId;
string batchKeyId;
int quantity;
[DataMember]
public string OrderProcess
{
get { return orderProcess; }
set { orderProcess = value; }
}
[DataMember]
public string CustomerId
{
get { return customerId; }
set { customerId = value; }
}
[DataMember]
public string ItemId
{
get { return itemId; }
set { itemId = value; }
}
[DataMember]
public string BatchKeyId
{
get { return batchKeyId; }
set { batchKeyId = value; }
}
[DataMember]
public int Quantity
{
get { return quantity; }
set { quantity = value; }
}
}
}
This is my "SalesOrderProcessor.svc.cs" code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using SalesOrderWCFService.DynamicsGPService;
using System.IO;
using System.Runtime.Serialization.Json;
namespace SalesOrderWCFService
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "SalesOrderProcessor" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please select SalesOrderProcessor.svc or SalesOrderProcessor.svc.cs at the Solution Explorer and start debugging.
public class SalesOrderProcessor : ISalesOrderProcessor
{
CompanyKey companyKey;
Context context;
// SalesOrder salesOrder;
SalesDocumentTypeKey salesOrderType;
CustomerKey customerKey;
BatchKey batchKey;
SalesOrderLine salesOrderLine;
ItemKey orderedItem;
Quantity orderedAmount;
Policy salesOrderCreatePolicy;
DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();
public string sales(Stream stream)
{
StreamReader reader = new StreamReader(stream);
string reqJson = reader.ReadToEnd();
DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(OrderRequest));
MemoryStream mstream = new MemoryStream(Encoding.UTF8.GetBytes(reqJson));
OrderRequest obj = (OrderRequest)ser.ReadObject(mstream);
context = new Context();
companyKey = new CompanyKey();
companyKey.Id = (-1);
context.OrganizationKey = (OrganizationKey)companyKey;
DynamicsGPService.SalesOrder salesOrder = new DynamicsGPService.SalesOrder();
salesOrderType = new SalesDocumentTypeKey();
salesOrderType.Type = SalesDocumentType.Order;
salesOrder.DocumentTypeKey = salesOrderType;
customerKey = new CustomerKey();
customerKey.Id = obj.CustomerId;
salesOrder.CustomerKey = customerKey;
batchKey = new BatchKey();
batchKey.Id = obj.BatchKeyId;
salesOrder.BatchKey = batchKey;
salesOrderLine = new SalesOrderLine();
orderedItem = new ItemKey();
orderedItem.Id = obj.ItemId;
salesOrderLine.ItemKey = orderedItem;
orderedAmount = new Quantity();
orderedAmount.Value = obj.Quantity;
salesOrderLine.Quantity = orderedAmount;
SalesOrderLine[] orders = { salesOrderLine };
salesOrder.Lines = orders;
salesOrderCreatePolicy = wsDynamicsGP.GetPolicyByOperation("CreateSalesOrder", context);
try
{
wsDynamicsGP.CreateSalesOrder(salesOrder, context, salesOrderCreatePolicy);
return "order created123";
}
catch (Exception ex)
{
return string.Format("Exception:{0}",ex.Message);
}
finally
{
if (wsDynamicsGP.State != System.ServiceModel.CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}
}
I had created the new site in the IIS:
I am posting some data through Poster(Mozilla):
I read some blog, in that I think they installed WEB CLIENT in GP. So I started to install web client in GP. But I couldn't see the site which is available in IIS.
Can you tell me what I am missing. And tell me how IIS will talk through Dynamics GP 2013 R2.
*This post is locked for comments