users@jax-rpc.java.net

Use of SOAPBinding.ParameterStyle.BARE causes wsimport error

From: Fung, Kevin [IT] <kevin.fung_at_citigroup.com>
Date: Wed, 27 Jul 2005 12:37:14 -0400

Here is the implementation class:
@WebService(name="BackOffice",
                        targetNamespace="http://kf.com/backoffice",
                        serviceName="BackOfficeService")
@SOAPBinding(style=SOAPBinding.Style.DOCUMENT,
                        use=SOAPBinding.Use.LITERAL,
                        parameterStyle=SOAPBinding.ParameterStyle.BARE)
public class BackOfficeImpl {
        @WebMethod
        @WebResult(name="TradeStatus")
        public TradeStatus submitTrade(
                        @WebParam(name="trade")Trade trade)
                throws InvalidTradeException
        {...}
        @WebMethod
        @WebResult(name="Trade")
        public Trade getTrade(
                        @WebParam(name="tradeID")int tradeID)
        {...}
}

wsimport was used to generate client classes. The following error was reported:
 [wsimport] C:\project\java\backoffice-jax-ws2-final\build\gen\java\com\kf\backoffice\client\ObjectFactory.java:89: createTrade(com.kf.backoffice.client.Trade) is already defined in com.kf.backoffice.client.ObjectFactory

The generated ObjectFactory code has the following two methods with same name:

    /**
     * Create an instance of {_at_link JAXBElement<Trade> }}
     *
     */
    @XmlElementDecl(name = "trade", namespace = "http://kf.com/backoffice")
    public JAXBElement<Trade> createTrade(Trade value) {
        return new JAXBElement<Trade>(_Trade_QNAME, ((Class) Trade.class), null, value);
    }

    /**
     * Create an instance of {_at_link JAXBElement<Trade> }}
     *
     */
    @XmlElementDecl(name = "Trade", namespace = "http://kf.com/backoffice")
    public JAXBElement<Trade> createTrade(Trade value) {
        return new JAXBElement<Trade>(_Trade_QNAME, ((Class) Trade.class), null, value);
    }

It seems one was generated from the submitTrade operation that accept a trade and the other was generated from the getTrade operation that returns a trade.

This problem does not exist for the default SOAPBinding, which is SOAPBinding.ParameterStyle.WRAPPED

Kevin Fung
Sr. Architect
GCAT Engineering
Citigroup, Inc.
kevin.fung_at_citigroup.com
908-563-0546