Link to home
Start Free TrialLog in
Avatar of kcmovies
kcmovies

asked on

Issue with jax-ws webservice client using annotations

Hi,
I am using RAD8.5 and websphere server 7.  I am trying to develop jax-ws webservice client using annotations. I followed instructions in link webservice client

I am getting following error.
Caused by: javax.xml.ws.WebServiceException: EndpointDescription: PortQName was null and could not be determined by runtime for class org.temp.SmpleService; ServiceDescription: org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl

Not sure what i need to do ? Please help ?
I also need to include "Usernametokens" in SOAP header. Please let me know if you have any sample.

Thanks in advance.
Avatar of mccarl
mccarl
Flag of Australia image

Can you post your code AND the WSDL that you used in "wsimport" and point to in the code?
Avatar of kcmovies
kcmovies

ASKER

Sorry mccarl, the WSDL I used is not in public domain.
I used below sample code. Please let me know if you need any more details ?

public class HelloClient {
  @WebServiceRef(wsdlLocation="http://localhost:8080/
      helloservice/hello?wsdl")
  HelloService service;

  public static void main(String[] args) {
    try {
      HelloClient client = new HelloClient();
      client.doTest(args);
    } catch(Exception e) {
      e.printStackTrace();
    }
  }

  public void doTest(String[] args) {
    try {
      System.out.println("Retrieving the port from 
          the following service: " + service);
      Hello port = service.getHelloPort();
      System.out.println("Invoking the sayHello operation 
          on the port.");

      String name;
      if (args.length > 0) {
        name = args[0];
      } else {
        name = "No Name";
      }

      String response = port.sayHello(name);
      System.out.println(response);
    } catch(Exception e) {
      e.printStackTrace();
    }
  }

Open in new window

Please let me know if provided details are not enough to troubleshoot ?

Thanks
Sorry kcmovies, somehow I have missed your posts until now.


As to your problem, I am a little confused. Your comments in relation to the WSDL lead me to believe that this WSDL is something specific to you and/or your application, but the code that you posted is the sample code from the link you include in your original question. So I am wondering, are you trying just to get the sample from that link going, or are you trying to get your particular app working?

If you are just trying to get the sample going, then you would be using the WSDL that the web service exposes and the sample code that you posted above. But if you are trying to get YOUR application going then, then you would use the non-public domain WSDL that you have but with java code that corresponds to that WSDL. Sorry if this is stating the obvious, but it isn't clear from your post. The code needs to be specific to the WSDL of the service you are trying to connect with; you can't use your WSDL but with the same sample code from that link!
Sorry mccarl for confusion.

Posted issue is with my application WSDL and code. I used posted sample code as to develop my web service client code.

Could you please give any clues to trouble shoot this issue ?

I am able to communicate web service with out using annotations, means using normal JAX-WS client code.  

Thanks
ASKER CERTIFIED SOLUTION
Avatar of mccarl
mccarl
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial