{
//create Subscription
Context initialContext = new InitialContext( );
//System.out.println("get RemoteResourceSubscriptionHome " + RemoteSubscriptionHome.HOME_LOCATION);
SubscriptionHome sH = (SubscriptionHome) initialContext.lookup( SubscriptionHome.HOME_LOCATION );
//create NotifyTO EPR
EndpointReference notifyto = null;
if ( body.getSubscribe( ).getDelivery( ).getNotifyTo( ) != null )
{
notifyto = new XmlBeansEndpointReference( body.getSubscribe( ).getDelivery( ).getNotifyTo( ) );
}
//create EndTO EPR
EndpointReference endto = null;
if ( body.getSubscribe( ).getEndTo( ) != null )
{
endto = new XmlBeansEndpointReference( body.getSubscribe( ).getEndTo( ) );
}
Filter filter = FilterFactory.createFilter( body.getSubscribe( ).getFilter( ) );
Calendar expires = (Calendar) body.getSubscribe( ).getExpires( );
//getDeliveryMode
java.net.URI delivery = null;
if ( body.getSubscribe( ).getDelivery( ).getMode( ) != null )
{
delivery = new java.net.URI( body.getSubscribe( ).getDelivery( ).getMode( ) );
}
Subscription subscription = sH.create( filter, expires, delivery );
subscription.setNotificationConsumer( new ForwardConsumer( notifyto ) );
subscription.setSubscriptionEndConsumer( new ForwardEndConsumer( endto ) );
//check if topic expression
// if(filter instanceof TopicFilter == true){