• 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

EJB's and SOAP

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,
I started yesterday with SOAP for the first time. What I'm attempting to do is to make a SOAP request from an ejb, after I passed jsp form data into some collection object. I didn't find much on the web either!
My questions are:
1.) What is the best way for receiving jsp form data placed into the HttpServletRequest, so that later it can be put into a SOAP request? I have loaded httprequest data into Vectors, HashMaps and Hashtables, but it appears that when you load parameters for a SOAP request it must be from a vector and it's getting complicated loading a hashmap into a vector of vectors to match the key value pairs.
Here are the arguments for parameter:
Parameter(java.lang.String name, java.lang.Class type, java.lang.Object value,
java.lang.String encodingStyleURI)
One example I had found hardcoded the keys(form element name) and added each element value singularly into a vector for the SOAP request.
For example:
Vector params = new Vector();
params.addElement(new Parameter("firstName", String.class, args[0], null));
params.addElement(new Parameter("lastName", String.class, args[1], null));
I may have to duplicate this as I have different datatypes involved, but it seems like very bad coding.
2.) Does anyone know of any good code examples on the web for creating a SOAP request with an ejb as I may be doing a wrong approach here?
Thanks,
James
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
James, would you mind changing your display name into something compliant with our naming policy. ("J. Eston" will do, for example)
Thanks!
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I'd say use Objects! Build classes that correspond to the data on your forms and send those as parameters to EJB methods. This is the idea of a "Value Object" and it's what's recommended in nearly all of the major texts in J2EE (Core J2EE Patterns, Enterprise Application Architectures, etc.) and is what is supported in frameworks like Struts that do this for you.
Kyle
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic