DataPortal_Fetch not hit when called from Client Factory MethodsDataPortal_Fetch not hit when called from Client Factory Methods
Old forum URL: forums.lhotka.net/forums/t/7889.aspx
Jav posted on Tuesday, October 27, 2009
Obviously I am doing something wrong. That's why I have attached my TestObject files.
When I use the following code to call the Client side Factory methods, DataPortal_Fetch methods are not even hit.
TestObject.GetTestObject(1,(o, e) =>
{
});
OR
TestObject.GetTestObject((o, e) =>
{
});
The e.Error reads:
Csla.IDataPortalResult.Error {System.Reflection.TargetInvocationException: An exception occurred during the operation, making the result invalid. Check InnerException for exception details. ---> System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
JavedJonnyBee replied on Wednesday, October 28, 2009
Seems like you have a faulty endpoint in configuration on your client. The error message says that the endpoint on server was not found. If the call had mae it to server but dataportal had failed to find the correct DataPortal_Fetch method (based on your parameters) you would get an exception from MethodCaller.
The first call with parameter should fail anyway because you have different parameter types:
public static void GetTestObject(int id, EventHandler<DataPortalResult<TestObject>> callback)
{
var dp = new DataPortal<TestObject>();
dp.FetchCompleted += callback;
dp.BeginFetch(new SingleCriteria<TestObject, int>(id));
}
and the DataPortal_Fetch method:
private void DataPortal_Fetch(SingleCriteria<TestObject, string> criteria)
These parameter must be the exact same type.
Your static method could also be as simple as:
public static void GetTestObject(int id, EventHandler<DataPortalResult<TestObject>> callback)
{
DataPortal.BeginFetch(new SingleCriteria<TestObject, int>(id), callback);
}
Jav replied on Wednesday, October 28, 2009
Aah!
Thanks Johny
The problem was in my ServiceReferences.ClientConfig file in the following line which read:
endpoint address="http://localhost:12347/WebService1.asmx"
instead of
endpoint address="http://localhost:12347/WcfPortal.svc"
JavedCopyright (c) Marimer LLC