我開始在項目中使用SalesForce SOAP API Enterprise,並且我被困在create()方法中。SalesForce API Soap在Visual Studio上創建()附件
很多關於這個關於這個stackoverflow的答案似乎已經過時了,因爲這個API的create()並沒有像以前那樣只接收一個SObject。
我創建的所有這些對象,但我有上PackageVersion []和LimitInfo [],我從服務器獲取一個空響應麻煩。
下面是我在做什麼:
client = new SoapClient("Soap1", endpoint);
String sqlQuery = "SELECT ID, CloseDate, StageName, Name FROM Opportunity";
QueryResult qr = new QueryResult();
client.query(header, null, null, null, sqlQuery, out qr);
Attachment att = new Attachment();
byte[] pdf = File.ReadAllBytes("D:\\teste.pdf");
att.Body = pdf;
att.Name = "Attachment Teste";
att.Parent = qr.records[0];
att.ParentId = qr.records[0].Id;
DebuggingInfo debug = client.create(header, assignHeader, mruHeader,
allowField, disableFeed, streamingHeader, allOrNoneheader, duplicateHeader,
localeOptions, debugHeader, packVersion, emailHeader,new sObject[] { att },
out limitInfo, out saveResult);
而且我創造這樣所有這些對象:
private static SessionHeader header = new SessionHeader();
private static AssignmentRuleHeader assignHeader = new AssignmentRuleHeader();
private static MruHeader mruHeader = new MruHeader();
private static AllowFieldTruncationHeader allowField = new AllowFieldTruncationHeader();
private static DisableFeedTrackingHeader disableFeed = new DisableFeedTrackingHeader();
private static StreamingEnabledHeader streamingHeader = new StreamingEnabledHeader();
private static AllOrNoneHeader allOrNoneheader = new AllOrNoneHeader();
private static DuplicateRuleHeader duplicateHeader = new DuplicateRuleHeader();
private static LocaleOptions localeOptions = new LocaleOptions();
private static DebuggingHeader debugHeader = new DebuggingHeader();
private static PackageVersion[] packVersion;
private static EmailHeader emailHeader = new EmailHeader();
private static LimitInfo[] limitInfo;
private static SaveResult[] saveResult;
誰能告訴我,如果有具有創建另一個WSDL ()只有SObject作爲參數?
如果沒有,任何人都可以幫助一個例子或對這個create()方法的解釋?
salesforce.com上的文檔似乎已過時,因爲那裏的create()方法只接收一個SObject。
謝謝。
創建一個Web引用,而不是一個服務引用(或者你也應該能夠傳遞null除會話中的所有標題,你就需要從登錄調用正確填充) – superfell