Home > Back-end >  Weblogic 14c - webservice-description-name is not unique within weblogic-webservices
Weblogic 14c - webservice-description-name is not unique within weblogic-webservices

Time:10-16

I am exposing my stateless ejb as web service using the annotations as follows:

@WebService(
    name = "MyServicePort",
    portName = "MyServicePort",
    serviceName = "MyService",
)
@SOAPBinding(
    style = SOAPBinding.Style.RPC
)
@Stateless(mappedName="MyServiceEJB", name = "MyServiceEJB")
public class MyServiceBean {

To define the context root in weblogic, I've defined the web service in weblogic-webservices.xml deployment descriptor as follows:

<weblogic-webservices
    xmlns="http://xmlns.oracle.com/weblogic/weblogic-webservices"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-webservices http://xmlns.oracle.com/weblogic/weblogic-webservices/1.1/weblogic-webservices.xsd">
    <webservice-description>
        <webservice-description-name>MyService</webservice-description-name>
        <port-component>
            <port-component-name>MyServicePort</port-component-name>
            <service-endpoint-address>
                <webservice-contextpath>/mycontext</webservice-contextpath>
                <webservice-serviceuri>/myservice</webservice-serviceuri>
            </service-endpoint-address>
        </port-component>
    </webservice-description>
</weblogic-webservices>

However, weblogic is throwing the below error while deploying:

[ERROR] weblogic.wsee.ws.WsException: Error encountered while deploying WebService module 'myservice-ejb.jar'.
In weblogic-webservices.xml, webservice-description-name MyService is not unique within weblogic-webservices

Any clue what I am doing wrong here? This is the only bean/service in my web application and there is no other application deployed in weblogic (local instance).

CodePudding user response:

I am able to resolve the issue by placing the webservices.xml with below contents into META-INF folder (next to weblogic-webservices.xml).

<webservices xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/javaee_web_services_1_4.xsd"
    version="1.4">
    <display-name>MyService</display-name>
    <webservice-description>
        <webservice-description-name>MyService</webservice-description-name>
        <port-component>
            <port-component-name>MyServicePort</port-component-name>
            <wsdl-port xmlns:tns="http://schemas.mycompany.com/webservices/MyService">tns:MyServicePort</wsdl-port>
            <service-endpoint-interface>mypackage.MyServiceBean</service-endpoint-interface>
            <service-impl-bean>
                <ejb-link>MyServiceEJB</ejb-link>
            </service-impl-bean>
        </port-component>
    </webservice-description>
</webservices>

Hope it may help someone facing the same challenge.

  • Related