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
May_The_ForceMay_The_Force 

WSDL2Java Axis Error

Hello,

I was hoping someone can help me out. I’m trying to call apex webservice via java client using Axis. I am following the example from this LINK

(I’ve already used the web services connector (WSC) and know how to use it but am curious to find out how Axis works)

Here’s what I have done:

  1. Generated WSDL (from apex class w/ webservice method)
  2. Running on axis2-1.4.1 (created AXIS_HOME environment variable)
  3. Running on jdk1.6 (created JAVA_HOME environment variables)
  4. Included the required jars in the classpath
  • axis.jar
  • commons-discovery-0.2.jar
  • commons-logging-1.0.4.jar
  • jaxrpc.jar
  • saaj.jar
  • wsdl4j-1.5.1.jar

  5.  Ran command

%AXIS2_HOME%/bin/wsdl2java -t -uri wsdl/projectWebService.wsdl -l java -d xmlbeans -p com.salesforce.webservice -sn SforceService -o generated/Salesforce

 

I get the following error:

C:\Development\AxisImplementation>%AXIS2_HOME%/bin/wsdl2java -t -uri wsdl/projectWebService.wsdl -l java -d xmlbeans -p com.

salesforce.webservice -sn SforceService -o generated/Salesforce

Using AXIS2_HOME:   C:\axis2-1.4.1-bin\axis2-1.4.1

Using JAVA_HOME:    C:\Program Files\Java\jdk1.6.0_24

Retrieving document at 'wsdl/projectWebService.wsdl'.

[ERROR] Service {http://soap.sforce.com/schemas/class/projectWebService}SforceService was not found in the WSDL

org.apache.axis2.AxisFault: Service {http://soap.sforce.com/schemas/class/projectWebService}SforceService was not found in the WSD

L

        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.findService(WSDL11ToAxisServiceBuilder.java:879)

        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:329)

        at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:142)

        at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)

        at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)

Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL

        at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:153)

        at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)

        at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)

Caused by: org.apache.axis2.AxisFault: Service {http://soap.sforce.com/schemas/class/projectWebService}SforceService was not found

 in the WSDL

        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.findService(WSDL11ToAxisServiceBuilder.java:879)

        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:329)

        at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:142)

        ... 2 more

 

If someone could please tell me...

What exactly is the SforceService and what does it do?

How can I get this to work?

 

Thanks so much!

 

SuperfellSuperfell

have you tried removing the -sn SforceService argument ?

May_The_ForceMay_The_Force

That worked!!! Thanks so much.

May_The_ForceMay_The_Force

Simon,

 

It appears as though the following are missing from the enterprise.jar :

 

-import com.sforce.soap.enterprise.SessionHeader;
-import com.sforce.soap.enterprise.SforceServiceLocator;
-import com.sforce.soap.enterprise.SoapBindingStub;

- import org.apache.axis2.AxisFault;

 

NOTE: I ran enterprise wsdl through WSDL2java and made a jar file and put them in the lib directory of my project.

 

These are required to run the example...again I am attempting to follow the example from the LINK

 

Thanks.