Code example for URLConnection

Methods: setConnectTimeoutsetReadTimeoutsetRequestProperty

                connection = url.openConnection();
            } catch (IOException e) {
                throw new CGException("Could not open the URL connection", e);
        connection.setRequestProperty("Connection", "close"); // if http is being used
        return connection;
    public static OMElement getWSDLElement(String wsdlLocation) throws CGException {
        OMNode wsdNode = getOMElementFromURI(wsdlLocation);
        OMElement wsdlElement;
        if (wsdNode instanceof OMElement) {
            wsdlElement = (OMElement) wsdNode;
            String asString = wsdlElement.toString();
        } else { 
            throw new CGException("Invalid instance type detected when parsing the WSDL '" + 
                                   wsdlLocation + "'. Required OMElement type!");
Experience pair programming with AI  Get Codota for Java