Please somebody help me to find some sample examples for parsing for wsdl url using wsdl4j API.
Thanks
Try like this;
public Definition readWSDLFile() throws WSDLException { WSDLReader reader = getWsdlFactoryInstance().newWSDLReader(); // switch off the verbose mode reader.setFeature(JAVAX_WSDL_VERBOSE_MODE, false); reader.setFeature("javax.wsdl.importDocuments", true); Definition wsdlDefinition; if (log.isDebugEnabled()) { log.debug("Reading the WSDL. Base uri is " + baseURI); } wsdlDefinition = reader.readWSDL(baseURI); return wsdlDefinition; }
Using the Definition you can access the operation, service objects.. to access a service address location;
private void setServiceDefinition(Definition definition) throws Exception { Map serviceMap = definition.getAllServices(); Iterator serviceItr = serviceMap.entrySet().iterator(); URL addressURI = null; try { while (serviceItr.hasNext()) { Map.Entry svcEntry = (Map.Entry) serviceItr.next(); Service svc = (Service) svcEntry.getValue(); Map portMap = svc.getPorts(); Iterator portItr = portMap.entrySet().iterator(); while (portItr.hasNext()) { Map.Entry portEntry = (Map.Entry) portItr.next(); Port port = (Port) portEntry.getValue(); ExtensibilityElement extensibilityElement = (ExtensibilityElement) port.getExtensibilityElements() .get(0); addressURI = new URL(getAddressUrl(extensibilityElement)); } }
Here is a sample i have written, May be useful to you.
Copyright © 2021 Jogjafile Inc.
Try like this;
Using the Definition you can access the operation, service objects.. to access a service address location;
Here is a sample i have written, May be useful to you.