location = "http:
String path = new URI(location).getPath(); location = "http: if (comp.getHost() != null) { if (comp.getProtocol() != null) { location = comp.getProtocol() + ": } else { location = "http: } location += comp.getHost(); if (comp.getPort() != 80) { location += ":" + comp.getPort(); } if (comp.getPath() != null) { location += comp.getPath(); } } location += comp.getConfiguration().getMapping() + path;
    protected void overrideDefinition(Definition def) throws Exception {        PortType portType = getTargetPortType(def);        if (portType != null) {            QName[] names = (QName[]) def.getPortTypes().keySet().toArray(new QName[0]);            for (int i = 0; i < names.length; i++) {                if (!names[i].equals(portType.getQName())) {                    def.removePortType(names[i]);                }            }            names = (QName[]) def.getServices().keySet().toArray(new QName[0]);            for (int i = 0; i < names.length; i++) {                def.removeService(names[i]);            }            names = (QName[]) def.getBindings().keySet().toArray(new QName[0]);            for (int i = 0; i < names.length; i++) {                def.removeBinding(names[i]);            }            String location = getLocationURI();            if (!location.endsWith("/")) {                location += "/";            }            HttpComponent comp = (HttpComponent) getServiceUnit().getComponent();            if (comp.getConfiguration().isManaged()) {                // TODO: need to find the port of the web server                location = "http://localhost" + comp.getConfiguration().getMapping() + new URI(location).getPath();            }            if (portType.getQName().getNamespaceURI().equals(service.getNamespaceURI())) {                if (isSoap()) {                    PortTypeDecorator.decorate(                            def,                             portType,                             location,                             endpoint + "Binding",                            service.getLocalPart(),                            endpoint);                           definition = def;                } else {                    Binding binding = def.createBinding();                    binding.setPortType(portType);                    binding.setQName(new QName(service.getNamespaceURI(), endpoint + "Binding"));                    binding.setUndefined(false);                    def.addBinding(binding);                    Port port = def.createPort();                    port.setName(endpoint);                    port.setBinding(binding);                    HTTPAddress address = new HTTPAddressImpl();                    address.setLocationURI(location);                    port.addExtensibilityElement(address);                    def.addNamespace("http", "http://schemas.xmlsoap.org/wsdl/http/");                    Service svc = def.createService();                    svc.setQName(service);                    svc.addPort(port);                    def.addService(svc);                    definition = def;                }            } else {                definition = PortTypeDecorator.createImportDef(def, service.getNamespaceURI(), "porttypedef.wsdl");                PortTypeDecorator.decorate(                        definition,                         portType,                         location,                         endpoint + "Binding",                        service.getLocalPart(),                        endpoint);                   }        }    }