I'm already using JBoss in Action book, I follow chapter 9.4 but it don't work in my ws realized in Eclipse.
Do not use Eclipse to build your web service for you - I think that Eclipse bases its web services on Axis.
Did you install JBoss Tools into Eclipse? You could use that to build your web services (I think I did that once).
Have you built an run target 07 in project ch09? That builds a secured web client but uses the properties file (rather than a database) for login. Target 05 in ch08 builds a messaging client using the database for login, so you could use that as an example of switching the web service to using the database for login.
Also, try setting the log to TRACE for org.jboss.security.auth, that should give you some details of exactly what is going on. (From what you have provided I cannot tell if your code is incorrect (you did not provide the code), or if your database is not set up correctly. The trace might provide some insight into that.)
[Shoot, I wrote this based on your other question. But did you try traget 09 thru 12 in project ch09?]
I create POJO Web Service with a simple java class plus annotation, under Eclipse IDE. To test WS I use Eclipse Wizard to create test WS client specifyng JBossWS runtime and not Axis.
Yes I installed JBoss Tools.
Secured web service with file properties for login work well. With database authentication I forget to define the DataSource on JBoss AS, in which xml should I define it ?
For encryption test I follow chapter 9.5 of the book until 9.5.3 but the client don't work as written above.
>>Secured web service with file properties for login work well. With database authentication I forget to define the DataSource on JBoss AS, in which xml should I define it ?
Yes, you need a *-ds.xml file to define the database. It should use the same JNDI name (TestWSSecurityDS) that you used in login-config.xml.
Ok I create a postgre-ds.xml file in folder deploy.
<?xml version="1.0" encoding="UTF-8"?>
But when I try to use WS with client still remain: com.sun.xml.ws.client.ClientTransportException: request requires HTTP authentication: Unauthorized
Did you set the logging to TRACE? What did it show?
I set in jboss-log4j.xml to trace JBossWS, but in server.log there isn't any information about org.jboss.ws.core.MessageTrace.
I had actually suggested setting TRACE for org.jboss.security.auth because it is the authentication that its failing.
Thanks a lot !
Tracing security.auth I note that the issue was the syntax of second sql statement.
I correct it with: select userroles,'Roles' from "public"."UserRoles" where username = ? and now authentication with postgre sql database works well.
Now still remain the other problem of encryption in first post of this discussion.
The Web Service security implemented is as the chapter 9.5 (until 9.5.3 included of JBoss in Action), but I use a pojo java as client to consume and test the WS. I created the pojo with Eclipse Wizard to create a Web Service Client with JBossWS runtime (not Axis).
Then I add to client java all files indicated in chapter 9.5.3, but when I run it throw an exception that indicate wsse security required as it don't know the descriptor in META-INF.
So I found a discussion that indicate to use in client the follow code:
URL securityURL = Main.class.getResource("META-INF/jboss-wsse-client.xml");
((StubExt) port1).setConfigName("Standard WSSecurity Client", "META-INF/standard-jaxws-client-config.xml");
But when I run it:
Exception in thread "main" java.lang.ClassCastException: $Proxy23 cannot be cast to org.jboss.ws.core.StubExt
do you find a solution ?
I have the same error, similar ...11-jun-2010 10:50:20 com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegatesINFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegatejava.lang.ClassCastException: $Proxy49 cannot be cast to org.jboss.ws.core.StubExt
I have to sing de the soap message
I ' am follow the free chapter 9 of jboss in action, and not mention modifications in the Client class if you need ws-security.
I still searching for a solution....I don't know how solve it.
I also followed chapter 9 of JBoss in Action.
are you using netbeans ?
May be its bad imports o bad classpath to jars ...
I'am searching too.
I'm using Eclipse.