-
1. Re: Problem with WS Security encryption
peterj Jun 7, 2010 2:08 PM (in response to samb1985)Grab the free chapter 9 download (it is on web services) for JBoss in Action at http://www.manning.com/jamae, it should help you with both this issue and the other one you posted at http://community.jboss.org/message/546520#546520.
-
2. Re: Problem with WS Security encryption
samb1985 Jun 8, 2010 2:50 AM (in response to peterj)I'm already using JBoss in Action book, I follow chapter 9.4 but it don't work in my ws realized in Eclipse.
-
3. Re: Problem with WS Security encryption
peterj Jun 8, 2010 10:41 AM (in response to samb1985)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?]
-
4. Re: Problem with WS Security encryption
samb1985 Jun 8, 2010 11:25 AM (in response to peterj)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.
-
5. Re: Problem with WS Security encryption
peterj Jun 8, 2010 11:39 AM (in response to samb1985)>>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.
-
6. Re: Problem with WS Security encryption
samb1985 Jun 8, 2010 11:59 AM (in response to peterj)Ok I create a postgre-ds.xml file in folder deploy.
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>TestWSSecurityDS</jndi-name>
<connection-url>jdbc:postgresql://localhost:5432/table</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<user-name>postgres</user-name>
<password>password</password>
</local-tx-datasource>
</datasources>But when I try to use WS with client still remain: com.sun.xml.ws.client.ClientTransportException: request requires HTTP authentication: Unauthorized
-
7. Re: Problem with WS Security encryption
peterj Jun 8, 2010 12:31 PM (in response to samb1985)Did you set the logging to TRACE? What did it show?
-
8. Re: Problem with WS Security encryption
samb1985 Jun 9, 2010 3:48 AM (in response to peterj)I set in jboss-log4j.xml to trace JBossWS, but in server.log there isn't any information about org.jboss.ws.core.MessageTrace.
-
9. Re: Problem with WS Security encryption
peterj Jun 9, 2010 12:38 PM (in response to samb1985)I had actually suggested setting TRACE for org.jboss.security.auth because it is the authentication that its failing.
-
10. Re: Problem with WS Security encryption
samb1985 Jun 10, 2010 4:21 AM (in response to peterj)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).setSecurityConfig(securityURL.toExternalForm());((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
-
11. Re: Problem with WS Security encryption
jplistero Jun 11, 2010 10:05 AM (in response to samb1985)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.StubExtI 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.
thanks!
-
12. Re: Problem with WS Security encryption
samb1985 Jun 14, 2010 3:44 AM (in response to jplistero)I still searching for a solution....I don't know how solve it.
I also followed chapter 9 of JBoss in Action.
-
13. Re: Problem with WS Security encryption
jplistero Jun 14, 2010 7:53 AM (in response to samb1985)are you using netbeans ?
May be its bad imports o bad classpath to jars ...
I'am searching too.
-
14. Re: Problem with WS Security encryption
samb1985 Jun 14, 2010 10:09 AM (in response to jplistero)I'm using Eclipse.