5

I have got a connection to a salesforce webservice by the following method:

  • Get an EnterpriseConnection to the auth endpoint and so a session id
  • Set the service endpoint to that of the webservice
  • Get a SoapConnection to the web service

Now I'm assuming that I have to log out but am having the following issues:

  • SoapConnection does not have a logout() method.
  • If I try to log out of the EnterpriseConnection using its logout() method, I get the following error message:

com.sforce.ws.SoapFaultException: No operation available for request {urn:enterprise.soap.sforce.com}logout, please check the WSDL for the service

Is there a different way to log out when using webservices than when using just the EnterpriseConnection?

Thanks

EDIT - Addition of code:

public static boolean login() {
    boolean success = false;

    try {
        ConnectorConfig config = new ConnectorConfig();
        config.setUsername(username);
        config.setPassword(password);
        config.setAuthEndpoint(authEndPoint);
        config.setProxy(proxyAddress, 8080);

        enterpriseConnection = com.sforce.soap.enterprise.Connector.newConnection(config); // EnterpriseConnection object

        config.setServiceEndpoint(webserviceEndPoint);
        webserviceConnection = Connector.newConnection(config); // SoapConnectionObject
        webserviceConnection.setSessionHeader(config.getSessionId());

        success = true;
        System.out.print("Logged in to webservice- ");
        Date startTime = new Date();
        System.out.println(DateFormat.getDateTimeInstance().format(startTime));

    } catch(ConnectionException e) {
        e.printStackTrace();
    }

    return success;
}

public static void logout() {

    try {
        enterpriseConnection.logout();
        System.out.print("Logged out - ");
        Date endTime = new Date();
        System.out.println(DateFormat.getDateTimeInstance().format(endTime));

    } catch(ConnectionException e) {
        e.printStackTrace();
    }
}
2

Are you sure you are invoking the logout() method from the right Connection object?

Also make sure you are not sending the request to the wrong endpoint.

Enterprise API v/s Partner API.

See:

http://boards.developerforce.com/t5/General-Development/Dreaded-No-operation-available-for-request-on-SOAP-API-call/m-p/377085#M64457

I have used logout() in most of my code especially with C# and Java and never had an issue so far. Do you have any code you can share?

Other things could be the case...it needs to be lowercase. Also please check if your wsdl was saved properly. Does it have a definition for logout()?

Please see:

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_logout.htm

  • Hi Richard. Thanks for your response. I've added some code above. I'm definitely trying to logout with the enterpriseConnection which is pointed at the authEndPoint. The SoapConnector webservice is connected to my serviceEndPoint which is the webservice. I am using the enterprise wsdl for sure and have updated the webservice and the enterprise wsdl without success. – Joe Mar 1 '13 at 17:26
  • Can you post what your "authEndPoint" is set to? – Richard N Mar 1 '13 at 20:20
  • authEndpoint = https://test.salesforce.com/services/Soap/c/27.0/0DFxxxxxxxxxxxx – Joe Mar 4 '13 at 9:12
  • serviceEndpoint = https://cs13-api.salesforce.com/services/Soap/class/NameOfWebservice – Joe Mar 4 '13 at 9:13
  • Yup that is the Enterprise wsdl. Can you change it to just https://test.salesforce.com/services/Soap/c/27.0/ ? – Richard N Mar 4 '13 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.