[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
18 years, 2 months
[Installation, Configuration & DEPLOYMENT] - Re: EJB JAR inside EAR
by jaikiran
OK, a bit of digging, led me to this http://support.bea.com/application_content/product_portlets/support_patte.... Going by what is mentioned in that article, i guess, the problem you are having is related to a programming error rather than a classloader issue. Here's the relevant part from that article (you might want to go through that complete article as it recommends some programming techniques to avoid these issues with weblogic driver):
anonymous wrote : Since the WebLogic driver uses WebLogic wrapper classes, no typecasting is required when using this driver. If typecasting is used, ClassCastException will be thrown
|
| The actual exception that occurs is on the line
|
| os = ((OracleThinBlob)myRegularBlob).getBinaryOutputStream();"
|
| To resolve this issue, the above code needs to be modified.
| Replace
| os = ((OracleThinBlob)myRegularBlob).getBinaryOutputStream();
| with
| os = myRegularBlob.setBinaryStream(1);
>From the code that you posted earlier in this thread, i do see a similar thing being done in the code:
| Blob blob = resultset.getBlob("xml");
| if(blob != null)
| {
| OutputStream outputstream = ((OracleBlob)blob).getBinaryOutputStream();
I guess, this line is causing the ClasscastException. To fix this, i guess a code change will be required. Since you don't have access to the code, you might have to bring this to the notice of your developers.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128178#4128178
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128178
18 years, 2 months