简体   繁体   中英

JAVA Client-Server application communicating with XML

I'm making a question/answer application , kinda like stack-overflow but as a desktop app for a uni project(not asking to do my work for me though , ive done a good part so far).

The questions,answers,users and comments are all stored in XML files rather than a SQL databse.

Now i have my XMLParser working with DOM , i made all of the needed functions like

 - User getUserById()
 - ArrayList<Comment> getCommentsByQid()

and so on ...

Also done the interface which is similar to this web page but as a java application, all working so far.

How the interface looks isnt at all part of the project .

The problem is teacher just told us that the files shouldn't be stocked nor treated locally (logical he never asked for it :/), and that i should make all these functions treated by a server which then parses the XML files and then reports the result to the application in XML format so that the application can go ahead and display the info ...

Well i know socket programming but re-doing things at this low level would take me forever, and after asking around i learned that it should be easily done since i have the functions ready , and that Netbeans (which im using) has servers like that ...

So what id have to do is make the application request something from the server application , like "get all questions tagged java" , the server then calls getQuestionsByTag("java") which i already written, and returns the result as XML ... what is it that im looking for here ? HTTP server ? apache ? a service ? ... link to any good tutorial would do .

Solved ... the keyword was SOAP . I followed this tutorial here

The way it works is the Server and Client define the way they want to communicate with WSDL which is a way to envelop an Object in XML format to send as an XML request/response . The Server/Client then knows how to convert that message back into a JAVA Object since they agreed on the format in the first place .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM