how to send response using soap handler - web-services

I am using soap header for authentication process, if the authentication success, remaining processes are completed and got the response. But if authentication fails, i don't know how to send the error response back to client. I used soaphandler to retrieve the header values.
Regards
venu

Look at the sample code here
http://buddhiraju.wordpress.com/2011/12/28/use-soap-message-handler-for-cross-cutting-concerns-caching/
This will give you an idea. You basically can modify the message content is the soap handler.

Related

How are request response tracked in a application server

Look at this scenario in a massive webserver/application server
The user sends multiple requests that get processed async and call an webservice.
How is the request response cycle?
How does the application server know which packet of response goes to which request?
I know this is a very silly question, however i am not able to find any documentation on how this is handled?
How does the application server track the request and the response?

How to understand that SOAP webservice use HTTP only for transport?

As I understand RESTful webservices use whole power of http, suffice to say all that rest need is http, but in the same time rest!=http. CRUD provides ability to do any action with API resourses, for example we send http request, this request has header for aunthefication, name of method (for example put), and json in body for updating. How this proces is running via SOAP? SOAP uses XML, but how this XML is delivered to API?
SOAP is based on XML and it conveys that messages are delivered in a SOAP envelope that has a header and a body.
When a SOAP message (be it a request or response) is delivered over HTTP you will have the whole envelope put in the HTTP body.
If the implementation is proper, in the HTTP header, in Content-Type you will have application/soap+xml.
Also in SOAP 1.1 you might have the SOAPAction header, which is not mandatory and is discussed in detail in this article.
See this article for sample raw SOAP request and response. Here is an intro to SOAP that you might also find helpful.
Hope this helps! Good luck.

Asynchronous Web Service & Web Service without response?

The concept of Asynchronous Web Service is a web service where the client does not have to wait to receive a response from the server. in AJAX this is implemented by having a callback function to process the response. So the server indeed still sends the response to the client.
Is it possible to have an Asynchronous Web Service without response? Is there any platform that provide this?
Thank you.
I have done asynch web services in the past. They are very useful. YOu do not need a detailed response but you at least need an HTTP response, like 200 OK. If the client that makes the request provides some sort of ID or key for that request, then the client can use the same ID/key to later on query for the result/response of the request.
As far as frameworks that provide this, I do not know of any. In the past I would just have a shared memory store, like Memcache, to store the state and result of the request. As long as the state is shared across all nodes, any node can then process the call back request.
EDIT: Providing a key in the request can be done in either REST or SOAP environment. HTTP provides multiple places where a key can be communicated.
GET query param (REST)
HTTP header (SOAP/REST)
Added to the message body of a POST request. This can be done through two ways.
param in the message body (REST)
variable or attribute in serialized object (SOAP/REST))

http get for SOAP (web services)

We have a server process that replies to HTTP POST only.
The framework that I use, gsoap, provides an HTTP GET plugin.
I would like to ask what is the purpose of http GET in soap. What are the benefits?
Could you please share your experience, if any?
It represents different message exchange pattern. When you send POST you are issuing SOAP request and receiving SOAP response - that is called request-response message exchange pattern. When using GET you are calling "resource" by URI and including Accept HTTP header to request SOAP response - that is called response message exchange pattern.
These two patterns are used with HTTP binding defined in SOAP 1.2 (not every API supports this binding). Each message exchange pattern has its own purpose:
Response message exchange pattern is only for data retrieval. It should never change any data on the server.
Request/response message exchange pattern is for both retrieval and data modification on the server.
The benefit of HTTP GET can be anything related to differences between GET request and POST request. For example responses to HTTP GET requests can be cached on HTTP proxies.

How to create a web wervice in java/Axis2 which should keep publishing data

I am a new to Axis2 and SOAP. I recently working on a Axis2 SOAP project, I have create a SOAP server and SOAP client by using java and axis2 implementing session scope. The problem is when I send a request, it returns response back only once. I am unable to make web service keep publishing data periodically untill the session end. Can any body help me...
Thanks in advance
I might be wrong, but I think since you work with HTTP you can't make the
response permanent until you make your client perform calls permanently / periodically.
Permanent Requests --> Permanent Responses
I echo KB22's response - HTTP has a request-response flow, so your service is receiving a single request and sending back a single response. Implementing session scope means that you have a logical session for multiple request/responses to be tied together. You have a few options here:
Make the client wait until you have all the data to send back in one response. However, if this takes too long you may well get timeout issues on the client.
Change your model, so that you send in multiple requests and get back the data in pieces.
Change your model to a polling style, where you keep sending requests (and receive empty responses) until all the data is ready to be sent back.
Change your protocol to something that is asynchronous (e.g. JMS) so that you send in a request to a queue and at some later time the response turns up on the queue for your client to read.