You need to sign in to do that
Don't have an account?
Manoj kumar.ax391
Login calls for webservice apex methods
Hi,
I am developing a webservice method that needs to be accessed through the WSDL file from an external .net program. Here is the sample code (rather a very simple one)
global class CustomerInterface{
Webservice static String createCustomer(String customerName){
//perform some logic here
return 'Successfull';
}
}
Now when I generate a WSDL file for this it only contains this method. If an external .net service needs to access this webservice I should do the following steps
1. Consume a partner wsdl and then call the login method
2. Take the sessionid from the previous call
3. Consume my CustomerInterface WSDL and then add the sessionid from step 2 into the header of the createCustomer call
This means my client should consume 2 WSDL files. Is there any way where I can reduce this to one. Say add a login method in the CustomerInterface.wsdl?
Thanks,
Manoj Ganapathy
Instead of doing all these things manually , you can create a code snippet, which will call the login api and will fetch the session Id from it . Same time it will make the another call for customerinterface.
like :
XmlStreamReader reader = stub.login();
//parse the reader instance and get the session Id
String sessionId = reader.getLocalName('sessionId');
//now use the sessionId for customer Interface
stub.customerInterface();