users@jax-ws.java.net

Re: Bare binding causes inability to have multiple web methods

From: Greg Adams <gadams_at_gmail.com>
Date: Tue, 15 Aug 2006 10:15:40 -0700

So I need to add a parameter I'm not going to use just so that the runtime
can distinguish the operation signatures? I was initially using Wrapped
parameterStyle, but that conflicted with a requirement I have for using SOAP
headers. The workaround suggested here:
http://forums.java.net/jive/thread.jspa?threadID=17469&tstart=15 was to use
the Bare parameterStyle, but that appears to have problems with duplicate
operation signatures, so it seems that workaround doesn't really work.

On 8/15/06, Vivek Pandey <Vivek.Pandey_at_sun.com> wrote:
>
> The failure is because both the operations in the portType have no input
> parts, this results in empty SOAP body - <soap:Body/>. This causes
> non-uniqueness of the message signature on the wire.JAXWS complies with
> BP requirement on uniqueness of operation signature in a portType[1] and
> does method dispatching on the server side based on the input message or
> Body tag.
>
> Here in this wsdl both method1 and method2 have no input parameters and
> because its BARE style so there is no input part in the wsdl message
>
> *public* String method1() {...}
>
>
> *public* String method2() {...}
>
>
> <message name="method1"></message>
>
>
> <message name="method2"></message>
>
>
> What you need to do is that declare a parameter in these methods, for
> example,
>
> public String method1(int foo) {
> return "method1 return";
> }
>
> and the corresponding generated wsdl will be:
>
> <message name="method1">
> <part name="method1" element="tns:method1"/>
> </message>
>
> ...
>
> <xs:element name="method1" type="xs:int"/>
>
>
> This should fix your problem.
>
> -vivek.
> [1]http://www.ws-i.org/Profiles/BasicProfile-1.1.html#Operation_Signatures
>
> 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.
> >
> > 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?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
> For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
>
>