Hi,
I'm not familiar with Rampart, but it looks like in your code below, you are 
starting in the right direction.  The general callflow is:

NotificationProducer.publish(QName,Element[])
 > SubscriptionManager.publish(NotificationMessage)
   > NotificationConsumerClient.notify(NotificationMessage[])

NotificationProducer.publish() only takes in data that will go into the 
notification body.  Also, NotificationMessage itself represents the message 
body, so from your capability classes, currently there's no way to specify 
custom header properties to send along with the message.

NotificationConsumerClient.notify() is the key method that constructs the 
actual XML payload and sends it out.  So you could try to override this method 
and add your custom WSSE header properties to the payload.

Overall, I think to include custom header properties in outgoing notification 
messages, you need to:

1) Extend all 3 classes above
2) Add additional methods that takes in customer header properties along with 
the usual body elements.
3) Have these classes call each other instead of the default Muse classes.
4) Update your new NotificationConsumerClient.notify() method to add the custom 
header properties to the xml payload.
5) From your capabilities, call your custom NotificationProducer.

-Vinh


-----Original Message-----
From: alfredo.s.g_uam_spain [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 18, 2007 8:57 AM
To: [email protected]
Subject: Re: AW: AW: axis2 deployment and configuration


I finaly did it, i configured my app to check for security but now i need to 
work with notificacions in OUTFlow but i cant  do it with muse so i think this 
could be a way of doing it but dont know if is possible.

Ussing the rampart basic samples ( the 5th ) and my test for my server i did 
this 

CODE: 

/*
 * Copyright 2004,2005 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.rampart.samples.sample05;

import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;



/*
 * Main.java
 *
 * Created on 13 de diciembre de 2007, 11:55
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */



import javax.xml.namespace.QName;

import org.w3c.dom.Element;

import org.apache.muse.util.xml.XmlUtils;
import org.apache.muse.ws.addressing.soap.SoapFault;
import org.apache.muse.ws.notification.NotificationProducer;
import org.apache.muse.ws.notification.WsnConstants;
import org.apache.muse.ws.notification.*;
import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;

import java.io.*;
import java.io.IOException;
import java.util.*;
import java.lang.String;

import java.net.InetAddress;
import java.net.URI;
import java.net.UnknownHostException;

import org.apache.muse.ws.addressing.EndpointReference;
import org.apache.muse.ws.notification.remote.NotificationProducerClient;
import org.apache.muse.ws.notification.impl.SimpleNotificationMessage;
import org.apache.muse.ws.notification.remote.NotificationConsumerClient;



/**
 *
 * @author canal
 */
    
 



public class Client {

static     String PREFIX = "myns";
    static     String NAMESPACE_URI = "http://ws.apache.org/muse/test/wsrf";;
    static QName _TOPIC_NAME = new QName(NAMESPACE_URI, "SNMP", PREFIX);


    public static void main(String[] args) throws Exception {
        
           URI address =
URI.create("http://unet.ii.uam.es:8080/broker_muse_axis_1.2/services/WsResource";);
            EndpointReference consumer = new EndpointReference(address);
            
            //
            // null filter == send all messages to consumer
            //

            //org.apache.ws.muse.test.wsrf.WsResourceProxy wsn = new 
org.apache.ws.muse.test.wsrf.WsResourceProxy(consumer);
            
            NotificationConsumerClient wsn = new 
NotificationConsumerClient(consumer);
           //wsn.setTrace(true);

            
        
         QName messageName = new QName("snmp.alfredo", "MyMessage", "msg");
         String message = "";
         String content = "hola";
         Element payload = XmlUtils.createElement(messageName, content);

         SimpleNotificationMessage masaje = new SimpleNotificationMessage();
         masaje.setTopic(_TOPIC_NAME);
         masaje.addMessageContent(payload);
         
         System.out.println(masaje.toString());

        // Element [] maaa = new Element[1];
         
         //maaa[0]=masaje.toXML();
         //System.out.println(maaa);
         
         
//      try{
         // wsn.notify((NotificationMessage)masaje);
          //wsn.notify(maaa);
//      }
//      catch (SoapFault e){ e.printStackTrace();}
  
        
        ConfigurationContext ctx =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(args[1],
args[1] + "/conf/axis2.xml");
        
        ServiceClient client = new ServiceClient(ctx, null);
        Options options = new Options();
       
options.setAction("http://docs.oasis-open.org/wsn/bw-2/NotificationConsumer/NotifyRequest";);
        options.setTo(new
EndpointReference("http://unet.ii.uam.es/broker_muse_axis_1.2/services/WsResource";));
        client.setOptions(options);
        
        OMElement response = client.sendReceive((OMElement)masaje.toXML());
        
        System.out.println(response);
        
    }

    
}
// 

but cant get it working


beil wrote:
> 
> Hi,
> 
> I don't know if there was or is a change in the way Muse send messages 
> out?
> 
> As long as Muse uses http connectors to write outgoing messages, there 
> will be no way to use the Rampart module of Axis2. This will be only 
> possible if Muse sends the outgoing messages trough Axis2 and uses the
> Axis2 engine.
> 
> To use WSSE in the outgoing direction you have to setup the WSSE 
> header yourself and overwrite the Muse classes to allow the addition 
> of the header parameter.
> 
> Hopes this helps.
> 
> Matthias
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: alfredo.s.g_uam_spain [mailto:[EMAIL PROTECTED]
> Gesendet: Dienstag, 11. Dezember 2007 11:48
> An: [email protected]
> Betreff: RE: AW: axis2 deployment and configuration
> 
> 
> Im now trying to do this task and i found out that for sending notifys 
> with muse is a little more complicated to add the ws-security.
> Has someone made it and can give me some guidelines to force muse to 
> use axis outgoing or to force muse to use ws-security somehow?
> for incoming soap messages with ws-security is much easier ¿isnt it?
> 
> thanks
> 
> 
> 
> Daniel Jemiolo wrote:
>> 
>> I recall a number of other users having success setting up the 
>> WS-Security module in Axis2 (w/ Muse). In fact, I think Matthias (the 
>> other participant in this thread) is one of them. I don't think 
>> you'll run into any issues, but if you do, please report them so we 
>> can fix Muse and allow the WS-Security module to work as expected.
>> 
>> Dan
>> 
> --
> View this message in context:
> http://www.nabble.com/axis2-deployment-and-configuration-tp9736934p142
> 71129.html Sent from the Muse User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

--
View this message in context: 
http://www.nabble.com/axis2-deployment-and-configuration-tp9736934p14400893.html
Sent from the Muse User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to