[ 
https://issues.apache.org/jira/browse/AXIS2-2451?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nencho Lupanov updated AXIS2-2451:
----------------------------------

    Attachment: PolicyReference.diff

Functionality added:

public OMElement getRefencedPolicyContent(String uri){
        OMElement documentElement = null;
        
        try{                                    
                
                //create java.net URL pointing to remote resource               
        
                        URL url = new URL(uri);
                        URLConnection connection = url.openConnection();
                        connection.setDoInput(true);
                        
                        //create stax parser with the url content
                        XMLStreamReader parser = XMLInputFactory.newInstance().
                                                                 
createXMLStreamReader(connection.getInputStream()); 
                        
                //get the root element (in this case the envelope)
                        StAXOMBuilder builder = new StAXOMBuilder(parser); 
                        documentElement = builder.getDocumentElement(); 
                        
        }catch(XMLStreamException se){                          
                throw new RuntimeException("Bad policy content: " + uri);
        }catch(MalformedURLException mue){              
                throw new RuntimeException("Malformed uri: " + uri);
        }catch(IOException ioe){        
                throw new RuntimeException("Cannot reach remote resource: " + 
uri);
        }       
                
                return documentElement;
    }
    
    
    
    public Policy getRemoteReferencedPolicy(String uri) {
        Policy policy = null;
        
        //extract the remote resource contents
        OMElement policyElement = getRefencedPolicyContent(uri);
        
        //call the policy engine with already extracted content
        policy = PolicyEngine.getPolicy(policyElement);
        
                return policy;
    }

> WS Policy Attachments for services.xml
> --------------------------------------
>
>                 Key: AXIS2-2451
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2451
>             Project: Axis 2.0 (Axis2)
>          Issue Type: New Feature
>            Reporter: Nencho Lupanov
>            Assignee: Sanka Samaranayake
>         Attachments: PolicyReference.diff, PolicyReference.diff
>
>
> Axis2 does not recognize policy references in services.xml.
> Implementation should alow usage such:
>  <wsp:PolicyReference
>      URI="http://localhost:53307/policy.xml#UTOverTransport"; />
> </wsp:PolicyAttachment>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to