private EndpointReferenceType buildSubscriptionEPR( Subscription subscription )
throws ClassNotFoundException,
InstantiationException,
IllegalAccessException
{
EndpointReferenceType returnEPR = EndpointReferenceType.Factory.newInstance( );
if ( subscription != null )
{
// Find the subscription WSResource in the registry
WSResource resource =
RegistrationManagerFactory.getManager( ).find( SUBSCRIPTION_MANAGER_SERVICE,
subscription.getSubscriptionId( ) );
if ( resource != null )
{
EndpointReference subscriptionEPR = resource.getEndpointReference( );
AttributedURI address = returnEPR.addNewAddress( );
address.setStringValue( subscriptionEPR.getAddress( ).toString( ) );
// Setup the port type
AttributedQName portType = returnEPR.addNewPortType( );
portType.setQNameValue( QName.valueOf( subscriptionEPR.getPortType( ).toString( ) ) );
ServiceNameType snt = returnEPR.addNewServiceName( );
snt.setQNameValue( QName.valueOf( subscriptionEPR.getServiceName( ).toString( ) ) );
// Setup the resource properties.
ReferencePropertiesType props = returnEPR.addNewReferenceProperties( );
MessageElement[] propsArray = subscriptionEPR.getProperties( ).get_any( );
if ( propsArray != null )
{
for ( int i = 0; i < propsArray.length; i++ )