title: Deploy Metro Web Service with both SOAP11 and SOAP12 bindings at same URL?
body: <p>I have a legacy web service that I am trying to migrate to Glassfish / Metro from Axis2, and I have stumbled across a problem:</p>
  
  <p>There is a single WSDL file, with a single <code>wsdl:service</code> element which contains a reference to two <code>wsdl:port</code> elements, one for SOAP11 and one for SOAP12.</p>
  
  <p>In particular, that portion of the WSDL looks like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;wsdl:service name="WebServiceInterface"&gt;
      &lt;wsdl:port name="WebServiceSOAP11port"
          binding="ns:WebServiceSOAP11Binding"&gt;
          &lt;soap:address
              location="http://localhost:8081/axis2/services/WebService" /&gt;
      &lt;/wsdl:port&gt;
      &lt;wsdl:port name="WebServiceSOAP12port"
          binding="ns:WebServiceSOAP12Binding"&gt;
          &lt;soap12:address
              location="http://localhost:8081/axis2/services/WebService" /&gt;
      &lt;/wsdl:port&gt;
  &lt;/wsdl:service&gt;
  </code></pre>
  
  <p>Attempting to set up classes to act as endpoints, I have the following:</p>
  
  <pre class="lang-java prettyprint-override"><code>@WebService(name = "WebServicePortType", targetNamespace = "http://abc/", portName="WebServiceSOAP11port", endpointInterface = "abc.WebServicePortType", serviceName = "WebServiceInterface", wsdlLocation = "WebService.wsdl")
  @BindingType(SOAPBinding.SOAP11HTTP_BINDING)
  public class WebServiceSoap11Impl extends WebServiceBase implements WebServicePortType {
      // Superclass handles actual method calls - this is just here for binding to Soap 1.1.
  }
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>@WebService(name = "WebServicePortType", targetNamespace = "http://abc/", portName="WebServiceSOAP12port", endpointInterface = "abc.WebServicePortType", serviceName = "WebServiceInterface", wsdlLocation = "WebService.wsdl")
  @BindingType(SOAPBinding.SOAP12HTTP_BINDING)
  public class WebServiceSoap12Impl extends WebServiceBase implements WebServicePortType  {
      // Superclass handles actual method calls - this is just here for binding to Soap 1.2.
  }
  </code></pre>
  
  <p>Now, that works fine for the SOAP11 bindings, but if I try and use the SOAP12 binding via soapUI, I get the following error:</p>
  
  <pre><code>[#|2013-02-25T22:31:25.299+1300|SEVERE|glassfish3.1.2|com.sun.xml.ws.transport.http.HttpAdapter|_ThreadID=227;_ThreadName=http-thread-pool-8782(5);|Unsupported Content-Type: application/soap+xml;charset=UTF-8;action="urn:heartBeat" Supported ones are: [text/xml]
  com.sun.xml.ws.server.UnsupportedMediaException: Unsupported Content-Type: application/soap+xml;charset=UTF-8;action="urn:heartBeat" Supported ones are: [text/xml]
      at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:315)
      at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:149)
      at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:361)
      at com.sun.xml.ws.transport.http.HttpAdapter.decodePacket(HttpAdapter.java:343)
      at com.sun.xml.ws.transport.http.HttpAdapter.access$400(HttpAdapter.java:99)
      at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:623)
      at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:263)
      at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:163)
      at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:145)
  </code></pre>
  
  <p>Obviously, that <code>Content-Type</code> is correct for SOAP12, but for some reason, Metro does not realise that I have two classes for the same endpoint - 1 bound to SOAP11, 1 to SOAP12. Axis2 does seem to be able to handle that use-case. Does Metro support this? Or must I provide separate endpoints for SOAP11 and 12? Or should I just drop support for one of them?</p>
  
  <p>I am running Glassfish 3.1.2.2 on Ubuntu 10.04 with Java 1.7.0_4</p>