Salesforce and soapUI – Using the default query method

In a previous post I discussed how to test Salesforce webservices with soapUI.  In this post I will show how to use the “default” methods inside the enterprise WSDL.

Logging In

First we need to login to Salesforce and get our session Id.  Under the SoapBinding list, expand login and choose Show Request Editor.  After opening the request editor we need to remove the extra headers we don’t need, and fill in our username and password.

Logging In

Then press the “play” button to send the request

Login Play

Now in the resulting XML we can pull out our session Id

SessionId

And we can pull out our server Url

Server Url

Adding the new endpoint

If we create a new query request and remove the unneeded headers and insert our session Id and run the request you get the following error:

UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService

To fix this issue we need to add a new end point to our SOAP request.  Using the server Url obtained during login we can add it to our request

New end point

And now we can rerun our new request with the correct endpoint

Full request

Conclusion

Unlike custom webservices which include the Salesforce endpoint as part of the WSDL the standard Salesforce enterprise WSDL only has the test or login url included.  Because of this, we need to use the returned server url to set our end point.

This entry was posted in Development, Salesforce and tagged , , , , , , . Bookmark the permalink.
  • Pragati

    Hi Patrick,

    Your Blog helped me a lot. Thanks.
    However, my requirement is to insert account and contact records in a single go through SOAP UI. Idea behind this is to maintain the ACCOUNT and CONTACT relationship.
    I tried to merge “create” and “query” requests into one but it was giving some error which means its not allowed to do that.
    Can you suggest some ways on how should I proceed on this ? I need this urgently.

    Thanks in advance,
    Pragati

  • I do not believe that you can do it with the native methods. If you want to do it in a single call, you might want to look at writing your own WebService method and calling that.

  • Mokinys

    Hi Patrick, your sample made my day. I’ve been struggling to retrieve data from salesforce’s partner SOAP API for hours and finally found your blog. Thanks very much!

  • Luciano Mota

    Great post Patrick. Very consistent as usual. Tks.

  • Brody

    Excellent. This helped out a lot!

  • Martin

    Thanks a lot

  • Jayakrishna

    Hi,
    Thanks a lot for your post and i need one clarification,

    Is there any way to get the Session ID without giving the Security token.

    Please clarify….

  • You do not need to supply the security token if the ip address of the requester is in the whitelisted IP address range

    https://help.salesforce.com/articleView?id=security_networkaccess.htm&type=0