SOAP and HTTP response codes - web-services

Is SOAP end-point over HTTP expected to return any status code except 200 and 500? I have a SOAP end-point that has some business logic to reject requests when there are too many of them. I wonder what is the correct HTTP response code in this case - 500 or 429? The SOAP specification seems vague to me:
SOAP HTTP follows the semantics of the HTTP Status codes for
communicating status information in HTTP. For example, a 2xx status
code indicates that the client's request including the SOAP component
was successfully received, understood, and accepted etc.
In case of a SOAP error while processing the request, the SOAP HTTP
server MUST issue an HTTP 500 "Internal Server Error" response and
include a SOAP message in the response containing a SOAP Fault element
(see section 4.4) indicating the SOAP processing error.

In short SOAP uses HTTP/HTTPS as a transport. It is not bound to HTTP/S. SOAP can also use SMTP and JMS as a transport. Yes you can do SOAP via email.
The 200 and 500 error codes mentioned is just the standard way of letting SOAP know that the message contains a successful or failed SOAP request. Thus I would use 500 with the error logged in the standard SOAP fault.

Related

Which HTTP Method is used to send SOAP messages?

Which HTTP Method is used to send SOAP messages?
I guess, if you are working at the servlet level,you could define the HTTP method(would there still be restrictions?).
But if all that is hidden, and I'm using a simple JAX WS webservice, which HTTP method would(should??) the request and response messages have?
I think JAX-WS and most other implementations use post for transmitting requests
you can verify it by capturing the request in TCP IP monitor

WSO2 ESB providing HTTP 202 response on Proxy Service

I am trying to setup very simple WSO2 ESB Proxy service. While using it, I am getting HTTP 202 response back and WSO2 ESB is not doing anything with the request beside logging it. Here is the background of my setup
My service implementation is using SOAP 1.2 over Http 1.1. When my client opens the connection to the server, it fires first request and asks for keep-alive connection. The ESB passes the request to the actual implementation and sends response back with transfer-encoding as chunked. So far it works as desired.
After the initial request response exchange, my client submits several requests in parallel and I get HTTP 202 responses for all of them. Looking at logs, it seems ESB is not sending the request to the actual implementation ever.
Is there something that I am doing wrong? How do I fix it?
What happens in this scenario is that your subsequent requests are hitting the main sequence of the WSO2 ESB. That is why you can only see a log for those requests. As you have already narrowed down this happens due to the jsessionId attached to the URL. To overcome this issue you can create a REST API with URL pattern to match the correct URL path. Please refer the following documentation.
https://docs.wso2.com/display/ESB481/Creating+APIs

PeopleSoft - Cannot process SOAP fault messages after consuming web service

PT 8.50.15
We have a new integration with a third party system. They have provided the wsdl and I have used the consume web service wizard to consume it into PeopleSoft. All this does is give you the stub messages with a schema attached to each. I have written some peoplecode to send a test message out to the webservice. When the webservice returns a valid result, I have no problems. However, when the webservice returns a fault message, I get the following error:
Integration Gateway - HttpTargetConnector:ExternalApplicationException. Http status code HttpStatusCode returned : 500. (158,10623)
HttpTargetConnector:ExternalApplicationException. External System responded with an Error status. For Http Status Code explanation please check Http protocol Specifications.
I know the webservice is returning the fault message b/c I have tried the same thing in SOAPUI. Does anyone know why PeopleSoft throws up this error ONLY on the fault message?
In addition to the prior response, the 500 error you are seeing should be followed by any soap fault coming back with the response in the errorLog.html file on your gateway (or msgLog depending on the ig.log.level setting in your integrationgateway.properties file. Check the 'response' section, as well as the stack trace for additional information.
On the routing that you are using, click the 'User Exception' check box. Then you will not get the HTTP 500 error. Evaluate the response from the response message. If it's not zero, you will then be able to parse the SOAP fault and see what the returned faultstring is.
Get your Service operation corrected. I Had same issue, After i changed the SO in this code it started working
&msgRequest = CreateMessage(Operation.Operation_name, %IntBroker_Request);

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 send response using soap handler

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.