You need to sign in to do that
Don't have an account?
![skyfj skyfj](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
How to use soap message to access salesforce?
Hello,veryone:
Recently, I want to use soap message to access salesforce(for example:login salesforce), I found below codes, but I don't know how to use them. Who can give me some advises?
by the way, I use C# to develop program.
resource:http://wiki.developerforce.com/index.php/Sample_SOAP_Messages
[
POST https://na1.salesforce.com/services/Soap/c/10.0 HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol
1.1.4322.573)
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 510
Expect: 100-continue
Host: na1.salesforce.com
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:enterprise.soap.sforce.com">
<soapenv:Body>
<urn:login>
<urn:username>user@domain.com</urn:username>
<urn:password>secret</urn:password>
</urn:login>
</soapenv:Body>
</soapenv:Envelope>
]
sincerely
skyfj
That is not the CODE. that is a defenition of salesforce's SOAP method.
what you need is
1. Understanding How to use soap on visual studio. That is "Web Reference".
2. Add Web Referece to your C# project
3. Then, you will be able to use soap method through auto-generated proxy class in your c# project
Dear turutosiya:
Actually, I want to access salesfoce's enterprise wsdl or partner wsdl from silverlight application. and, I add "partner.wsdl" of service references, and the "SforceService" object is not found.I don't know how to do?
Thank you all the same,turutosiya!
sincerely
skyfj
Dear Simon:
Thank you very much. You are always answering my question, I appreciate you very much.
sincerely
skyfj
Dear Simon:
Yes, you are right. I have known why the SforceService class doesn't exist and how to avoid this problem.
If adding service references as WCF, I can get salesforce's data from C# code,but can't get data from silverlight code.
there is an exception when logining salesforce: KeyNotFoundException.
sincerely
skyfj
Dear Simon:
I want to ask you a question: the below soap address of salesforce are right or no?
[ https://na1.salesforce.com/services/Soap/c/10.0
https://www.salesforce.com/services/Soap/c/16.0
https://na1.salesforce.com/services/Soap/u/10.0
]
[
]
[http://192.168.1.156:8016/SLDomainTest/WSStudent.asmx] I created this webservice, and use below soap message can access webservice's method.
[
StringBuilder sb = new StringBuilder();
sb.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
sb.Append("<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">");
sb.Append("<soap:Body>");
sb.Append(" <GetStudent xmlns=\"http://tempuri.org/\" />");
sb.Append("</soap:Body>");
sb.Append("</soap:Envelope>");
........
]
sincerely
skyfj
Dear Simon:
thank you all the same.
sincerely
skyfj