function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gowdagowda 

Need Help on the URL

folks

I created an developer account, then generated WSDL file and placed this WSDL file in my local environment and generated stubs based on this , Now I wrote an client which takes in the username and password , the same which i use to log in to the developer edition, Here is the code

 try{
            binding = (SoapBindingStub)
            new SforceServiceLocator().getSoap();
          }catch(Exception ex){
           System.out.println("exception occurred" + ex.toString());
          }
          System.out.println("binding :" + binding);
          binding.setTimeout(60000);
          
           loginResult = binding.login(uName,pwd);
           System.out.println("loginResult =" + loginResult.getServerUrl());

 

when i try to get the Server URL i am getting

https://na1-api.salesforce.com/services/Soap/c/4.0 which is correct by the standards then,

           binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY,
                                                                                              loginResult.getServerUrl());
           
           _SessionHeader sh = new _SessionHeader();
           sh.setSessionId(loginResult.getSessionId());

// now i am trying to get the objects ..

         DescribeGlobalResult globalObjects = binding.describeGlobal();
           if (! (globalObjects == null)) {
               // Get the array of object names from the result
            String[] types = globalObjects.getTypes();
              if (!(types == null)){
              for (int i = 0; i < types.length; i++) {
                   System.out.println("Objects supported ::" + (types[i]));

              }

        }

but i am not able to print the objects,

I appreciate if any one knows how to get the objects that would be really greatful...

thanks & regards

gnanesh

 

 

 

SuperfellSuperfell
You created the SessionHeader but didn't add it to the headers collection on the bindingStub, e.g.

_SessionHeader sh = new _SessionHeader();
sh.setSessionId(loginResult.getSessionId());
binding.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(), "SessionHeader", sh);

see http://www.sforce.com/us/docs/sforce40/sforce_API_calls_login.html#wp1442825 for an exmaple.
gowdagowda

Sorry i missed out that code while posting my question..Yes i do have the below code to set to the header.

binding.setHeader(new
             SforceServiceLocator().getServiceName().getNamespaceURI(),
      "SessionHeader", sh);

Let me know about it,

Regards

Gnanesh

DevAngelDevAngel

Hi gowda,

So, what are you getting?  Can you set a breakpoint and inspect the DescribeGlobalResult?  Can you capture your soap messages?