• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Best Web Service practive for traffic/communication

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am fairly new to web services and I am looking into creating a service using jax-ws which allow a search of a database to create a list of results.

The setup I am OK with and have done a test to get the web-service working/talking to a test website.

What would be the best practice for handling the search results? Would it be best to create the search results on the initial web service call and send the whole resultset back as the response OR would it be best keep the web service open from the website and then use another web method to allow each individual search result to be returned individually?

I have managed to get the second process mentioned above working - but mainly because I did not know how to send back the Custom resultset object i.e. not Array or List - although I think I have found a way to do it using the JAXB annotations. If I was to go down this route would it be good practice to do it in this manner OR would creating an XML or JSON response be better?

Also, how does a web service process multiple calls, for example if 100 calls were made at the same time would it be one after the other OR would they run in parallel?

Thanks in advance
dazmaul
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,

WebServices requests are processed in parallel.(if capacity of the server is breached then they will hold those requests and process them in order they received)

Now coming to the result list management

When you get a request and there are 1000's of results,then we can use an option called pager

suppose think that the webpage you are using can show 10 records at a time
the selection would be ,the first webservice call will return 10 records,then from the second call on wards you should get the last record rownum and the pager value.
This way you can manage results for the page.

input=search xml .output=1st call displayed 10 records
2nd call input = start=10 pager=10 with search xml output= 10 records starting from 10th record--> query will be select <columns> from table where rownum>10 and rownum<20(start+pager) or JPA/Hibernate have the pager mechanism you can use that

Response is always good to send back in XML format(after all webservice's process reqs in soap-xml's) create a xml representation of the object and send them in format of xml.

An xml format can be recieved by any service and can be transformed into their specific representation if they want

better create a WSDL for the service with XSD properly defined.

Hope this helps....
 
I think he's gonna try to grab my monkey. Do we have a monkey outfit for this tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic