function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
skyfjskyfj 

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

turutosiyaturutosiya

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

SuperfellSuperfell
There's a getting started guide in the API docs.
skyfjskyfj

 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

 

skyfjskyfj

Dear Simon:

   

     Thank you very much. You are always answering my question, I appreciate you very much.

 

 

sincerely

skyfj

SuperfellSuperfell
Service references are WCF style stubs, and they generate a different programming model to a web reference. for regular c#, there's an add web reference option under the advanced button in the add service reference dialog (i have no idea if this exists for silverlight). This difference in the generated programming models is why you can't find an SforceService class.
skyfjskyfj

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

skyfjskyfj

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

   ]

    

[

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:Header>
<urn:SessionHeader>
<urn:sessionId>QwWsHJyTPW.1pd0_jXlNKOSU</urn:sessionId>
</urn:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<urn:query>
<urn:queryString>SELECT Id, Name, BillingStreet FROM Account WHERE Name LIKE '%a%'</urn:queryString>
</urn:query>
</soapenv:Body>
</soapenv:Envelope>

 

]

 

 [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

SuperfellSuperfell
not a particularly current API version, but yes https://na1.salesforce.com/services/Soap/c/10.0 is an API URL.
skyfjskyfj

Dear Simon:

       thank you all the same.

 

 

sincerely

skyfj