[SalesForce] Testing custom apex webservice with SOAP UI

I'm new to using SOAP UI tool.

I've created a very simple apex webservice which returns just list of Account records.

Issue is : when I generate WSDL for above class and consume it in SOAP UI, I'm not getting option to login to SFDC

When I do the same for enterprise WSDL, I'm able to get ServerURL and sessionID with which I can send further requests like query etc ..

Below is the screen I get using enterprise WSDL, clearing getting option to login:

Enterprise WSDL

But If i trying using WSDL generated from custom apex webservice class, no such option comes, instead What I get is to make only following request :

Custom Apex webservice

Here I've to provide all such things like
Log catagory
Log level etc…. but not getting option to login into SFDC.

Let me know If I'm doing something wrong or missing something as I've just started using SOAP UI.

I've another question, beside SOAP UI, what are other good tool(s) to test custom Apex Webservices( preferably free)

Thanks !

Best Answer

The web-service WSDL that you have created will not contain any method to login.

In the 18th line of your webservice, you will be required to pass a session Id, which you can obtain using the enterprise/Partner WSDL.

How to get a session Id

Approach One: Login using your Enterprise/Partner WSDL (Shown Above) and It will generate a session-id and a URL (You will see that in the result). You might be required to put password as YOUR PASSWORD + SECURITY TOKEN

Approach Two: You can get your session Id from Developer console by executing UserInfo.getSessionId().

Approach One is recommended.

Now Goto you webservice and in SOAP UI, in place of session Id and put the sessionId that you have got in line 18 and in the URL on the top, enter the URL (serverURL) you got as response from login() method.

Now you can test your service.

Image Credits: JEFF DOUGLAS BLOG

Jeff's Blog Image Credits: JEFF DOUGLAS BLOG


Our organisation has moved on REST web-services only so I use POSTMAN or Workbench.