This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
WSDLs with Governance API
Note
Please follow the documentation on how to create a client-side connection to use the Governance API before following these examples.
Similar to the methods in the Service
and ServiceManager
class, you can use the methods in the Wsdl
and WsdlManager
classes to manage WSDLs. See Services with Governance API.
import org.wso2.carbon.governance.api.wsdls.WsdlFilter; import org.wso2.carbon.governance.api.wsdls.WsdlManager; import org.wso2.carbon.governance.api.wsdls.dataobjects.Wsdl; // creating the wsdl manager with governanceRegistry WsdlManager wsdlManager = new WsdlManager(governanceRegistry); // creating and adding the a new wsdl. Wsdl wsdl = wsdlManager.newWsdl("http://www.example.com/wsdl-url.wsdl"); wsdl.addAttribute("creator", "xxx"); wsdl.addAttribute("version", "0.01"); wsdlManager.addWsdl(wsdl); // updating the wsdl. wsdl.addAttribute("version", "0.02"); wsdlManager.updateWsdl(wsdl); // get the attached schemas Schema[] schemas = wsdl.getAttachedSchemas(); // get the endpoints Endpoint[] endpoints = wsdl.getAttachedEndpoints(); // get the OM from the wsdl OMElement wsdlContent = wsdl.getWsdlElement(); // get wsdls with attribute "creator" == "xxx" Wsdl[] wsdls = wsdlManager.findWsdls(new WsdlFilter() { public boolean matches(Wsdl wsdl) throws GovernanceException { String attributeVal = wsdl.getAttribute("creator"); return (attributeVal != null && attributeVal.equals("xxx")); } });