File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes EJB's and SOAP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "EJB Watch "EJB New topic

EJB's and SOAP

James Drinkard

Joined: May 30, 2002
Posts: 19
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?
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
James, would you mind changing your display name into something compliant with our naming policy. ("J. Eston" will do, for example)

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Kyle Brown
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
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 Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at for other WebSphere information.
I agree. Here's the link:
subject: EJB's and SOAP
It's not a secret anymore!