users@jax-ws.java.net

Bare binding causes inability to have multiple web methods

From: Greg Adams <gadams_at_gmail.com>
Date: Tue, 15 Aug 2006 08:37:52 -0700

I'm cross-posting this from the JAX-WS/JAXB discussion forums.

Here's my java class:



*package* com.foo;

*import* javax.jws.WebMethod;
*import* javax.jws.WebService;
*import* javax.jws.soap.SOAPBinding;

@WebService(targetNamespace = "http://foo.com", name = "Test")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
*public* *class* TestEndPoint {

        *public* String method1() {
                *return* "method1 return";
        }
        

        *public* String method2() {
                *return* "method2 return";
        }
}



My client (a .Net client using wsdl.exe generated proxies) calls method1,
then method2, but method2 gets called twice.

I tried adding @WebMethod(operationName="method1", action="method1") to
method1 and @WebMethod(operationName="method2", action="method2") to the
methods, but that made no difference.

Here's the wsdl without the @WebMethod annotations:



<?xml version="1.0" encoding="UTF-8"?><definitions
xmlns:tns="http://foo.com" xmlns"0" src="images/emoticons/love.gif"
alt=":x">sd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://foo.com" name="TestEndPointService">
  <types>
    <xsd:schema>
      <xsd:*import* namespace="http://foo.com"
schemaLocation="http://localhost:8080/jaxWsTest2/services/Test?xsd=1"></xsd:import>
    </xsd:schema>
  </types>
  <message name="method1"></message>
  <message name="method1Response">
    <part element="tns:method1Response" name="method1Response"></part>
  </message>
  <message name="method2"></message>
  <message name="method2Response">
    <part element="tns:method2Response" name="method2Response"></part>
  </message>
  <portType name="Test">
    <operation name="method1">
      <input message="tns:method1"></input>
      <output message="tns:method1Response"></output>
    </operation>
    <operation name="method2">
      <input message="tns:method2"></input>
      <output message="tns:method2Response"></output>
    </operation>
  </portType>
  <binding type="tns:Test" name="TestPortBinding">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"></soap:binding>
    <operation name="method1">
      <soap:operation soapAction=""></soap:operation>
      <input>
        <soap:body use="literal"></soap:body>
      </input>
      <output>
        <soap:body use="literal"></soap:body>
      </output>
    </operation>
    <operation name="method2">
      <soap:operation soapAction=""></soap:operation>
      <input>
        <soap:body use="literal"></soap:body>
      </input>
      <output>
        <soap:body use="literal"></soap:body>
      </output>
    </operation>
  </binding>
  <service name="TestEndPointService">
    <port binding="tns:TestPortBinding" name="TestPort">
      <soap:address
location="http://localhost:8080/jaxWsTest2/services/Test"></soap:address>
    </port>
  </service>
</definitions>




Any ideas?