Camel-groovy - Route Transaction and rollback containing cxf endpoint - web-services

Im new to Apache camel - groovy, maven projects.
I am trying to create a route like this
from("file://E://Target//JVNumber")
.transacted("PROPAGATION_REQUIRED")
.convertBodyTo(String.class)
.setHeader("operationName",simple("updateJVNumber"))
.to("cxf:bean:webservice-ws?dataFormat=PAYLOAD")
.markRollbackOnly()
.log('${body}');
The Webservice request succeeds and sends the response. But since the whole route contains a rollback call, I want to rollback the cxf request lastly sent also. Could How someone help me to achieve this?

The rollback is only for the transaction status, and the transaction manager can only rollback resources which native supports transaction. Such resources are typically JMS and JDBC resources. You cannot rollback a web service call.

Related

TomEE server is not passing web service request to the webmethod

I am new in the area of SOAP Based web services. I am using TomEE server. The server is a bit customized according to my organization's need.
Few days back, when I was trying to run the web services example from TomEE website, I was able to generate the wsdl and calling the web service by a client.
Now, when I need to use the customized version of TomEE plus (by the organization), I can see that the request does reach to the server and hence there is a log entry also but my #WebMethod is not getting executed.
Does any one has any idea about any configuration which can prevent the request from reaching to the webservice method? Is there any pointer around how can I debug further to reach out to the root cause of this issue?
Without further information about what is customized it's like fishing in the dark.
I would guess that perhaps the global web.xml or the server.xml of tomee server is changed so that some URI context mappings are not forwarded or ignored. But it's only a lucky tip.

Web Services: Rolling back a committed Transaction

Im new to webservices.
Im sending a webservice request to cxf endpoint through a camel route marked "transacted" and the response is got.
In the same transaction route, next statement throws an exception so that my Exception handler rollsback the transaction.
I can find other things in my transaction rolledback, except my webservice request response since its already commited.
Is there a way of rolling back commited webservice request?
Or is there a way of sending a rollback last webservice request ??
Please help, Stuck for 3 days on same...
Just make another webservice to undone everything done by the first webservice and call it in .onException() routine
No there is no such thing as transactions for web services. You can find information on wikipedia such as http://en.wikipedia.org/wiki/Compensating_transaction

Asynchronous Web service in Java

How to create Asynchronous web service in java using eclipse??
I have created a normal web service in Java using eclipse. I am calling an external jar, which is taking long time to complete the process. By that time my web service is getting an exception throwing timed out exception.
In order to over come the problem, decided to create asynchronous web service, but couldn,t find proper details. Please help.
no one responded to the question...
Found tentative solution for this....in order to over come the timed out exception, as soon as the request is received by the web service immediate response a unique id is sent acknowledging the request. A thread is initiated inside the web service for the corresponding request, which will take care of the process and stores the response in a table with a unique id for the request.

Axis2 multiple connection authentication issue

I have two servlets that access two corresponding Axis2 web services on the same host. One of the servlets is read-only, while the other writes to a database.
Each of the Axis2 web services uses BASIC authentication. The read-only web service uses a system account, while the write web service uses the user's credentials (which are submitted as part of a web form).
The problem I'm running into is that the servlet called second always fails authentication to its web service. For example, I can query the read-only service through it's servlet all I want, but I get a "401: Authorization Required" when I try to use the write service. If I call the write service first, I get the same error when I try to use the read-only service.
Here is how I am setting the credentials for the connections in the servlets:
Stub service = new Stub(serviceUrl);
HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
auth.setUsername(username);
auth.setPassword(password);
auth.setPreemptiveAuthentication(true);
service._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, auth);
The servlet that accesses the read-only service has this code in it's constructor. The servlet that accesses the write service has this code in it's doGet/doPost method.
It seems that the credentials for the first service called are getting cached somewhere, but I can't find where that could be. I saw a possible solution here, but I can't find where WSClientConstants.CACHED_HTTP_STATE is defined. The comments in this JIRA issue seems to imply that it's part of org.apache.axis2.transport.http.HTTPConstants but it's not there.
Specifics:
Axis version: 1.5.1
Tomcat Version: 6.0.26
Java version: 1.6.0_23
It turns out the connections to the two different services were using the same JSESSIONID. Thus, the connection to the second web service was trying to use a session authenticated for the first web service, causing the error.
My solution for this was to define an HttpClient for each service, done by the following
MultiThreadedHttpConnectionManager manager = new MuliThreadedHttpConnectionManager();
HttpClient client = new HttpClient(manager);
ConfigurationContext context = ConfigurationContextFactory.createDefaultConfigurationContext();
context.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, client);
context.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, true);
Stub service = new Stub(context, serviceUrl);
This allows both servlets to have a separate session for their corresponding services.
The important point is to create a dedicated ConfigurationContext.
I've solved in a simpler way using a default config context when creating the stub without the multithreaded connection factory
stub = new MyStub(ConfigurationContextFactory.createDefaultConfigurationContext(), myServicesUrl);

Spring Web Services: Redirect Web Service Request

I have different Spring Web Services, which are included into the context by the
Endpoint Annotation, so there are no dependencies despite the Annotation (no interface etc.). Therefore, no "context" information is present.
Now I want to chain a web service request, ie. an Endpoint is called which itself should call a web service on the same server. I can use Spring's WebServiceTemplate, however, I need the current server url for this request.
Is there any way how this url can be injected during application startup into the Endpoints? Since the Endpoints do not extend some class, there is no way to get this information anywhere inside the Endpoints, also the request parameters do not have this information (these are simple JAXB-classes, which are marshalled on request).
I believe the best option is to send the URL as part of the request.
This also enables you to dynamically change the URL to a third server later.