def __readWsdlWithIdooxFactory(url, importWsdlDocuments=1): from com.idoox.wsdl.factory import WSDLFactoryImpl from com.idoox.wsdl.util import XmlUtil from org.idoox.transport import TransportMethod wsdlfactoryIdox = WSDLFactoryImpl() reader = wsdlfactoryIdox.newWSDLReader() if importWsdlDocuments == 1: reader.setFeature('javax.wsdl.importDocuments', Boolean.TRUE) else: reader.setFeature('javax.wsdl.importDocuments', Boolean.FALSE) uri = URI(url) url = uri.toURL() urlStr = url.toString() connectionProperties = HashMap(7) endpoint = XmlUtil.createEndpoint(None, urlStr) connection = endpoint.newConnection(TransportMethod.GET, connectionProperties) inputMessage = connection.getInputMessage() statusCode = inputMessage.getStatusCode() endpoint = XmlUtil.checkRedirectedUri(connection, endpoint) if statusCode >= 400: raise WSDLException( 'INVALID_WSDL', 'Cannot get WSDL from URL ' + str(endpoint.toExternalForm()) + ' (status code ' + str(statusCode) + ')') wsdlData = XmlHelper.prettyPrintXml( XmlHelper.loadRootElement(inputMessage)) logger.debug('Got wsdl content:\n', wsdlData) definition = reader.readWSDL(urlStr) return wsdlData, definition
def __readWsdlWithIdooxFactory(url, importWsdlDocuments = 1): from com.idoox.wsdl.factory import WSDLFactoryImpl from com.idoox.wsdl.util import XmlUtil from org.idoox.transport import TransportMethod wsdlfactoryIdox = WSDLFactoryImpl() reader = wsdlfactoryIdox.newWSDLReader() if importWsdlDocuments == 1: reader.setFeature('javax.wsdl.importDocuments', Boolean.TRUE) else: reader.setFeature('javax.wsdl.importDocuments', Boolean.FALSE) uri = URI(url) url = uri.toURL() urlStr = url.toString() connectionProperties = HashMap(7) endpoint = XmlUtil.createEndpoint(None, urlStr) connection = endpoint.newConnection(TransportMethod.GET, connectionProperties) inputMessage = connection.getInputMessage() statusCode = inputMessage.getStatusCode() endpoint = XmlUtil.checkRedirectedUri(connection, endpoint) if statusCode >= 400: raise WSDLException('INVALID_WSDL', 'Cannot get WSDL from URL ' + str(endpoint.toExternalForm()) + ' (status code ' + str(statusCode) + ')') wsdlData = XmlHelper.prettyPrintXml(XmlHelper.loadRootElement(inputMessage)) logger.debug('Got wsdl content:\n', wsdlData) definition = reader.readWSDL(urlStr) return wsdlData, definition
def __readWsdlWithIBMFactory(wsdlData, importWsdlDocuments=1): if wsdlData == None: raise WSDLException('WSDL Content is Null') else: from com.ibm.wsdl.factory import WSDLFactoryImpl wsdlfactoryIdox = WSDLFactoryImpl() reader = wsdlfactoryIdox.newWSDLReader() if importWsdlDocuments == 1: reader.setFeature('javax.wsdl.importDocuments', Boolean.TRUE) else: reader.setFeature('javax.wsdl.importDocuments', Boolean.FALSE) wsdlData = String(wsdlData.strip()) arr = wsdlData.getBytes() stream = ByteArrayInputStream(arr) inSrc = InputSource(stream) defintion = reader.readWSDL(None, inSrc) return defintion
def __readWsdlWithIBMFactory(wsdlData, importWsdlDocuments = 1): if wsdlData == None: raise WSDLException('WSDL Content is Null') else: from com.ibm.wsdl.factory import WSDLFactoryImpl wsdlfactoryIdox = WSDLFactoryImpl() reader = wsdlfactoryIdox.newWSDLReader() if importWsdlDocuments == 1: reader.setFeature('javax.wsdl.importDocuments', Boolean.TRUE) else: reader.setFeature('javax.wsdl.importDocuments', Boolean.FALSE) wsdlData = String(wsdlData.strip()) arr = wsdlData.getBytes() stream = ByteArrayInputStream(arr) inSrc = InputSource(stream) defintion = reader.readWSDL(None, inSrc) return defintion