SOAP исключение при обслуживании. Загрузите - PullRequest
0 голосов
/ 28 февраля 2012

Я пытаюсь загрузить вложения и заметки из сущности Контракт в среде crm4 для загрузки в среду crm 2011.

Я получаю исключение SOAP в строке (// String result = service.Fetch (sfetch);)

// --------- Server Name -----------
string OrgName = "USF";
string CrmSite = "http://crm4";
string TmpFolder = "C:\\TempAnnotation\\";


CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = OrgName;
CrmService service = new CrmService();

service.Url = CrmSite + "/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
//service.Credentials = System.Net.CredentialCache.DefaultCredentials;

service.Credentials = new System.Net.NetworkCredential("username", "password", "domain");

string sfetch = @"<fetch mapping='logical'><entity name='contract'>
                    <attribute name='modifiedon' />
                    <attribute name='title' />
                    <link-entity name='annotation' from='objectid' to='contractid'>
                      <attribute name='annotationid'/>
                      <attribute name='createdon'/>
                      <attribute name='createdby'/>
                      <attribute name='documentbody'/>
                      <attribute name='filename'/>
                      <attribute name='isdocument'/>
                      <attribute name='mimetype'/>
                      <attribute name='notetext'/>
                    </link-entity>
                    </entity>
                </fetch>
            ";

String result = service.Fetch(sfetch);

1 Ответ

0 голосов
/ 28 февраля 2012

Ваш код работает нормально, когда я пытался.

Можете ли вы добавить блок try / catch как таковой, чтобы увидеть дополнительную информацию об ошибке?

catch (System.Web.Services.Protocols.SoapException ex)
{
     string error = ex.Message + " : " + ex.Detail.InnerText;
}
...