You need to sign in to do that
Don't have an account?
jverd
Trying to logout gives No operation available for request {urn:enterprise.soap.sforce.com}logout
I assume the problem has to do with how I'm setting the session header after logging in.
Code:
public class LoginLogout { private static final Scanner scanner = new Scanner (System.in); public static void main (String... args) throws Exception { final SoapBindingStub soapBinding = (SoapBindingStub) new SforceServiceLocator ().getSoap (); final LoginResult loginResult; final String userName = getInput ("User"); final String password = getInput ("Password"); soapBinding.setTimeout (60000); loginResult = soapBinding.login (userName, password); if (loginResult.isPasswordExpired ()) { System.out.println ("An error has occurred. Your password has expired."); throw new ServiceException ("Login failed. Password expired"); } final SessionHeader sh = new SessionHeader (); sh.setSessionId (loginResult.getSessionId ()); soapBinding._setProperty (SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY, loginResult.getMetadataServerUrl ()); soapBinding.setHeader (new SforceServiceLocator ().getServiceName ().getNamespaceURI (), "SessionHeader", sh); soapBinding.logout (); } private static String getInput (final String prompt) { System.out.println (prompt + ": "); return scanner.nextLine (); } }
Exception in thread "main" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
faultSubcode:
faultString: No operation available for request {urn:enterprise.soap.sforce.com}logout
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:No operation available for request {urn:enterprise.soap.sforce.com}logout
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
etc. ...
This actually bring up a related question though. I've been copy/pasting the setting of the URL and session header, and usually I've seen
but then in some sample code for the query call, I saw
The MetadataServer/Server snafu was kind of a no-brainer, but for the header, is there documentation somewhere that gives some explanation so that I don't have to just copy paste what the given sample tells me? Or are there no other special cases--just SessionHeader at login an QueryOptions when querying with SOQL?
Cheers!