Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Axis2 web service question  RSS feed

 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

Please pardon this question but I'm a total newbe on Web Services.
I want to create some web services for my applications. Webservices is mainly called from applets but I must also be able to call them from PHP.

Is this possible? Are their any limitations if I use Axis2? Will the applet become heavy in load if I must include axis in applet path?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SOAP in general is a pretty heavy-weight protocol - lots of parsing overhead and big libraries. You may be able to get by with a much simpler protocol for getting the data to the applet and the PHP application.

I suggest you look into the REST style of web services which I attempted to summarize in this article.

How about an example of the data you want the applet to get.

Bill
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that reply.

Actually I let a webuser create a documents by creating pages, blocks, borders with colors and fill these boxes with images, text ( I use a word processor ) and tables ( spreadsheets JTable ). Kind of Adobe indesign in a applet but of course simplified. When a user has created a Document then all langugages interrested in the Document can translate it.

Calls to every client is made when the master document is updated.

The user can also make a preview of the document and a JPG, PDF is returned.

I have used Object input and Output stream before but Hibernate is a pain when it comes to serialize it. I can't get it to work so I've looked at webservices.

Maybe I should just you REST style and return an xml of the data. Problem is that it needs to be parsed on the client side and if the structure of the xml changes I need to edit both servlet and applet + php and every other resources that wants the data.

Some of the text may be exposed in a different way then in an applet and so on.

Any ideas for this?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you are dealing with quite a complex set of elements here. A very ambitious project.

I have used Object input and Output stream before but Hibernate is a pain when it comes to serialize it. I can't get it to work so I've looked at webservices.


I suspect you would find the jump from an Object serialization approach to XML with any SOAP toolkit to be full of problems.

Probably you will end up creating your own custom XML serialization of the document based on the internal logic of your document structure. SOAP or REST or whatever would simply transport this XML document.

I actually did something like this (on a less ambitious scale) that used HTML forms to let users edit a XML document representing a certification exam. In order to represent the possible legal structures I had to write a custom schema toolkit that defined all the possible elements and how they could be combined. A lot of custom XML serialization was involved.

Bill
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!

I have thought about this, reading on google and reading your posts, and I think that I will go with sending XML over http and respond with XML and let the applet, php and other resources handle this by them self.


Ex.
1. Applet sends a small XML to get the template.

2. Server responds by setting contentType to xml and get the template, colors for the template, grids, User, language and customer. All pages should also be in this respond.

3. When user request the page a small page xml is sent with pageId.

4. Servlet responds with sending all blocks to that page with no block data as xml

5. When a user edits a certain block just the content for that block is handled.

Hope I'm doing this right. Ugh, have a deadline soon.

How would updates and deletes fit in to this? Should the client send xml with data to be updated and deleted and the server respond with xml. Or should I different URL for this? Any advice?
[ August 29, 2007: Message edited by: Mathias Nilsson ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would updates and deletes fit in to this? Should the client send xml with data to be updated and deleted and the server respond with xml. Or should I different URL for this? Any advice?


My inclination would be to have ALL requests go through one servlet. Your situation will be vastly simplified if only one user at a time can modify the base Document. Other users can get "read-only" access.

Bill
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!

Let all request go thru one servlet. How is this possible? I know that the REST syntax is /Sevlet/resource/resource but havn't got a clue how to build that up. Seems like I must have a WebService to do this?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically the initial servlet would be a sort of "front controller" that looks at the request and decides what to do with it based on the complete request line. For example, by using the getPathInfo() method of HttpServletRequest.

If you feel more comfortable with multiple servlets, go with that route but note that all the servlets will have to coordinate on access to the master document.

What is the balance of types of users for this system? Will there be multiple people trying to modify the document "at the same time"? How is the master document stored?

Bill
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks William!

There can only be one user editing the document at one time. A lock will be made for that document. The user who started the master or a translation is the only user who can edit the document.

I have read some more about this and one collegue suggested that we should go with Axis2 but I really don't know.

Do you meen that I should let a frontController process the request and forward to other servlets that handles a particular request?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read some more about this and one collegue suggested that we should go with Axis2 but I really don't know.


I really don't see any way in which Axis2 fits your problem.

It appears you have already done a huge amount of work on document architecture and a user editing applet using (correct me if I'm wrong) the standard Java libraries. Why add another technology? Axis2 uses its own XML parser! Axis2 v1.3(just released) comes with about 20mb of jar files! You don't need Axis2 to move chunks of XML between client and server.

Do you meen that I should let a frontController process the request and forward to other servlets that handles a particular request?


That is one popular architecture. If this was my problem I would have that one servlet hand off requests to "worker" class objects - each of which is specialized for doing a particular job - for example rendering the master document to PDF. If you do it right, these worker objects can be tested and debugged outside the servlet environment - a big help. Of course I don't know how much working code you have now so that may not be a helpful suggestion.

Bill
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is always the Restlet framework for Java to help with the servlet work.
Burton Group recommends Restlet.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!