• Umar
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Using apache soap to generate soap clients for the "enterprise" and "metadata" wsdls.


The following works great with the "Enterprise" wsdl::

        binding = (SoapBindingStub) new SforceServiceLocator().getSoap();

        loginResult = binding.login(userName, password);
        binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY,
            loginResult.getServerUrl());
        SessionHeader sh = new SessionHeader();
        sh.setSessionId(loginResult.getSessionId());
        binding.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(),
                          "SessionHeader", sh);
//all subsequent calls work great



However, I must be missing something in the metadata api. There is no "login" method on the MetadataBindingStub generated from the metadata.wsdl ... how does one login and create a session?

            metaBinding = (MetadataBindingStub) new MetadataServiceLocator().getMetadata();
            metaBinding.setUsername(userName);
            metaBinding.setPassword(password);

            metaBinding.describeMetadata(); // >> INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session


Thanks.

  • March 04, 2008
  • Like
  • 0