Does QAF support mocking/virtualization of service endpoint and request/response ?
Using QAF WSstep class we can invoke live url or we can register local endpoint ?
While using QAF, you can use different mocking frameworks for service virtualization. Below are few of them:
MockServer
Mockito
WireMock
Related
There is a web-application that uses WebServiceTemplate from spring-ws to consume remote SOAP-based web-services.
I would like to create a web-service endpoint ("mocking" the remote endpoints) so that it can be used when the remote web-service is down. However, I want this "mocked" web-service to be reachable only from the environment used for development, it shouldn't be published in other environments (e.g.: Integration, Test, Production, etc.).
The current environment can be determined from a configuration-entry.
Is there a way I can publish a web-service with spring in such a way?
If you want to create this mock object only in dev environment then you should use Spring's #Conditional annotation. Here's an example.
I have a lot of proxies in WSO2 ESB that I have to securize. I need them to be securized using Username Token when deploy, instead of browsing to the dashboard and enabling it one by one.
Any help?
I guess currently, you need to use management console and do it. From the UI, it is calling a backend web service. You can automate process by automating this backend web service. This web service is exposed by following component [1]. You can use soapui or some client program to automate this web service.
[1] http://svn.wso2.org/repos/wso2/carbon/platform/trunk/components/security/org.wso2.carbon.security.mgt/
I had similar requirement, here is how I solved it
Apply Role security to WSO2 ESB Proxy using Java API
Also you can find the test case here on how to use the methods
http://svn.wso2.org/repos/wso2/tags/carbon/3.2.3/products/bps/2.1.1/modules/integration/org.wso2.bps.management.test/src/test/java/org/wso2/bps/management/SecurityTest.java
Well here how the code snippet goes to secure any proxy service with default security scenarios of WSO2 ESB. In WSO2 ESB "scenario1" signifies Usernametoken based security. Now if you wish to secure your proxy with scenario1 follow the below code snippet:
public void applySecurityOnService(String serviceName, String policyId,
String[] userGroups, String[] trustedKeyStoreArray,
String privateStore)
throws SecurityAdminServiceSecurityConfigExceptionException,
RemoteException {
ApplySecurity applySecurity;
applySecurity = new ApplySecurity();
applySecurity.setServiceName(serviceName);
applySecurity.setPolicyId("scenario" + policyId); //scenario1 i.e. for Usernametoken security policyId should be 1
applySecurity.setTrustedStores(trustedKeyStoreArray);
applySecurity.setPrivateStore(privateStore);
applySecurity.setUserGroupNames(userGroups);
stub.applySecurity(applySecurity);
_logger.info("Security Applied Successfully");
}
Here is how you may call this method from your client class:
applySecurityOnService("MyProxy", "1", new String[]{"TestRole"}, new String[]{"wso2carbon.jks"}, "wso2carbon.jks");
I have written a web service in asp.net 4.0. Now I need to invoke this web service using SOAP
protocol but not HTTP Post protocol. Can any one suggest to me how can I achieve this?
See http://social.msdn.microsoft.com/Forums/en-MY/asmxandxml/thread/5486c18a-a796-4f70-9e56-ccee572abcaf.
You have to use Windows Communication Foundation
See How to Consume a Web Service.
Can I use Java Servlet as a Rest web service?
And how to request using curl to servlet?
thank
Sure you can use a (raw) servlet to create a REST service. But that is too much work knowing that there exists a standard API for this (JAX-RS JSR-311) and many frameworks implementing it :
http://www.jboss.org/resteasy
http://cxf.apache.org/docs/jax-rs.html
http://jersey.java.net/
I've created a WebService using the JAX-WS API. This service runs without any problem using an Endpoint class.
main(String args[])
{
(...)
MyService service=new MyService();
service.setParam1("limit=100");
service.setParam2("hello");
service.setParam3("max-value=10");
Endpoint endpoint = Endpoint.create(service);
endpoint.publish("http://localhost:8090/ws");
(...)
}
now, I'd like to deploy this service in glassfish. However, as I wrote in my example, I'd like to initialize my service with a some parameters. How can I achieve this ? should I use another API ?
Many thanks in advance
OK, I finally found the answer : using javax.xml.ws.WebServiceContext was the solution .see this other answer How can I access the ServletContext from within a JAX-WS web service?