• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JAX-WS Web Service Clients- Dynamic Clients Query

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?


 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
prashant k. gupta
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ivan
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic