- This topic has 3 replies, 2 voices, and was last updated 13 years, 9 months ago by jkennedy.
-
AuthorPosts
-
DynDasEMemberI want to ask how can I create search , export features in Scaffolded tables?
For CRUD scaffolding , the generated tables provide us add , edit and delete.
There are Jaxws for describing Webservice , but it can’t be use within a form in each generated JSP page.
The Webservice from Jaxws is generated in the form of XML on the browser screen.
Can I change it to make it sending out the XML tags in the form of file to be saved ?Thanks you.
jkennedyMemberYou have a few options depending on the type of file that you would like to include for download / export.
Spring’s built in View Resolvers provide a nice place to hang code off of your Spring MVC controller that can handle the generation of “non html” based responses.You can review the Spring documentation on the subject here: http://static.springsource.org/spring/docs/3.0.x/reference/view.html look for this heading: 16.6 Document views (PDF/Excel).
You can use a similar approach if you want raw XML as the output, or you could add a method to your controller that gets a JAXB context for your object and uses a JAXB serializer to get the XML and then return that as a String.
If you look at the Entities that ME4S generates, they should already be annotated for JAXB xml serialization.
Let me know if this helps.
Thanks,
Jack
DynDasEMemberThank you , I’m using JAXWS right now.
The export files is XML plain text , can I trigger it as a XML file for saving in the html ?
jkennedyMemberThe generated Web Services from MyEclipseForSpring utilize Apache CXF as the implementation of the JAX-WS layer.
CXF is very flexible and it can be extended an overridden in many way.Generally speaking, it sounds like you would like to have a link or a button on a page that invokes the url of one of your Web Service endpoints which will then return a SOAP message back to the browser. The SOAP message will include the payload response which will include the XML representation of your response.
The way it is stated above, it sound like you are asking if you can just force the browser to save that SOAP response to a file which you could do by setting the HTTP Headers from the server that cause the browser to treat the response as plain text for example.
If you look at this doc all the way to the bottom, there is section discussing how to get access to the HTTP Request and Response for your service. http://cxf.apache.org/docs/servlet-transport.html titled Accessing the MessageContext and/or HTTP Request and Response.
I can’t imagine too many scenarios where your end users would actually want the SOAP message though and my guess is that what you really want is the XML payload from the SOAP Message. (Basically your Data without all of the transport stuff that wraps a SOAP Request).
If you want the server to return an XML stream that represents just your data and to set an HTTP header that causes the browser to save the response as a file, then I stand by the recommendation to use an MVC Controller to invoke the Service and to use the JAXB context to serialize the response from the Service invocation back to the client setting the appropriate headers.
Let me know if you can’t find a way accomplish your goal.
Thanks,
Jack -
AuthorPosts