File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes JAX-WS Web Service Clients- Dynamic Clients Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "JAX-WS Web Service Clients- Dynamic Clients Query" Watch "JAX-WS Web Service Clients- Dynamic Clients Query" New topic

JAX-WS Web Service Clients- Dynamic Clients Query

prashant k. gupta
Ranch Hand

Joined: May 15, 2008
Posts: 62
Hi All,

I was trying the example of Ivan’s study notes for SCDJWS (4.9 JAX-WS Web Service Clients). In this while trying dynamic Clients example I found that I have to import other classes which was not in example and also I had to import generated artifacts class, below is the import statements of my DynamicCalculatorClient:-

package com.ivan.dynamic;

import java.util.concurrent.Future;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;

import com.ivan.calculator.AddNumbers;
import com.ivan.calculator.AddNumbersResponse;
import com.ivan.calculator.ObjectFactory;
import com.ivan.calculator.PrintNumber;

I used RAD7 for this example and my CalculatorService was already deployed on server and running and I generated the webservice client artifacts using WSDL and I had to import in my DynamicCalculatorClient class to suppress the compilations error. After that I was able to run the all examples using main methods:-

DynamicCalculatorClient theClient = new DynamicCalculatorClient();

Is this the correct behavior since I saw in notes that’s its written generated artifacts does not required?

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
Your questions is well motivated - the section which you refer to is not entirely clear which generated artifacts are not needed.
In the example, JAXB bean classes, generated using the XJC JAXB schema compiler are used in order to create request payloads and parse response payloads.
The artifacts that are not needed are the JAX-WS service class and endpoint interface.
Instead of using JAXB, the example could have used a Dispatch<Source> object to send requests. A source can be one of DOMSource, SAXSource, StAXSource, StreamSource (and JAXBSource, but that is JAXB) from which XML data representing a request is read.
That you need to add import statements in your source code is correct - there were omitted in some of the examples to conserve space.
Hope things are more clear.
Best wishes!

My free books and tutorials:
prashant k. gupta
Ranch Hand

Joined: May 15, 2008
Posts: 62
Thanks Ivan
I agree. Here's the link:
subject: JAX-WS Web Service Clients- Dynamic Clients Query
It's not a secret anymore!