O. Ziggy

Ranch Hand
+ Follow
since Oct 02, 2005
O. likes ...
Android VI Editor Debian
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
8
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by O. Ziggy

I am trying to create a simple Spring webservice which when called returns a file attachement as part of the SOAP response. The Enpoint class is shown below:


And finally the endpoint




I would like the response to include the file as an attachement similar to the following response:



I have tried to follow the documentation and the sample code in the spring-ws samples and for some reason the output i am getting is always this (i.e. the base64 data is not an attachement.




As you can see, the payload is not an attachment. Here is how i have configured my application:

web.xml


ws-config.xml



downloadMessageRequest.xsd schema file



The file does get converted to base64binary. The JAXB clases are generated correctly. The Endpoint works but it is not including the file as an attachement. It is including it as part of the XML tag even though i have set mtomEnabled=true.

What am i missing?




11 years ago
Yes that is what i thought. I just dont understand what it is i am doing differently. Here is the complete web.xml file



11 years ago
Why is it that if i declare a configuration file (my-spring.xml) as shown below the application does not load it.



If i declare it in the MessageDispatcherServlet then it finds it.



Is the first one not the root context? I thought when i declare the config file in the root context then it is available throughout the application but in the above case it seems to be the other way round.
11 years ago
Does this include the upload/download of binary files?
11 years ago
How does REST help if the consumer is a web portal?
11 years ago
I have a webservice which does a number of things. A simple example of things it could do (note just example):

Return list of products
Update product price
Add new product
Update existing product
Return product price
Return product brochure + image
Add product brochure + image

The first 5 services are simple enough in that a request is sent to the SOAP web service and it will either return a list or it will update an existing row in the database or create a new one.

The last two a slightly tricky in that they involve sending binary files to the service and recieving binary files from the service.

There is no problem in implementing the SOAP service on the server end. I already have a framework in place i now just need to implement the services. What i am having problems with is how to implement the client that will be consuming these services.

I have been reading up about SOAP clients and know that i can send the files as SOAP attachements but i dont quite understand how this is converted into a HTTP request.

Questions:

- I would like the client to be a web portal but i am not quite sure how you can call a web service from a web browser. is this possible?
- How does a web service call work from a browser? Is it a normal HTTP call?
- And most importantly, how would the upload/download of the binary files work?
- In terms of securing the requests, which is more secure? A web portal based client or a thick client based client?
- Is there any advantage in using Java Web Start/JNLP in place of a web portal or a thick client?
- Is it possible to mix and match between a web portal and Web start for the binary data transfer?
- Is it common practice to call a web service from a web portal (i.e. from a web browser)?

The other alternative i think is to implement the client as a thick client (Desktop application). The problem with this is that i have 0 experience in GUI Swing based applications.

One important aspect of the solution is that it has to be secure so whichever approach i use will need to be secured using certificates. The majority of the services will be implemented using Spring technologies. I am using Spring-WS for the Web service and will probably use Spring-MVC if it is doable as a web portal.

The Web Service and the Web Application will both be running in the same application server.
11 years ago
Is there an estimate date as to when this book will be available?
Thanks thats very interesting. I am investigating how to use the plugins you mentioned in your post.
12 years ago
Maven - Building a single war file from multiple modules

I posted a question last week on how i can build dependent modules and the result was that it was recommended that i use a build tool like Maven or Ivy. I decided to use Maven to try and achieve what i would like to do. My project basically builds a single war file which is deployed to Tomcat. The modules themselves are part of the final war file. Here is an example structure of the modules







As you can probably see, the above will all collectively form one application. What i would like to do is to end up with an artifact for each module. Because of the mixture of file types(jsp,css,java) i am not quite sure what is a suitable artifact. The diagram below show the structure of the war file i would like to end up with.



A couple of notes
- The java files in commonModule are built and end up in WEB-INF/classes
- The java files for the customerModule end up as a jar file in WEB-INF/lib
- The java files for the productModule end up as a jar file in WEB-INF/lib
- All of the jsps,css end up in the root of the war file

What is the best way i should store the artifact for each module in the repository?

- I could use a jar file but this cant hold the html type files(jsp,css,js etc)
- Each module (except the commonModule) will contain a jar file + the jsp, css files. I am thinking of storing the built artifact as a zip file and extract it when the MyApp.war is built to build the war file?
- Can i store the artifact for each module as a war file even though only one has a web.xml file?

How can i implement this using Maven

- I have been investigating Maven and found that it might be possible to have a multi module project with the following structure

MyApp.pom (parent project)
commonModule.pom
customer.pom
product.pom

- If i zipped up the modules in the repository how would i refer to them from the parent project and unzip them to build the final war file?
- Is it possible to automatically trigger the build of the parent project if any of the child projects are built?
- I havent figured out how to maintain the version of each of the child projects. If i build the customer project, how does the parent project know that there is a newer version of the customer.zip (or .jar) in the repository?
- Assuming the repository currently contains the following



If i rebuild, the customerModule and then rebuild the war file buy building the parent project, does maven rebuild all of the other modules in the repository even if they have not changed? How exactly will this work?

Is there an example project anywhere that demonstrate how to achieve the above? Any links or resources which show an example of the above would be very usefull.

12 years ago
Can anyone see any difference between these two (Other than the price difference)?

1Z0-899

1Z0-899

I have custom components that are standalone java components that do not run within the Jboss application server. These components need to interface with a HornetQ JMS queue which runs inside of AS7.

Looking at the Jboss AS 7 documentation, there seems to be conflicting information on whether remote JNDI lookup is supported or not.

This JIRA entry seems to provide some information https://issues.jboss.org/browse/AS7-1338 but it doesnt explain it well.

I guess my question is, Is it possible to access JMS queues running within the AS 7 application server from an external standalone client via remote JNDI lookup? If it doesnt is there an alternative approach that can be used to get to the JMS queues from an external lookup?
12 years ago
Is there any way i can one of the applications to see the data of the other application?
12 years ago
I am trying to write a simple program where i can put a HashMap on an application scoped session and get two applications/contexts deployed as two war files access the HashMap.

Servlet 1



Servlet 2



To test this i restarted Tomcat 6 then run access Servlet 1 first so that it initializes the Hashmap object. When i subsequently access Servlet 2 i get a NULL-POINTER error which is pointing at the line number where i tried to call newMap2.size()

What am i doing wrong?



12 years ago
I have three applications that are deployed in Tomcat as three war files. I need to reuse existing code which at the moment manages the logged on user information in a hashTable defined as



The string key is the sessionID and the UserObject is a normal class that has the following methods



The three existing applications have to reuse these user management code which means all three have to use the same instance of the HashTable. I realize that there are better ways of implementing Single Sign services but i am in a position where i have no choice but to reuse existing code/implementation.

I am looking for ways where i can modify the existing applications so that they can access the same instance of the UserManager class which is the class that contains the HashTable. I plan to create a new war file that will contain the UserManager class and other common classes but now the problem is that the servlet spec does not allow acess to data on individual applications i.e. app1 cant access app2's data.

I have been looking around on Google and found that possible solutions.

Solution 1

Add a new application (app4) which the other three applications will use to authenticate the user. The existing war files (app1, app2 and app3) would use app4 for the authentication by using the following approach.

App4 initialises the UserManagerInstance



App1, app2 and app3 would refer to the object as



Solution 2

The other solution is to add the UserManager to a JNDI context and have apps1-3 access it via JNDI.

Questions

- Which of the two solutions do you think is better?

- With solution2, how will the UserManager object be initialised before it is put on the ? I am not very familiar with JNDi so would really like to see an example of how i can initialise the object on Tomcat's JNDI and how i can access it.

- The new application will basically be providing a service to the other applications. Is there a better way of providing this service bearing in mind that the framework in use is Struts 1.

Environment used
--------------------------
Tomcat 6
JDK 6
Solaris 9
Struts 1.2

Thanks








12 years ago