Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB's and SOAP

 
James Drinkard
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • 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
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • 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!
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic