+ Start a Discussion
SiddharthSiddharth 

Using APEX WSDL in ASP.NET...how to pass sessionid and serverurl

Friends,
 
I have created a simple APEX class with a function named HELLO() which accepts a string, searched in accounts for name starting with that string and returns a count in string format. I have generated it as a Web Method so that I can use this in .Net. I further generated a WSDL file from it and tried to use it ASP.NET.
 
After creating an instance of my web service, i get the Hello method accessible, but how do I set the login credentials for my APEX call. It says invalid session Id. Snippet from ASP.Net code.
 

protected void Page_Load(object sender, EventArgs e)

{

Test.HelloWorld2Service obj = new CellsMerge.Test.HelloWorld2Service();

string a = obj.Hello("s");

}

 

Any suggestions as how can we achieve this functionality.

Siddharth

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell
You have to obtain a sessionId and setup a sessionHeader on the apex webservice client, just like you do on the regular enterprise or partner APIs. You get can a session Id from one of the weblink/mergeField approaches, or by calling the login method in the enterprise or partner APIs.

All Answers

SuperfellSuperfell
You have to obtain a sessionId and setup a sessionHeader on the apex webservice client, just like you do on the regular enterprise or partner APIs. You get can a session Id from one of the weblink/mergeField approaches, or by calling the login method in the enterprise or partner APIs.
This was selected as the best answer
SiddharthSiddharth

Thanks It worked.

I was also setting up the URL which was not required. It was just the session header that was required to be set

Cool_DevloperCool_Devloper

Hi Guys,

I have a question regarding Apex Wsdl.

I have previously used the enterprise WSDL for integration and i know how it works. But I am not sure of how the Apex WSDL works.

I tried reading the docs and forums, but could'nt get anything substantial. Can someone give a use-case of when to use Apex WSDL and how?

I am looking at knowing the basic difference between enterprise and apex wsdl! 

Many Thanks,

Cool_D

kostya15kostya15

Hi,

 

What do you meen "session Id from one of the weblink/mergeField approaches"?

 

Best regards,

  Kostja

GABRIEL SILVAGABRIEL SILVA
Hello,

I have the same problem. Where of the web service call can i set this session header?

User-added image