I think two objects of Currency class say fromCur("GBP") and toCur("USD") then
call setFromCurrency(fromCur) and setToCurrency(toCur) are to be called on 
ConversionRate object

and call the service with ConversionRate object as argument.

Am I correct?

For the same I am doing the below.

1. I am getting the ConversionRate class object created which has below methods.
   setFromCurrency(),setToCurrency(),getFromCurrency(),getToCurrency()

2. Now to run the ConversionRate service, I need to call setFromCurrency() and
   setToCurrency() on the ConversionRate object, this requires an object of 
net.webservicex.Currency.

3. It is failing while creating an instance of net.webservicex.Currency.

Here is my code,
/**********************************************/

public void invokeCurrency(){
        try{
            ClassLoader classLoader = 
Thread.currentThread().getContextClassLoader();
            DynamicClientFactory dcf = DynamicClientFactory.newInstance();
            Client client = dcf.createClient(
                    "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL";, 
classLoader);
            Object credentials = Thread.currentThread()
                                    .getContextClassLoader()
                                    .loadClass("net.webservicex.ConversionRate")
                                    .newInstance();
            /*Failing at below statement while creating object of Currency 
class*/
         Object fromCur = 
Thread.currentThread().getContextClassLoader().loadClass("net.webservicex.Currency").newInstance();
            
            
            Method[] methods = credentials.getClass().getDeclaredMethods();
            for (Method m:methods){
                System.out.println("method=" + m.getName());
            }
            /*
              I am not sure as how to set the parameters for setFromCurrency() 
and setToCurrency()
              methods in the below code yet, as I have not passed the step to 
instantiate the Currency 
              class above
            */
            for (Method m:methods){
                if (m.getName().equals("setFromCurrency")){
                    System.out.println("Found setFromCurrency");                
    
                    m.invoke(credentials, fromCur.getDeclaredField("GBP"));  
                }
                else if (m.getName().equals("setToCurrency")){
                    System.out.println("Found getFromCurrency");
                    
System.out.println(m.invoke(credentials,fromCur.getDeclaredField("USD")));      
              
                }                                
            }
            Object[] result = client.invoke("ConversionRate", new 
Object[]{credentials});            
        }
        catch(Exception e){
            //log.error("exception e=" + e.getMessage());
            e.printStackTrace();
        }
    }
/**********************************************/

Please let me know any problems with the code or service itself.

> -----Original Message-----
> From: Dan Diephouse [mailto:[EMAIL PROTECTED]
> Sent: 09 August 2007 19:35
> To: [email protected]
> Subject: Re: Dynamic Client
> 
> 
> The CurrencyConverter should work fine. If you paste your 
> code we can take a
> look and see if we can figure out whats going on...
> Thanks,
> - Dan
> 
> On 8/9/07, Velidanda Srinivas 
> <[EMAIL PROTECTED]> wrote:
> >
> > Could someone list out some web service URLs which use 
> complex types.
> >
> > I want to test these with CXF dynamic client.
> >
> > I checked with xmethods and webservicex.net sites but,
> >
> > 1. could not find complex types in web services at xmethods and
> >
> > 2. could not run the CurrencyConverter at webservicex.net 
> as I am getting
> > InstantiationException while creating object of Currency class.
> >
> > > -----Original Message-----
> > > From: Willem Jiang [mailto:[EMAIL PROTECTED]
> > > Sent: 08 August 2007 11:08
> > > To: [email protected]
> > > Subject: Re: Dynamic Client
> > >
> > >
> > > Hi,
> > >
> > > If you use maven that could much easy , you just need add the
> > > dependency
> > > artifact
> > >
> > > <  <dependency>
> > >       <groupId>org.apache.cxf</groupId>
> > >      <artifactId>cxf-rt-databinding-jaxb</artifactId>
> > >      <version>${cxf.version}</version>
> > > </dependency>
> > >
> > > CXF relate jars
> > > If you use the bundler jar, there only one cxf-***-incubator.jar
> > > If you just want include related models' jar, they are
> > > cxf-api
> > > cxf-common-schemas
> > > cxf-common-utilities
> > > cxf-rt-core
> > > cxf-tools-common
> > >
> > > The third part jars
> > > ant*,
> > > jaxb-*
> > > geronimo-ws-metadata*
> > > stax-api-*
> > > spring-core-*
> > > spring-context-*
> > > jaxws-api-*
> > > wsdl4j-*
> > >
> > > Willem.
> > >
> > >
> > > Velidanda Srinivas wrote:
> > > > Hi,
> > > >
> > > > Could someone list the jar files required to run Dynamic
> > > Client application
> > > > using DynamicClientFactory.
> > > >
> > > > Srinivas.
> > > >
> > > >
> > > ______________________________________________________________
> > > __________
> > > > This e-mail has been scanned for all viruses by MessageLabs.
> > > >
> > > > To learn more about Singularity's business process
> > > management solutions and services please visit:
> > > > www.singularity.co.uk
> > > > www.singularity.us.com
> > > > Singularity operates globally through its offices in New
> > > York, London, Singapore, Ireland and India. Singularity
> > > Limited is incorporated in the United Kingdom with
> > > Registration Number NI 31519 and its Registered Office at 100
> > > Patrick Street, Derry, BT48 7EL, United Kingdom.
> > > >
> > >
> > > ______________________________________________________________
> > > __________
> > > This e-mail has been scanned for all viruses by MessageLabs.
> > > ______________________________________________________________
> > > __________
> > >
> >
> > 
> ______________________________________________________________
> __________
> > This e-mail has been scanned for all viruses by MessageLabs.
> >
> > To learn more about Singularity's business process 
> management solutions
> > and services please visit:
> > www.singularity.co.uk
> > www.singularity.us.com
> > Singularity operates globally through its offices in New 
> York, London,
> > Singapore, Ireland and India. Singularity Limited is 
> incorporated in the
> > United Kingdom with Registration Number NI 31519 and its 
> Registered Office
> > at 100 Patrick Street, Derry, BT48 7EL, United Kingdom.
> >
> 
> 
> 
> -- 
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com | http://netzooid.com/blog
> 
> 
> ______________________________________________________________
> __________
> This e-mail has been scanned for all viruses by MessageLabs.
> ______________________________________________________________
> __________
> 

________________________________________________________________________
This e-mail has been scanned for all viruses by MessageLabs.

To learn more about Singularity's business process management solutions and 
services please visit:
www.singularity.co.uk 
www.singularity.us.com
Singularity operates globally through its offices in New York, London, 
Singapore, Ireland and India. Singularity Limited is incorporated in the United 
Kingdom with Registration Number NI 31519 and its Registered Office at 100 
Patrick Street, Derry, BT48 7EL, United Kingdom.

Reply via email to