Contents
Do you need a session ID for soap?
Having said that, if you’re using SOAP, you’ll still need to be able to create your binding object from the session id, regardless of whether you get that session id from a file or the OAuth Refresh Flow… You will need to store the endpoint URL (from loginResult.serverUrl) as well as the sessionId.
How to extract session ID from XML response?
There are multiple ways you can extract the session id. From the xml you have provided it seems the session id is in the xml response. If this is the case the you can use the method suggested by olyv and extract the session id from the xml response. As lakshman suggest you could use groovy to parse the session id from the xml response.
How to get the session ID in Java?
If you are using the JAX-WS you may enable the session awareness using BindingProvider.SESSION_MAINTAIN_PROPERTY: If not, then try to find how to get and set the HTTP headers using your web services framework. There are multiple ways you can extract the session id. From the xml you have provided it seems the session id is in the xml response.
How to check if the session ID is valid?
You will need to store the endpoint URL (from loginResult.serverUrl) as well as the sessionId. Later, you can create the SforceService binding object from the session ID and URL thus: Now to check that the sessionId is still valid, you can simply make any API call, catch the exception and deal with it as appropriate.
Is there a problem with invalid session ID?
Yes, the problem was that the WSDL given to us was created in the wrong Sandbox Org. So from my initial example, I was trying to login to a cs13 Org but the endpoint was cs2 from the WSDL. Creating the method in cs13 and the generating a new WSDL with the correct end point resoved our issue.
Why do I get an error with SoapUI?
I’m learning all about the SOAP api (working through the Trailhead module) and I’m having issues with SoapUI. I’m able to make a login call successfully (username, password and token removed): But when I try and create a record according to the instructions on the trailhead module, I get “Connection Refused” error.
How does soap UI work against other Orgs?
Does SOAP UI work against other orgs, or is it just your scratch org that is causing the connection refused error? It really seems like a networking level error. I’d try using Soap UI from a different machine and/or another tool that uses the Soap API to update records.