users@jax-ws.java.net

Re: Bare binding causes inability to have multiple web methods

From: Jitendra Kotamraju <Jitendra.Kotamraju_at_Sun.COM>
Date: Tue, 15 Aug 2006 09:54:32 -0700

Greg Adams wrote:

> 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.

Since input messages are same for bothe operations, the runtime cannot
distinguish between method1, and method2. doc/lit bare cannot have two
methods with a parameter that is bound to body is mapped to same type.
The wsgen tool should catch this kind of errors so that there won't be
this kind of behaviour in the runtime.

Jitu

>
> 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/
> <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?