[JBossWS] - Using WSSecurityHandlerOutbound in a DII client
by acxjbertr
I've got a DII client coded up and everything works as expected. However, now I am trying to test my WS-Security setup. My JBoss server (4.0.4 with JBossWS 1.0.2) requires WS-Security signatures on all incoming SOAP messages. It accurately denies my invocations if I don't sign my messages, but now I want to make it accept my messages. I have read elsewhere that I need to configure a handler to sign my outgoing messages. I have tried to do this in the code below:
package com.mycompany.client.test.ws;
|
| import ...
|
| public class WSTestCase extends TestCase {
| private String testDescription = null;
|
| // Possible Outputs
| private String exceptionThrown = null;
|
| public void testPlanStep1() throws MalformedURLException, ServiceException {
| go(getInput());
| }
|
| private void go(Echo request) throws ServiceException, MalformedURLException {
| try {
| ClientStuffEndpoint clientStuffEndpoint = getEndpoint();
| EchoResponse echoResponse = clientStuffEndpoint.echo(request);
|
| ClientStuffReply clientStuffReply = echoResponse.getResult();
| System.out.println(clientStuffReply.getAuditId());
| } catch (Exception e) {
| e.printStackTrace();
| assertTrue(false);
| }
| }
|
| private ClientStuffEndpoint getEndpoint() throws MalformedURLException, ServiceException, InvalidRequestException, SystemUnavailableException, RemoteException {
| ServiceFactoryImpl factory = new ServiceFactoryImpl();
| ClassLoader cl = Thread.currentThread().getContextClassLoader();
| URL wsdlLocation = cl.getResource("wsdl/ClientStuff.wsdl");
| URL mappingLocation = cl.getResource("client-mapping.xml");
| QName serviceName = new QName("http://client.mycompany.com/clientstuff/1.0", "ClientStuff");
| ServiceImpl service = (ServiceImpl) factory.createService(wsdlLocation, serviceName, mappingLocation);
| setupHandlerRegistry(service);
| return (ClientStuffEndpoint) service.getPort(ClientStuffEndpoint.class);
| }
|
| private Echo getInput() {
| Echo echoInput = new Echo();
| ClientStuffRequest clientStuffRequest = new ClientStuffRequest();
| clientStuffRequest.setAuditId("eggie");
| echoInput.setClientStuffRequest_1(clientStuffRequest);
|
| return echoInput;
| }
|
| private void setupHandlerRegistry(ServiceExt service) {
| List<HandlerInfo> clientHandlerChain = new ArrayList<HandlerInfo>();
| HandlerInfo handler = new HandlerInfo();
| handler.setHandlerClass(WSSecurityHandlerOutbound.class);
| clientHandlerChain.add(handler);
| QName securityName = new QName(org.jboss.ws.wsse.WSS_SOAP_NS, "ClientStuffEndpointPort");
| service.getDynamicHandlerRegistry().setHandlerChain(securityName, clientHandlerChain);
| }
| }
|
Unfortunately my messages still aren't being signed.
I was unsure about what to put on the line QName securityName = new QName(org.jboss.ws.wsse.WSS_SOAP_NS, "ClientStuffEndpointPort"); and I think this might be the cause of the problem. Can anyone advise me of the correct values here? I have tried several different values from the org.jboss.ws.wsse package.
Any help would be greatly appreciated. Thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3962009#3962009
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3962009
18 years, 5 months
[JBoss Seam] - Master detail , conversation....
by angelogalvao
That's something that i'm not understanding about seam, conversation etc...
I have 2 entity beans, for example, with a OnetoMany relationship:
Client and Products:
Client{
....
private Set products;
....
}
and in my Session bean i got to methods:
@Name("clientManager")
@Stateful
public ClientManagerBean implements ClientManager{
...
@In(required=false)
private Client client;
@In(required=false)
private Product product;
public void addClient(){
entityManager.persist(client);
}
public void addProductToClient(){
client.addProduct(product); // add to the set
}
....
}
in the method addProductToClient i just put the product in the collection, but in the next submit the product it's not there anymore...
I think this is the reason to the conversation state...
What i dont understand, what i have to do?
thanks!!!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3962006#3962006
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3962006
18 years, 5 months
[JBoss Messaging] - Re: Consumed messages redelivered ?
by joellindheimer
============================
Lessons Learned after a Plethora of Testing
============================
I have done a lot more testing as well as checked with Juergen Hoeller to sync up in findings within his community. Here is what I have found:
1) Using anything but the XA ConectionFactory bound specifically to ?java:/JmsXA? is problematic with JBoss 4.X server with Messaging 1.0.
a. Do NOT use ?/XAConnectionFactory? as we found problems in several scenarios.
b. Do NOT use any custom configured XA ConnectionFactory for the reasons Tim mentioned.
2) When using a JMS Consumer you MUST always get a new JMS Connection; do NOT pool the Connection. If you use an existing Connection the it will not get enlisted into the Global Transaction.
Conclusion:
If you follow these two rules you can safely use JBoss Messaging 1.0 within the context of a global transaction and get the expected behavior thereof.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3962005#3962005
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3962005
18 years, 5 months
[JBoss Messaging] - Re: dynamic create queue
by timfox
This explains how to call an MBean:
http://wiki.jboss.org/wiki/Wiki.jsp?page=HowDoIGetRemoteAccessToMyMBean
The ServerPeer object name can be found by looking at the jmx-console where all the MBeans are listed (jboss.messaging:service=ServerPeer).
You can also find this out by looking a the serverpeer MBean config in messaging-service.xml:
|
| <mbean code="org.jboss.jms.server.ServerPeer"
| name="jboss.messaging:service=ServerPeer"
| xmbean-dd="xmdesc/ServerPeer-xmbean.xml">
|
| <constructor>
| <!-- ServerPeerID -->
| <arg type="java.lang.String" value="server.0" />
| <!-- DefaultQueueJNDIContext -->
| <arg type="java.lang.String" value="/queue" />
| <!-- DefaultTopicJNDIContext -->
| <arg type="java.lang.String" value="/topic" />
| </constructor>
|
| <depends optional-attribute-name="PersistenceManager">jboss.messaging:service=PersistenceManager</depends>
| <depends optional-attribute-name="MessageStore">jboss.messaging:service=MessageStore</depends>
| <depends optional-attribute-name="ChannelMapper">jboss.messaging:service=ChannelMapper</depends>
|
| <!-- Set to -1 to completely disable client leasing -->
| <attribute name="SecurityDomain">java:/jaas/messaging</attribute>
| <attribute name="DefaultSecurityConfig">
| <security>
| <role name="guest" read="true" write="true" create="true"/>
| </security>
| </attribute>
| </mbean>
|
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3962003#3962003
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3962003
18 years, 5 months