views:

23

answers:

0

so, I've got something like this: there's an ASP.NET application (1) that references WCF service (2) that references .NET application (3). (1) creates query gives it to (2), (2) gets some info from (3), processes it and returns it back to the (1).

And here's the issue - there's DataContract class for request (that is used by both (2) and (1)) which has a DateTime object in it. When this DateTime is assigned in (1), everything is ok. But when a ServiceContract's method is called with this request object, (2) sees this object as null (is DateTime was nullable), or 1/1/0001. String and Ints work just fine. No exceptions are being thrown.

CultureInfos are different on (1) and (2) and it has to stay this way. Using DateTime.SpecifyKind() doesn't help.

I don't want to cheat and send DateTime as string, bc it's just stupid.

Is it serialization problem? If so, how to solve it?

I'm quite new to this, so... please, be gentle ;[ Thanks

UPDATE

Service config:

<service behaviorConfiguration="eServiceX.eServiceXInterfaceBehavior" name="eServiceX.ServiceXInterface">
          <endpoint address="" binding="basicHttpBinding" contract="eServiceXCommon.IeXService"></endpoint>
          <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
          <host>
            <baseAddresses>
              <add baseAddress="http://localhost:8732/eServiceX"/&gt;
            </baseAddresses>
          </host>
</service>
..
<behavior name="eService.eServiceXInterfaceBehavior">
       <serviceMetadata httpGetEnabled="true" />   
       <serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>

Data Contract:

[DataContract]
public class GetXRequest : Request
{
        private string _name;
        private DateTime _date;
        [DataMember]
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }
        [DataMember]
        public DateTime DateTime
        {
            get { return this._date; }
            set { this._date = value; }
        }
}

... and the problem parts:

// ASP.NET app side:
X = new eService.ServiceXInterface();
eService.GetXRequest rq = new eService.GetXRequest();
rq.Name = "Blar";
rq.Date = SomeDay;
eService.GetXResponce Getter = X.GetX(rq); //here rq.Name is "Blar"; rq.Date is SomeDay

//..
// WCF service side:

[ServiceContract(Name = "IeXService")]
public interface IeXService
{
    [OperationContract]
    GetXResponce GetX(GetXRequest request);
}

public GetXHResponce GetX(GetXRequest request)
{
     doSMTH(request.Name, request.Date); //here request.Name is "Blar", but Date's value is 1/1/0001
     //..
}