Neo
Neo

Reputation: 38

@WebService Annotation not working on Weblogic 10.3

I have the class below embedded in an EAR file i have deployed to Weblogic 10.3.

I thought that it was all i needed in order to have the Web Service become available for use.

In the console - when i expand the EAR i see

WebServices -> None to display

I know there are JWSC tasks i can add to the ANT Script - but i thought it was as simple as this?

package messagecenter.ws;

import javax.jws.WebService;
import javax.jws.WebMethod;

/**
 * @author KwikkSilva
 */
@WebService
public class WebServiceMain {

    @WebMethod
    public String getHello()
    {
    return "hello!!!!!";
    }
}

Upvotes: 2

Views: 5789

Answers (3)

Link Marston
Link Marston

Reputation: 49

I had the same problem. After doing a lot of research, the solution was to specify in weblogic-application.xml, in the prefer-application-packages tag the following:

<prefer-application-packages>
    <package-name>com.sun.xml.internal.messaging.saaj.soap.*</package-name>
    <package-name>weblogic.wsee.saaj.*</package-name>
</prefer-application-packages>

Additionally, I imported the saaj-impl-1.3.1.8.jar in my project. This did the trick, and the reason for this, appears to be that, to perform certain SOAP operations, weblogic seems to prefer certain default libraries that are not recognizing properly the @WebService annotation.

Upvotes: 0

Jitendra Vispute
Jitendra Vispute

Reputation: 719

please @Stateless ,although i didnt find anywhere in documentation but by adding @Stateless it recognizes and creates webservice so your code will look like this



package messagecenter.ws;
import javax.ejb.Stateless;
import javax.jws.WebService;
import javax.jws.WebMethod;

/**
 * @author KwikkSilva
 */
@Stateless
@WebService
public class WebServiceMain {

    @WebMethod
    public String getHello()
    {
    return "hello!!!!!";
    }
}

Upvotes: 0

Cris
Cris

Reputation: 5007

Follow this tutorial : http://download.oracle.com/docs/cd/E12840_01/wls/docs103/webserv/setenv.html#IterativeDevelopment

However if your deployment package is an ear you need to have an application.xml where you will specify that you have a war or jar as module inside.

<?xml version="1.0" encoding="UTF-8"?>
<application>
   <display-name>cccc</display-name>
   <description>some ws</description>
   <module>
      <web>
         <web-uri>webservice.war</web-uri>
         <context-root>client</context-root>
      </web>
   </module> 
</application>

Upvotes: 1

Related Questions