This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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, null)); params.addElement(new Parameter("lastName", String.class, args, 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
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