1 10 11 package org.mule.providers.soap.xfire.transport; 12 13 import org.apache.commons.logging.Log; 14 import org.apache.commons.logging.LogFactory; 15 import org.codehaus.xfire.MessageContext; 16 import org.codehaus.xfire.service.Binding; 17 import org.codehaus.xfire.service.Service; 18 import org.codehaus.xfire.soap.Soap11; 19 import org.codehaus.xfire.soap.Soap12; 20 import org.codehaus.xfire.soap.SoapTransportHelper; 21 import org.codehaus.xfire.soap.SoapVersion; 22 import org.codehaus.xfire.transport.AbstractTransport; 23 import org.codehaus.xfire.transport.Channel; 24 import org.codehaus.xfire.transport.DefaultEndpoint; 25 import org.codehaus.xfire.wsdl11.WSDL11Transport; 26 import org.mule.providers.soap.xfire.MuleInvoker; 27 28 31 public class MuleUniversalTransport extends AbstractTransport implements WSDL11Transport 32 { 33 public static final String SOAP11_HTTP_BINDING = "http://schemas.xmlsoap.org/soap/http"; 34 public static final String SOAP12_HTTP_BINDING = "http://www.w3.org/2003/05/soap/bindings/HTTP/"; 35 public final static String HTTP_BINDING = "http://www.w3.org/2004/08/wsdl/http"; 36 public final static String HTTP_TRANSPORT_NS = "http://schemas.xmlsoap.org/soap/mule"; 37 private final static String URI_PREFIX = "urn:xfire:transport:mule:"; 38 39 42 protected transient Log logger = LogFactory.getLog(getClass()); 43 44 public MuleUniversalTransport() 45 { 46 SoapTransportHelper.createSoapTransport(this); 47 } 48 49 protected Channel createNewChannel(String uri) 50 { 51 logger.debug("Creating new channel for uri: " + uri); 52 53 MuleUniversalChannel c = new MuleUniversalChannel(uri, this); 54 c.setEndpoint(new DefaultEndpoint()); 55 56 return c; 57 } 58 59 protected String getUriPrefix() 60 { 61 return URI_PREFIX; 62 } 63 64 67 public String getServiceURL(Service service) 68 { 69 String ep = ((MuleInvoker)service.getInvoker()).getEndpoint().getEndpointURI().getAddress(); 71 return ep + "/" + service.getSimpleName(); 72 } 73 74 public String getTransportURI(Service service) 75 { 76 return HTTP_TRANSPORT_NS; 77 } 78 79 public String [] getKnownUriSchemes() 80 { 81 return new String []{"http://", "https://", "jms://", "vm://", "xmpp://", "smtp://", "tcp://"}; 82 } 83 84 public String [] getSupportedBindings() 85 { 86 return new String []{SOAP11_HTTP_BINDING, SOAP12_HTTP_BINDING}; 87 } 88 89 public String getName() 90 { 91 return "Mule"; 92 } 93 94 public Binding findBinding(MessageContext context, Service service) 95 { 96 SoapVersion version = context.getCurrentMessage().getSoapVersion(); 97 98 if (version instanceof Soap11) 99 { 100 return service.getBinding(SOAP11_HTTP_BINDING); 101 } 102 else if (version instanceof Soap12) 103 { 104 return service.getBinding(SOAP12_HTTP_BINDING); 105 } 106 107 return super.findBinding(context, service); 108 } 109 } 110 | Popular Tags |