0

I am new to WebServices. Need to create something like

http://myservice:portId?key1=val1&key2=val2

response should be based on some parsing logic based on values received and response should be something following in XML to calling client

<MyResponse>
 <value> You are good server URL hit on this combination is 1</value>
</MyResponse>

1) Can I implement this using either SOAP or REST ? 2) If I can do this in REST, does GET method needs to be changed to parse input after ? and reply back or it should be PUT or POST ? I need to maintain state on server, like next time same URL response will be replied with count increment.

Any pointers to implement will be great.

Filburt
  • 17,626
  • 12
  • 64
  • 115
MvsW
  • 97
  • 1
  • 11

1 Answers1

0

First, this is...

http://myservice:portId?key1=val1&key2=val2

is not a web service, this just a url, or a route and there's no simple answer to your question on how to create that route.

Can I implement this using either SOAP or REST?

SOAP and REST are not interchangeable and are not mutually exclusive from each other. While SOAP is a well-defined, not-new protocol that evolves around the implementation of web services, whereas REST (as quoted from Wikipedia) is an architectural style. In other words, you could have a RESTful (or not-REST) SOAP service. They don't replace each other.

If I can do this in REST, does GET method needs to be changed to parse input after ? and reply back or it should be PUT or POST ?

Not too sure what you mean. But, you are talking about parsing and validation parameters passed with the request, this is not the REST specification's concerned, it's up to you if you want to parse and/or validate requests. To understand how you should use the different HTTP methods refer to this answer here

I need to maintain state on server, like next time same URL response will be replied with count increment. Any pointers to implement will be great.

First, you need to understand that HTTP and REST are stateless. So, you won't get any out-of-the-box state management with a REST implementation unless you implement a solution. I can't write up a whole solution here but a good starting point is having a look at how many established APIs to do it...the overwhelming majority of implementations use some sort of access tokens, many do follow very popular open specifications such as OAuth where authentication and authorization happens through a handshake process in which the client provides some initial credentials, the server verifies them and then issue a temporary token that the client can use to request protected resources.

Community
  • 1
  • 1
Leo
  • 14,625
  • 2
  • 37
  • 55