1 17 package org.apache.servicemix.http; 18 19 import javax.wsdl.extensions.ExtensibilityElement; 20 import javax.wsdl.extensions.http.HTTPAddress; 21 import javax.wsdl.extensions.http.HTTPBinding; 22 import javax.wsdl.extensions.soap.SOAPAddress; 23 import javax.wsdl.extensions.soap.SOAPBinding; 24 25 import org.apache.servicemix.common.BaseComponent; 26 import org.apache.servicemix.common.Endpoint; 27 import org.apache.servicemix.common.wsdl1.AbstractWsdl1Deployer; 28 import org.apache.servicemix.common.wsdl1.JbiEndpoint; 29 30 34 public class HttpWsdl1Deployer extends AbstractWsdl1Deployer { 35 36 public HttpWsdl1Deployer(BaseComponent component) { 37 super(component); 38 } 39 40 43 protected Endpoint createEndpoint(ExtensibilityElement portElement, 44 ExtensibilityElement bindingElement, 45 JbiEndpoint jbiEndpoint) { 46 if (jbiEndpoint == null) { 47 return null; 48 } 49 if (portElement instanceof HTTPAddress && bindingElement instanceof HTTPBinding) { 50 if (!"POST".equals(((HTTPBinding) bindingElement).getVerb())) { 51 throw new UnsupportedOperationException (((HTTPBinding) bindingElement).getVerb() + " not supported"); 52 } 53 HttpEndpoint endpoint = new HttpEndpoint(); 54 endpoint.setSoap(false); 55 endpoint.setRole(jbiEndpoint.getRole()); 56 endpoint.setDefaultMep(jbiEndpoint.getDefaultMep()); 57 endpoint.setDefaultOperation(jbiEndpoint.getDefaultOperation()); 58 endpoint.setLocationURI(((HTTPAddress) portElement).getLocationURI()); 59 endpoint.setBinding(bindingElement); 60 return endpoint; 61 } else if (portElement instanceof SOAPAddress && bindingElement instanceof SOAPBinding) { 62 HttpEndpoint endpoint = new HttpEndpoint(); 63 endpoint.setSoap(true); 64 endpoint.setRole(jbiEndpoint.getRole()); 65 endpoint.setDefaultMep(jbiEndpoint.getDefaultMep()); 66 endpoint.setDefaultOperation(jbiEndpoint.getDefaultOperation()); 67 endpoint.setLocationURI(((SOAPAddress) portElement).getLocationURI()); 68 endpoint.setBinding(bindingElement); 69 return endpoint; 70 } else { 71 return null; 72 } 73 } 74 75 78 protected boolean filterPortElement(ExtensibilityElement element) { 79 if (element instanceof HTTPAddress) { 80 return true; 81 } 82 if (element instanceof SOAPAddress) { 83 String uri = ((SOAPAddress) element).getLocationURI(); 84 if (uri.startsWith("http://") || uri.startsWith("https://")) { 85 return true; 86 } 87 } 88 return false; 89 } 90 91 94 protected boolean filterBindingElement(ExtensibilityElement element) { 95 return element instanceof HTTPBinding || element instanceof SOAPBinding; 96 } 97 98 } 99 | Popular Tags |