+ Start a Discussion
American DataAmerican Data 

Problems Generating WSDL Stubs

Hello,

I just generated java code from our Enterprise WSDL file using Apache Axis 1.2.1. I used the WSDL2Java utility to accomplish this.

Our program previously had no reason to access custom fields within salesforce and therefore used the SalesForce6.0.jar. Now that our program needs to work with the custom fields, I've created a jar file with the classes output from WSDL2java )run against our Enterprise WSDL), and have replaced the SalesForce6.0.jar the new one.

I'm getting some compilation errors with the new jar. The news stubs seem to have generated appropriately (I see our custom fields within the classes) however it appears that I might be missing some classes that used to be in the SalesForce6.0.jar. The missing classes are:

com.sforce.soap.enterprise._QueryOptions
com.sforce.soap.enterprise._SessionHeader
com.sforce.soap.enterprise.ID

Shouldn't these have been generated from the new WSDL? If not, any idea why?
SuperfellSuperfell
This is because the original jar is from Axis 1.1, and now you're using Axis 1.2, see http://blog.sforce.com/sforce/2005/06/migrating_from_.html
American DataAmerican Data
Thank you for your assistance Simon.

I've decided to rebuild using Axis 1.1. The program now successfully compiles, however, now when I try and run it with the new library I receive the following error:

Exception in thread "main" java.lang.NoSuchFieldError: org.apache.axis.enum.Style: field WRAPPED not found
at com.sforce.soap.enterprise.SoapBindingStub.(SoapBindingStub.java:28)
at com.sforce.soap.enterprise.SforceServiceLocator.getSoap(SforceServiceLocator.java:45)
at com.sforce.soap.enterprise.SforceServiceLocator.getSoap(SforceServiceLocator.java:40)
at com.americandatacorp.salesforce.SFBinding.getSFConnection(SFBinding.java:116)
at com.americandatacorp.salesforce.SFBinding.(SFBinding.java:68)
at com.americandatacorp.salesforce.SFBinding.getInstance(SFBinding.java:79)
...

Any ideas about what might be going wrong?

Thanks.

Josh
ChitraChitra
http://blog.sforce.com/sforce/2005/06/migrating_from_.html

Try -a option.. you would still have to change some of the references from _SessionHeader to SessionHeader..


Chitra
SuperfellSuperfell
You're probably mixing versions between the WSDL2Java stage and runtime.
American DataAmerican Data
Simon,

I can't find any information about Staging versus Runtime. Can you please provide a bit more information? In the meantime I'll continue my search.

Thanks.

Josh
SuperfellSuperfell
You must use the same version of axis when running your code as the version of axis used to generate the stubs (i.e. when running WSDL2Java)
American DataAmerican Data
Simon,

That was it.

I just figured that out as you were writing your message.

Thank you so much for your advice in guiding me through my problem.

Regards,

Josh