Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Trying to call web service (and failing)

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Thanked 0 Times in 0 Posts

    Unhappy Trying to call web service (and failing)

    Hi All,
    I'm new to Java. I'm using JDK 6 update 18, Netbeans 6.8 and Glassfish v3 to try to create a project that calls a web service. My intention is to create a web service proxy project. ie many web services to call one other webservice. The Java layer should be very thin and literally just pass messages back and forth between caller and web service client.

    In order to simulate this I have created a web service project. This web service returns a string, real basic. I build, deploy and test this and it works fine. Yay.

    I then created another project. I create a web service client pointing to the WSDL that GlassFish tells me is available, (this can be reached through the browser).
    In this project I also create a web service. I drag the operation from the web service client, (Arun Gupta stylee) into the new operation in the web service and it creates the necessary code etc...
    I build, deploy and run this only to find that I cannot test the web service. Why?

    WARNING: Servlet web service endpoint 'NewWebClient' failure
    java.lang.IllegalArgumentException: class org.glassfish.webservices.JAXWSServlet has neither @WebService nor @WebServiceProvider annotation

    public class NewWebClient {
        @WebServiceRef(wsdlLocation = "WEB-INF/wsdl/localhost_8080/TestService/WebService1Service.wsdl")
        private WebService1Service service;
         * Web service operation
        @WebMethod(operationName = "clienttest")
        public String clienttest() {
            //TODO write your implementation code here:
            try { // Call Web Service Operation
                server1.WebService1 port = service.getWebService1Port();
                // TODO process result here
                java.lang.String result = port.helloworldservice();
                //System.out.println("Result = "+result);
            } catch (Exception ex) {
                // TODO handle custom exceptions here
            return "";

    My code is above. (relevant bits anyway)

    Can anyone tell my what I might be doing wrong? I've not really done anything special, I have a few plugins installed, those I thought I might muck about with (REST webservices etc) but other than that the installation should be standard and like I said I don't get any build errors, just the loads of stack trace info about these missing annotations.
    Any help would be great,
    Ta Jim

  2. #2
    Junior Member
    Join Date
    Feb 2010
    Thanked 0 Times in 0 Posts

    Smile Re: Trying to call web service (and failing)

    Ok, so it turns out that the example that I followed was wrong.
    The solution?
    Once I created the Web Service Client (WSC), I then created a boggo standard Java class in a different package to the Web Service. I dragged the WSC onto the class (instead of the WS), I then use this class in my Web Service instead of directly using the WSC. Weird? I thought so, works now though

  3. #3
    Junior Member
    Join Date
    Jan 2011
    Thanked 0 Times in 0 Posts

    Default Re: Trying to call web service (and failing)

    Had exactly the same problem .Your solution worked like a charm.
    Thanks a lot!

Similar Threads

  1. need programmer for my online call center
    By erinbasim in forum Paid Java Projects
    Replies: 6
    Last Post: March 30th, 2010, 01:45 AM
  2. [SOLVED] Web Service from WSDL
    By wilky in forum Java Theory & Questions
    Replies: 3
    Last Post: January 25th, 2010, 10:45 AM
  3. simple login web service
    By mr_aliagha in forum JavaServer Pages: JSP & JSTL
    Replies: 3
    Last Post: January 5th, 2010, 03:49 PM
  4. How to detect audio input from a telephone call?
    By ces_31 in forum Java Theory & Questions
    Replies: 0
    Last Post: August 12th, 2009, 12:45 AM
  5. [SOLVED] Java exception "result already defined"
    By rptech in forum Object Oriented Programming
    Replies: 3
    Last Post: May 20th, 2009, 05:48 AM

Tags for this Thread