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
carbonfivecarbonfive 

3.0 WSDL to Java error

We've been using the following login code (from the docs):


  private SoapBindingStub login() throws Exception
  {
    SoapBindingStub binding = null;

    binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
    LoginResult lr = binding.login(login, password);

    binding = (SoapBindingStub) new SforceServiceLocator().getSoap(new URL(lr.getServerUrl()));
    _SessionHeader sh = new _SessionHeader();
    sh.setSessionId(lr.getSessionId());
    binding.setHeader("SforceService", "SessionHeader", sh);

    return binding;
  }

After downloading the latest sforce 3.0 WSDL and regenerating Java classes (using the ant tast 'axis-wsdl2java' provided with the latest axis-ant distribution) we no longer have a _SessionHeader class so this java source does not compile.

Has anyone else had this problem?

DevAngelDevAngel

Hi carbonfive,

I use the -a -T 1.2 flags when running wsdl2java from a batch file.  Can you include these arguments in your ant task?

carbonfivecarbonfive

That did it. It looks like wsdl2java thinks that _SessionHeader is unreferenced in the new WSDL. It's strange b/c the WSDL changed very little form sforce 2.5 to 3.0.

adding all="true" to the ant task is what did the trick:

    <axis-wsdl2java
      output="${war.generated}"
      typemappingversion="1.2"
      all="true"
      url="${war.properties}/enterprise.wsdl"/>

Thx, c5