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
Danny5Danny5 

Generated Java Classes

New to web services, want to make sure I have all this straight.

 

- I grabbed the enterprise wsdl from my salesforce developer account

- Generated the java sources from that wsdl in NetBeans IDE, using jax-ws

- I am able to call login() successfully

- Then in the examples and documentation the SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY on my Soap object needs to be set to the url of the server from the loginResult.

 

- I don't have SoapBindingStub as a generated class.  After looking around on the boards my guess is that this is because I used jax-ws instead of axis 1 to generate the classes.  Is that correct? 

 

- Regenerating the classes with axis 1 would generated the same class names from the examples. Correct?

 

- Since jax-ws doesn't appear to be the class generator used in posts and documentation here, it is going to be a struggle to attempt to figure out what axis 1 classes map to what jax-ws classes.  Correct?

 

Am I in the right jungle?  Thanks for your help.

 

 

Best Answer chosen by Admin (Salesforce Developers) 
mpiercempierce

The warning is harmless. Setting the endpoint is covered in the tutorial.

All Answers

mpiercempierce

If you wish to use jax ws, check out the tutorial I wrote on using jax ws with the partner API. The partner API is somewhat different from the enterprise API, but most things will be applicable. http://eng.genius.com/blog/2009/05/23/salesforcecom-partner-soap-api-jax-ws-tutorial-part-1/

Danny5Danny5

Thanks you the response.  I am still missing something somewhere.

 

My class file names are different from the JAX-WS example @ http://wiki.developerforce.com/index.php/JAX-WS_Quick_Start

 

- I created a new Web Service Client in my Netbeans environment, pointed at the enterprise.wsdl, specified as a JAX-WS client.

   The first time I was getting the naming conflicts you describe in the tutorial, I added the JAXB customization file and the java classes were generated without error.  I did get a warning before the generation step

 

parsing WSDL...

[WARNING] src-resolve: Cannot resolve the name 'ens:sObject' to a(n) 'type definition' component.
  line 3188 of file:/C:/Documents%20and%20Settings/dg/AFS/xml-resources/web-service-references/enterprise/wsdl/enterprise.wsdl#types?schema2

 

I'm not sure if the wanring matters or not?

 

So at this point I should be able to use the generated classes to talk to salesforce, in exactly the same way that the quickstart.java file from http://wiki.developerforce.com/index.php/JAX-WS_Quick_Start does.

I can call login successfully, but then I start to run into issues, because my class names are different from the class names used in quickstart.java.  I'm not sure why because JAX-WS was used to generate both.

 

For instance, SoapBindingStub in the example seems to be Soap in my generated classes, SforceServiceLocator in the example seems to be SforceService in my generated classes. So ok, as long as I know what maps to what it should be managable.  Not really.

 

Here is my problem that I don't understand:

Once login is executed, I need to set the ENDPOINT_ADDRESS_PROPERTY on the binded object to the url that the server set back to me in the login respinse.  I cannot do that in my generated classes as my bind object is Soap for some reason instead of SoapBindingStub, nor can I set the url in the header because I have no setHeader method in my binded object.

 

What am I missing?  Thanks

 

mpiercempierce

The warning is harmless. Setting the endpoint is covered in the tutorial.

This was selected as the best answer
Danny5Danny5

Many thanks, that did the trick, trying to figure out my exception on the query call now.

 

Thanks again