Page 1 of 2 12 LastLast
Results 1 to 20 of 37
  1. #1
    Join Date
    Oct 2008
    Posts
    1
    Rep Power
    0

    Default Java Servlet and Web Service communication

    I have developed a java web application and the purpose of the application is to fetch the data which are updated or new from another site using their remote services. This operation is being performed in a fixed interval using a timer in my application. After getting the result from remote site, presently, I am keeping it in memory (Need at least 512 MB RAM). I have created a servlet and created some methods. These methods are accessible by passing the methodname as query parameter while calling the servlet. I have also created a web service for the methods which are available in servlet (in a separate class).

    I have deployed the web service on Tomcat 5.0/Axis and web application on Tomcat ( same instance of Tomcat). Since one is web service and other is web application, I am duplicating the business logic/components and both are running separately also. I would like to use my business logic/components on either in web service or web application and divert the call from one to other.
    I mean,
    (1) if I use the business logic/components on web service, then from my servlet, I would like to call the web service and return the result
    (2) if I use the business logic/components on web application, then from my web service, I would like to call the servlet and return the result

    Pl. advice me which one from the above method is good and how to implement that.

    --Sabeer

  2. #2
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    7

    Default

    In my point of view, your doing great but i think you need some update on that Hardware. Have you tested the system performance in a Stress Test (20-50 users connecting simultaneously) and some of them maybe a few miles away.

    about getting data from another site, that will generate some lag in your system especially if you will be fetching from a large collection of data and you will be passing them through the network. It will definitely have some effects on the performance. And its not advisible to keep everything in the RAM. try loading a text file around 25MB in size. Im sure the RAM will be crawling a little bit. try using FTP and save it temporarily in your hard drive. and if you will be needing to access the contents of those file, you can use batch processing (By not loading everything in the memory).

    -Eku
    Mind only knows what lies near the heart, it alone sees the depth of the soul.

  3. #3
    sproket is offline Member
    Join Date
    Oct 2008
    Posts
    7
    Rep Power
    0

    Default

    Do a google search "java web service metro". Metro is a simple web services toolkit for Java. Lots of info there on how to do what you want.

  4. #4
    praveen222 is offline Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0

    Default webservice integration.

    Hi,

    We developed an application which is deployed in tomcat, Then now we are planned to connect to the webservice which is in hosting server for using webservices. How can we do for integration.

    We are gone through the SOAP, JWSDP and Axis. We are not using any IDE. Which one is better from above three. we are using tomcat as a webcontainer.

    From susshail post we got some useful information. please susshail can you provide us that example.

    i.e calling a webservice from webapplication using servlet.

    Please provide us example.

    Thanks,
    Praveen

  5. #5
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Location
    USA
    Posts
    127
    Rep Power
    0

    Default

    to call webservice you need following:

    - url of wsdl file
    - from that url you generate wsdl file
    - from wsdl file, identify web methods
    - implement those method in java class
    - follow this link:

    Developing JAX-WS Web Service Clients - NetBeans IDE 6.7 Tutorial

  6. #6
    praveen222 is offline Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0

    Default XML formated data uploading to webservice using webservice client.

    hi Aseem,

    Thanks for giving a valuable information to me. we have gone through the Developing JAX-WS Web Service Clients. It is so useful to us. Now our intension is to send the data or information in xml format to the webservice and after completion of that process i retrieve that data in xml and have to do parsing.

    please provide us some link like Developing JAX-WS Web Service Clients for uploading information to webservice in XML format.

    our intension is after developing webservice clients wants to send the data in xml format to the webservice.

    (webservice client sends or upload inforamation to webservice in xml format).


    Thanks in Advance,

    Praveen.

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default

    It'll be XML anyway. That's how it's transferred.

  8. #8
    praveen222 is offline Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0

    Default sending XML file to webservice

    Hi Tolls,

    Thanks for giving reply. We have an xml file that contains employee information. wants to send that xml file to the webservice (instead of jsp what can we use in our spellchecker example or how can we change (parse) that xml data to jsp or any).

    few doubts regarding AXIS and JWS:

    1. what is the difference between AXIS and JWSDP?
    2. Is AXIS contains JAXM and SAAJ? (I Think it contains SAAJ).

    So far i understood about SAAJ is
    Creating a SOAP connection
    Creating a SOAP message
    Populating the message
    Sending the message
    Retrieving the reply

    3. What is the difference between JAXM and SAAJ?

    I think SAAJ replaces the JAXM for sending messages.

    4. what is the relationship between AXIS and JAXM?
    5. What is the relationship between AXIS and SAAJ?
    6. suppose if i want to send xml data to webservice. Is only saaj is required or JAXM also?


    Finally We have XML file of employee information and wsdl file provided by webservice.

    Then how can we going to start. we dont have jsp file (can we use xml tags or fields in jsp, is it ok).

    I am thinking it is better to change (parse) XML to jsp and going for further process using Developing JAX-WS Web Service Clients - NetBeans IDE 6.7 Tutorial link.

    "If you have link or example for sending XML file or xml data to webservice, please provide us."

    "CONCLUSION:we have WSDL and XML files and wants send xml file to webservice"

    Thanks in Advance,

    Praveen.

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default

    WHy on earth are you going on about JSP files?

    You have some xml.
    You have a wsdl, that presumably defines a service that can take the data in that xml.
    So, if need be, transform the data in the original xml into a form the web service can understand.

    Is the xsd for the employee data the same as that used for the web service definition?

  10. #10
    praveen222 is offline Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0

    Default

    Thanks Tolls for giving reply. Do you have any example please provide us. ya by using xsl we transferred xml data to form. but there is problem while sending data to servlet from the form.

    Please provide us example of sending XML data to webservice and retrieving data.

    few doubts:

    1. How many ways we can change xml data to form.
    2. If xsd is there, then how?
    3. Using XSL is it possible to change xml to form?
    4. Using XSD, is it possible to change xml to form?
    5. Or any other ways?

    please provide us example.

    Thanks in Advance.

    Regards,
    Praveen.

  11. #11
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default

    Eh?
    Where does the servlet come into it?
    You're talking about a web service...

  12. #12
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    368
    Rep Power
    5

    Default

    Hi, I posted large private message to author of this thread
    in order to clean this phantom web/service and servlet problem,
    but no response?!

    To much technology writing here
    and non of us know
    WHAT IS YOUR SERVICE DOING?

    Can u please in short explain
    main client and server responsibilities.

    Are there any user actions or it is all automated?

    Explain full life-cycle of one " fetch the data which are updated or new from another site" scenario if you want us to undestand WHY is is done
    so we can speak about HOW will it be done?

    Separate scenario in :
    1. client,
    2. your server(web services server or servlet) and
    3. remote server
    roles and responsibilities and write who does what

    looking forward to help you

    cheers!

  13. #13
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Location
    USA
    Posts
    127
    Rep Power
    0

    Default

    WebService use SOAP protocol for data transfer. So as tolls said, its XML all the way.
    But, if you talking about passing xml to web method's parameters, then i dont think that is possible. XML is only used as data carrier not for processing data. So, if you want to pass XML to web methods, i havent done that way. Rather, you take the xml, parse it and send to web methods.

    Whenever you create a web service and test it, its XMl all the way. Whatever request is sent to webservice from web service client will go in XML i.e. SOAP message. So, XMl is already there.

  14. #14
    praveen222 is offline Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0

    Default XML parsing

    Hi Aseem,
    Thanks for giving reply. could you please provide me one example (java, mvc) which can take the XML, parse it and send to web methods. Actually we have XML data at client side (How an i done)

    Thanks in Advance,

    Regards,
    Praveen.

  15. #15
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Location
    USA
    Posts
    127
    Rep Power
    0

    Default

    Praveen,
    If you already have XML, you parsers like DOM, SAX or use JAXB to convert XMl to java objects. Once it gets converted, you can send to web method in your web service client.
    Would you be using form or hard code once it gets converted into java objects.
    I can give you the working example on JAXB to convert xml into java objects.

  16. #16
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default

    OK, so you have XML on the client. Do you know how to upload files to a Servlet (assuming it's a file)? That's your first step.

    If you can do that, then you can use that XML and transform it (if it isn't already in the correct format) into something the web service understands (based on the xsd the web service uses). This can then be used to create some Java objects via JAXB, the bindings for which should already be defined when you created the web service client. So, can you do the transformation?

    Finally you can then use these objects to call the service.

    So:
    1. Get the xml off the client. Pretend it's in the format below:
    <employee><name forename="me" surname="thing"><id value="123"></employee>
    2. Transform into whatever the web service requires. Say the web service expects employees to look like this:
    <emp><first_name>me</first_name><surname>thing</surname><id>123<id></emp>
    3. Get the emp object (as built when you generated the client) via, presumably, JAXB.
    4. Call web service.

    ETA: You have quite alot of different bits to do, so do a bit at a time.

  17. #17
    praveen222 is offline Member
    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0

    Default

    Hi Aseem,
    Thanks for giving valuable information to us. It is really useful to us.
    once again thanks to you.
    Regards,
    Praveen.

  18. #18
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Location
    USA
    Posts
    127
    Rep Power
    0

    Default

    @praveen

    You owe me a bottle of beers..>!!!!

  19. #19
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    368
    Rep Power
    5

    Default

    Aseem : "Hello Group. I'm Aseem and I am alcoholic."

    Group: "Hello Aseem!"

  20. #20
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Location
    USA
    Posts
    127
    Rep Power
    0

    Default

    Fon,

    How about joining me ?
    We will drink in Java way..!!!

Page 1 of 2 12 LastLast

Similar Threads

  1. Consuming a Web Service using Java
    By gopikrishnatb in forum Web Frameworks
    Replies: 2
    Last Post: 03-02-2009, 09:59 AM
  2. java.lang.OutOfMemoryError in a web service client
    By elchape in forum Advanced Java
    Replies: 4
    Last Post: 06-28-2008, 05:21 PM
  3. Java Message Service
    By Java Tutorial in forum Java Tutorial
    Replies: 0
    Last Post: 06-09-2008, 09:57 PM
  4. Java Service Wrapper 3.3.0
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 03-29-2008, 01:04 PM
  5. applet servlet communication
    By hardc0d3r in forum Java Applets
    Replies: 1
    Last Post: 07-12-2007, 06:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •