Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Question Dynamically create objects, set value and call

  1. #1
    Junior Member
    Join Date
    May 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Question Dynamically create objects, set value and call

    Hi,

    In my application I am processing XML using xstream and getting mGnrt object then setting it to wrapper after adding headerObjects and sending to DataService for execution.

    Below is a sample code, for doing same...In my application for each service request I have to do the below thing but Objects will change means the "Some" part in below code is variable and will be replaced by service name ..
    how to achieve this means to deal it dynamically....

    XStream xstream = new XStream();
    xstream.alias("SomeRequestGnrt",SomeRequestGnrt.class);
    SomeRequestGnrt mGnrt=(SomeRequestGnrt)xstream.fromXML("<SomeReque stGnrt> <UserId>nits</UserId> <Pswd>1234</Pswd></SomeRequestGnrt>");

    SomeRequestWrapper someRequestWrapper = new SomeRequestWrapper();
    someRequestWrapper.setSomeRequestGnrt(mGnrt);
    RequestObjectHeader requestObjectHeader = someRequestWrapper.getRequestHeader();
    DataService.LognAuth(SomeRequestWrapper,ctxt);


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Question Dynamically create objects, set value and call

    See postings on here:Dynamically create objects, set value and call

Similar Threads

  1. java question on objects
    By joe98 in forum Threads
    Replies: 2
    Last Post: April 12th, 2011, 03:54 PM
  2. How to create a pointer type of effect for objects
    By zelalem in forum Object Oriented Programming
    Replies: 6
    Last Post: October 20th, 2010, 02:53 AM
  3. Create Objects on Demand?
    By Programmierer in forum Object Oriented Programming
    Replies: 5
    Last Post: July 7th, 2010, 01:13 PM
  4. Trying to create videogame, have a serious question
    By MikeAg in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: June 9th, 2010, 12:06 PM
  5. [SOLVED] How to dynamically create ArrayLists (or something similar)?
    By igniteflow in forum Collections and Generics
    Replies: 4
    Last Post: August 6th, 2009, 06:00 AM