1 /** 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package org.apache.geronimo.cxf; 18 19 import java.util.Map; 20 21 import javax.wsdl.Definition; 22 import javax.wsdl.extensions.schema.SchemaReference; 23 24 import org.apache.cxf.Bus; 25 import org.apache.cxf.service.model.EndpointInfo; 26 import org.apache.cxf.transport.http.WSDLQueryHandler; 27 import org.apache.geronimo.jaxws.WSDLUtils; 28 import org.slf4j.Logger; 29 import org.slf4j.LoggerFactory; 30 31 public class GeronimoQueryHandler extends WSDLQueryHandler { 32 33 private static final Logger LOG = LoggerFactory.getLogger(GeronimoQueryHandler.class); 34 35 public GeronimoQueryHandler(Bus bus) { 36 super(bus); 37 } 38 39 protected void updateDefinition(Definition def, 40 Map<String, Definition> done, 41 Map<String, SchemaReference> doneSchemas, 42 String base, 43 EndpointInfo ei) { 44 if (done.get("") == def) { 45 String serviceName = ei.getService().getName().getLocalPart(); 46 String portName = ei.getName().getLocalPart(); 47 // remove other services and ports from wsdl 48 WSDLUtils.trimDefinition(def, serviceName, portName); 49 } 50 super.updateDefinition(def, done, doneSchemas, base, ei); 51 } 52 53 }