aspose file tools*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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
Author

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.net.MalformedURLException;
import java.net.URL;
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 javax.xml.ws.AsyncHandler;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Response;
import javax.xml.ws.Service;


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();
theClient.callOnewayService();
theClient.callSyncReqRespService();
theClient.callAsyncReqRespService();
theClient.callAsyncHandlerReqRespService();


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
    
    1
Hi!
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: http://www.slideshare.net/krizsan
prashant k. gupta
Ranch Hand

Joined: May 15, 2008
Posts: 62
Thanks Ivan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAX-WS Web Service Clients- Dynamic Clients Query
 
Similar Threads
Dynamic Client example in Ivan Kriz's tutorial
Issue while deploying web service jwstutorial example CLI171
Explanation of JAX-WS artifacts
Regarding creation of servlet endpoint for web service
Error while deploying the war file using command "asant deploy"