ohair@286: /* mkos@384: * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ohair@286: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ohair@286: * ohair@286: * This code is free software; you can redistribute it and/or modify it ohair@286: * under the terms of the GNU General Public License version 2 only, as ohair@286: * published by the Free Software Foundation. Oracle designates this ohair@286: * particular file as subject to the "Classpath" exception as provided ohair@286: * by Oracle in the LICENSE file that accompanied this code. ohair@286: * ohair@286: * This code is distributed in the hope that it will be useful, but WITHOUT ohair@286: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ohair@286: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ohair@286: * version 2 for more details (a copy is included in the LICENSE file that ohair@286: * accompanied this code). ohair@286: * ohair@286: * You should have received a copy of the GNU General Public License version ohair@286: * 2 along with this work; if not, write to the Free Software Foundation, ohair@286: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ohair@286: * ohair@286: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@286: * or visit www.oracle.com if you need additional information or have any ohair@286: * questions. ohair@286: */ ohair@286: ohair@286: package com.sun.xml.internal.ws.client; ohair@286: ohair@286: import com.sun.istack.internal.NotNull; ohair@286: import com.sun.xml.internal.ws.api.model.SEIModel; ohair@286: import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort; ohair@286: import com.sun.xml.internal.ws.binding.BindingImpl; ohair@286: import com.sun.xml.internal.ws.binding.SOAPBindingImpl; ohair@286: import com.sun.xml.internal.ws.binding.WebServiceFeatureList; ohair@286: import com.sun.xml.internal.ws.model.SOAPSEIModel; ohair@286: mkos@384: import javax.xml.ws.WebServiceFeature; mkos@384: ohair@286: /** ohair@286: * {@link PortInfo} that has {@link SEIModel}. ohair@286: * ohair@286: * This object is created statically when {@link WSServiceDelegate} is created ohair@286: * with an service interface. ohair@286: * ohair@286: * NOTE: Made this class public so that Dispatch instances derived from a ohair@286: * 'parent' SEI-based port instance (generally for sending protocol ohair@286: * messages or request retries) can still know what the parent's SEI was. ohair@286: * ohair@286: * @author Kohsuke Kawaguchi ohair@286: */ ohair@286: public final class SEIPortInfo extends PortInfo { mkos@384: ohair@286: public final Class sei; mkos@384: ohair@286: /** ohair@286: * Model of {@link #sei}. ohair@286: */ ohair@286: public final SOAPSEIModel model; ohair@286: ohair@286: public SEIPortInfo(WSServiceDelegate owner, Class sei, SOAPSEIModel model, @NotNull WSDLPort portModel) { mkos@384: super(owner, portModel); ohair@286: this.sei = sei; ohair@286: this.model = model; mkos@384: assert sei != null && model != null; mkos@384: } mkos@384: mkos@384: @Override mkos@384: public BindingImpl createBinding(WebServiceFeature[] webServiceFeatures, Class portInterface) { mkos@384: BindingImpl binding = super.createBinding(webServiceFeatures, portInterface); mkos@384: return setKnownHeaders(binding); ohair@286: } ohair@286: ohair@286: public BindingImpl createBinding(WebServiceFeatureList webServiceFeatures, Class portInterface) { ohair@286: // not to pass in (BindingImpl) model.getWSBinding() mkos@384: BindingImpl binding = super.createBinding(webServiceFeatures, portInterface, null); mkos@384: return setKnownHeaders(binding); mkos@384: } mkos@384: mkos@384: private BindingImpl setKnownHeaders(BindingImpl binding) { mkos@384: if (binding instanceof SOAPBindingImpl) { mkos@384: ((SOAPBindingImpl) binding).setPortKnownHeaders(model.getKnownHeaders()); ohair@286: } mkos@384: return binding; ohair@286: } ohair@286: }