У меня есть приложение Silverlight, которому нужно получить метку атрибута OptionSetValue из сущности Activity.Логическое имя атрибута - pectypecode , и у меня есть следующий метод расширения для получения метаданных атрибута:
public static void RetrieveAttribute(this IOrganizationService service,
string entityLogicalName, string entityAttributeName,
Action<OrganizationResponse> callback)
{
var retrieveAttributeRequest = new OrganizationRequest()
{
RequestName = "RetrieveAttribute",
};
retrieveAttributeRequest["EntityLogicalName"] = entityLogicalName;
retrieveAttributeRequest["RetrieveAsIfPublished "] = false;
retrieveAttributeRequest["LogicalName"] = entityAttributeName;
service.BeginExecute(retrieveAttributeRequest,
result =>
{
if (result.IsCompleted)
{
var response = service.EndExecute(result);
callback(response);
}
}, null);
}
И я использую его следующим образом в моем SoapCtx, который уже был инициализирован:
SoapCtx.RetrieveAttribute("activitypointer", "activitytypecode",
orgResponse =>
{
if (orgResponse != null)
{
// examine orgResponse
}
});
Я могу отладить процедуру, но она не выполняется в строке var response = service.EndExecute (result); в моем методе расширения.Я получаю следующее сообщение об исключении:
Удаленный сервер возвратил ошибку: NotFound.
Вот StackTrace, если вы найдете его полезным:
{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)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__1(Object sendState)
Я ценю любую помощь или руководство, спасибо!