1 23 24 package com.sun.enterprise.webservice; 25 26 import java.util.Set ; 27 import java.util.Iterator ; 28 29 import java.util.logging.Level ; 30 import javax.xml.ws.BindingProvider; 31 import javax.xml.ws.Binding; 32 import javax.xml.ws.soap.SOAPBinding; 33 import javax.xml.ws.Dispatch; 34 35 import com.sun.enterprise.deployment.ServiceReferenceDescriptor; 36 import com.sun.enterprise.deployment.ServiceRefPortInfo; 37 import com.sun.enterprise.webservice.spi.InvInterfaceCreationListener; 38 import com.sun.enterprise.deployment.NameValuePairDescriptor; 39 40 45 public class InvInterfaceCreationListenerImpl implements InvInterfaceCreationListener { 46 47 ServiceReferenceDescriptor ref; 48 49 50 public InvInterfaceCreationListenerImpl(ServiceReferenceDescriptor ref) { 51 this.ref = ref; 52 } 53 54 59 public <T> void portCreated(T port, Class <T> serviceEndpointInterface) { 60 61 ServiceRefPortInfo portInfo = ref.getPortInfoBySEI(serviceEndpointInterface.getName()); 62 if (portInfo!=null) { 63 BindingProvider bProv = (BindingProvider) port; 65 boolean mtomEnabled = false; 66 if(portInfo.getMtomEnabled() != null && 67 (new Boolean (portInfo.getMtomEnabled())).booleanValue()) { 68 mtomEnabled = true; 69 } 70 if (mtomEnabled) { 71 Binding bType = bProv.getBinding(); 72 if(SOAPBinding.class.isAssignableFrom(bType.getClass())) { 74 ((SOAPBinding)bType).setMTOMEnabled(true); 75 } else { 76 WsUtil.getDefaultLogger().log(Level.SEVERE, 77 WsUtil.getDefaultStringManager().getLocalString("serviceref.invalidmtom", 78 "MTOM is valid only for SOAP Bindings; Ignoring Enable-MTOM for port {0}", 79 new Object [] {serviceEndpointInterface})); 80 } 81 } 82 83 Set properties = portInfo.getStubProperties(); 85 for(Iterator iter = properties.iterator(); iter.hasNext();) { 86 NameValuePairDescriptor next = (NameValuePairDescriptor) 87 iter.next(); 88 bProv.getRequestContext().put(next.getName(), next.getValue()); 89 } 90 } 91 } 92 93 100 public <T> void dispatchCreated(Dispatch<T> dispatch, Class <T> serviceEndpointInterface) { 101 102 } 103 104 } 105 | Popular Tags |