Logging the request details before message builder in Axis2 - web-services

Is there a way to log the request before building the message in Axis2. Overhead of enabling wire logs is high and I only need to log request time, http headers, http method, request URI, etc... Here I cannot use Axis2 handler since it engage after building the message. So my question is how to log the request details before message builder in Axis2.

Related

SOAP request through JMeter with authentication

I'm having trouble sending a JMeter SOAP request through HTTP Request element -
Through SOAPUI I'm sending the request with the following properties:
Authentication via SOAP
But I cannot receive a valid response when I try to add these username password. I've tried to place it in HTTP Header Manager/ in HTTP Authorization Manager, but with no luck. I receive either error:
Response code: 404 Response message: Not Found
when placing this in the HTTP Authorization Manager and
HTTP Error 400. The request has an invalid header name
when placing the username and password in the header manager (with wss password type field, while in HTTP Authorization Manager there is not option like this).
What can I do to have a valid response from the server like I get in SOAPUI?
If you need to replicate SoapUI request I would suggest just to record the request from the SoapUI via JMeter HTTP(S) Test Script Recorder
In JMeter
File -> Template -> Recording -> Create
Workbench -> HTTP(S) Test Script Recorder -> Start
In SoapUI
File -> Preferences -> Proxy Settings
Host: localhost, Port: 8888
Enable proxy in SoapUI
Execute your request
Expand Thread Group -> Recording Controller in JMeter and observe the recorded request.
You may also need to correlate timestamps using __time() function check out Take the Pain out of Load Testing Secure Web Services for details on bypassing different web services security in JMeter tests.

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

log wso2 esb request/responses to database

I want to build a logger that logs all incoming requests and their response to a database. For this I created an axis2 module that should do this in the Inflow and the Outflow - I do not want to trigger the logging from the sequences, because then I would need to put the logger in all my services.
My problem is: how can I relate the incoming message in ESB to the return message? I think this is where Synapse comes in, but I cannot find the right properties to link the messages together: there is no messageId or correlationid that I can use to do this.
Is there a way to access the Synapse properties of the message in the axis2 handler?
Axis2 module is a right option. To identify request and responses, you can check the messageIDs. And if you want to access request messagecontext in the relavant responsemessage context try following code block;
MessageContext requestMessageCtx = responseMessageCtx.getOperationContext()
.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
Here is a blog post

WSO2 API Manager: How do I log the fulle (http) SOAP response

How do I log the SOAP response messages (complete http response) when I invoke a service on the WSO2 AM?
If you want to see all the messages that are passing through, you can enable the wire level logs. It will log all http messages. Please uncomment following two properties in "log4j.properties" file which can be found at /repository/conf directory
uncomment the following logs to see HTTP headers and messages
log4j.logger.org.apache.synapse.transport.http.headers=DEBUG
log4j.logger.org.apache.synapse.transport.http.wire=DEBUG
You can use log mediator to log the response. Add log mediator with level="full" at your out sequence of the API(repository\deployment\server\synapse-configs\default\api) configuration. After editing the sequence, restart the server.
OR else, you can define your custom sequence to log message and you can add that when you try to publish the API.

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.