• tpausma
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi there,

In the API documentation, version 13.0; the following snippet of sample code is posted under the  "login" method:

Code:
private boolean login() {
  LoginResult loginResult = null;
  SoapBindingStub sfdc = null;
  try {
    //    Create binding object 
    sfdc = (SoapBindingStub) new SforceServiceLocator().getSoap();
    //    login
    loginResult = sfdc.login("username", "password");
  } catch (Exception ex) {
    System.out.println("An unexpected error has occurred." + ex.getMessage());
    return false;
  }

  System.out.println("Login was successful.");

  //    Reset the SOAP endpoint to the returned server URL
  sfdc._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY, loginResult.getServerUrl());

  //    Create a new session header object
  //    add the session ID returned from the login
  SessionHeader sh = new SessionHeader();
  sh.setSessionId(loginResult.getSessionId());
  //    Set the session header for subsequent call authentication
  sfdc.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(),
                       "SessionHeader", sh);

.
.
.
}


 


However, the WSDL (I'm using the partner WSDL) which contains the definitions for the SOAP binding does not contain a method called "setHeader" and the API documentation itself mentions nothing about a setHeader method except in the sample code of a number of functions.

How does one set a header then if this does not work? Or am I completely missing something?