[JBossWS] - Re: how to secure web services in jboss?
by shashankjain
When I run the same with WSrunclient
I get the following error
javax.xml.ws.soap.SOAPFaultException: org.jboss.ws.core.CommonSOAPFaultException
: This service requires <wsse:Security>, which is missing.
at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException(SO
APFaultHelperJAXWS.java:72)
at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultExceptio
n(SOAP11BindingJAXWS.java:109)
at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPB
inding.java:579)
at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:381)
at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:300)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:16
6)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:15
2)
at $Proxy8.getName(Unknown Source)
at com.hp.standalone.NewClient.(NewClient.java:54)
at com.hp.standalone.NewClient.main(NewClient.java:94)
org.jboss.ws.core.CommonSOAPFaultException: This service requires <wsse:Security
>, which is missing.
regards
Shashank
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128233#4128233
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128233
16 years, 10 months
[JBossWS] - Re: how to secure web services in jboss?
by shashankjain
Hi,
I have configured all files for JBoss WS Security..Using JBoss WS 2.0.3 stack.
The Web service is defined as
@WebService(name = "SecureService", targetNamespace = "http://org.jboss.ws/samples/wssecurity")
@SOAPBinding(style = Style.RPC)
public interface SecureService {
/**
*
* @param name
* @return
* returns java.lang.String
*/
@WebMethod
@WebResult(partName = "return")
public String getName(
@WebParam(name = "name", partName = "name")
String name);
}
The standalone java client is
public class NewClient {
/** Creates a new instance of NewClient */
public NewClient() {
try { // Call Web Service Operation
System.setProperty("org.jboss.wsse.keyStore","c://wsse.keystore");
System.setProperty("org.jboss.wsse.keyStorePassword","jbossws");
System.setProperty("org.jboss.wsse.keyStoreType","x509v3");
System.setProperty("org.jboss.wsse.trustStore","c://wsse.truststore");
System.setProperty("org.jboss.wsse.trustStorePassword","jbossws");
System.setProperty("org.jboss.wsse.trustStoreType","x509v3");
//List handlerChain = new ArrayList();
//HandlerInfo handler=new HandlerInfo();
//handler.setHandlerClassName("WSSecurityHandlerOutbound");
//handlerChain.add(handler);
com.hp.security.client.SecureService_Service ser=new com.hp.security.client.SecureService_Service();
com.hp.security.client.SecureService port = getPort();//ser.getSecureServicePort();//getPort();
//BindingProvider bindingProvider = (BindingProvider) port;
// bindingProvider.getBinding().setHandlerChain(handlerChain);
//((StubExt)port).setConfigName("Standard WSSecurity Client");
// TODO initialize WS operation arguments here
java.lang.String name = "";
// TODO process result here
java.lang.String result = port.getName("Shashank");
System.out.println("Result = "+result);
} catch (Exception ex) {
ex.printStackTrace();
System.out.println(ex.getMessage());
// TODO handle custom exceptions here
}
}
private static com.hp.security.client.SecureService getPort() throws Exception
{
URL wsdlURL = new URL("http://127.0.0.1:8080/TestSecure/SecureService?wsdl");
URL securityURL = new File("web//META-INF//jboss-wsse-client.xml").toURL();
System.out.println(securityURL.getPath());
QName serviceName = new QName("http://org.jboss.ws/samples/wssecurity", "SecureService");
System.out.println(serviceName.toString());
Service service = Service.create(wsdlURL, serviceName);
SecureService port = (SecureService)service.getPort(SecureService.class);
//((ServiceExt)service)setSecurityConfig(securityURL.toExternalForm());
//((StubExt)port).setSecurityConfig(securityURL.toExternalForm());
//((StubExt)port).setConfigName("Standard WSSecurity Client");
Map<String, Object> reqContext =
((BindingProvider)port).getRequestContext();
reqContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
"http://127.0.0.1:8080/TestSecure/SecureService");
return port;
}
I have all the configuration files on server as well as client....
On client I have
META-INF/standard-jaxws-client-config.xml
META-INF/jboss-wsse-client.xml
META-INF/wsse.keystore
META-INF/wsse.truststore
On server I have
under
web-inf /jboss-wsse-server.xml
web-inf/wsse.keystore
web-inf/wsse.truststore
I dont see any changes as configured in samples...Still I tried everything I am unable to get it working.Pls help
I created a standalone client. I get the following errors
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/util/NotImplementedException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
at java.lang.Class.getConstructor0(Class.java:2671)
at java.lang.Class.newInstance0(Class.java:321)
at java.lang.Class.newInstance(Class.java:303)
at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:36)
at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:95)
at javax.xml.ws.spi.Provider.provider(Provider.java:83)
at javax.xml.ws.Service.(Service.java:56)
at com.hp.security.client.SecureService_Service.(SecureService_Service.java:40)
at com.hp.standalone.NewClient.(NewClient.java:44)
at com.hp.standalone.NewClient.main(NewClient.java:94)
Pls help.
Shashank
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128179#4128179
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128179
16 years, 10 months
[JBossWS] - Generating a WSDL statically (from ant?)
by EricJava
As we all know, "JBoss is cool". Using JBoss AS 4.2.2 and Seam 2.0.1, I set up a web service bean by simply annotating a class with @Stateless @WebService, and then annotated a method with @WebMethod, and presto, I have a working web service.
On the other side of things, I quickly built a client in NetBeans. All I needed to do was put in the URL of the service, and NetBeans 6 grabbed the WSDL by querying the URL, and then created the necessary artifacts. Then to use it, I just drag the web service node straight into a Java class, and there it is. It works too. Cool! Five minutes to create a web service and client.
But now I want to have more control over what is going on.
Specifically, I would like to generate the WSDL file and save it as a file, so I can put it into the build tree of the client, and the client can generate its artifacts without needing to do an HTTP request.
Second, the WSDL that is generated has a hard-coded server URL. This is not good, because the clients may end up connecting to a variety of servers; the end user should pick a server to use. How do I get the WSDL to not specify a server, and then let the client side pick the server URL?
Thanks for pointers on this.
I have looked at the Sun JAX-WS documentation, and it is sparse. I looked for books on this and didn't see any that cover J2EE 5.0.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128129#4128129
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128129
16 years, 10 months