facebook

[Closed] Generated WebService client doesn’t work

  1. MyEclipse Archived
  2.  > 
  3. Web Services
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #266251 Reply

    klusi
    Member

    Hello,

    I tried the HelloWorld-WebService example from the MyEclipse-Helppages and I managed to successfully deploy the service to a JBoss-4.0.4 server. I tested the service with the WebServiceExplorer tool and everything works fine.

    After testing the service, I tried to generate a HelloWorld client with the “New->WebServiceClient” feature. I specified the WSDL-Url in the wizard and the generation completed successfully.

    My problem is that when I try to run the generated HelloWorldServiceClient.java file, I get an exception:

    
    17.02.2007 11:45:22 org.codehaus.xfire.transport.local.LocalChannel getService
    INFO: Unable to locate 'HelloWorldService' in ServiceRegistry
    17.02.2007 11:45:22 org.codehaus.xfire.handler.DefaultFaultHandler invoke
    INFO: Fault occurred!
    org.codehaus.xfire.fault.XFireFault: Could not find a service to invoke.
        at org.codehaus.xfire.handler.LocateBindingHandler.invoke(LocateBindingHandler.java:39)
        at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
        at org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java:64)
        at org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:38)
        at org.codehaus.xfire.transport.local.LocalChannel.sendViaNewChannel(LocalChannel.java:172)
        at org.codehaus.xfire.transport.local.LocalChannel.send(LocalChannel.java:99)
        at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
        at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
        at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
        at org.codehaus.xfire.client.Client.invoke(Client.java:335)
        at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
        at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
        at $Proxy8.example(Unknown Source)
        at org.klusi.ws.test.client.HelloWorldServiceClient.main(HelloWorldServiceClient.java:126)
    17.02.2007 11:45:22 org.codehaus.xfire.handler.DefaultFaultHandler sendToDeadLetter
    SCHWERWIEGEND: Could not find service.
    org.codehaus.xfire.fault.XFireFault: Could not find a service to invoke.
        at org.codehaus.xfire.handler.LocateBindingHandler.invoke(LocateBindingHandler.java:39)
        at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
        at org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java:64)
        at org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:38)
        at org.codehaus.xfire.transport.local.LocalChannel.sendViaNewChannel(LocalChannel.java:172)
        at org.codehaus.xfire.transport.local.LocalChannel.send(LocalChannel.java:99)
        at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
        at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
        at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
        at org.codehaus.xfire.client.Client.invoke(Client.java:335)
        at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
        at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
        at $Proxy8.example(Unknown Source)
        at org.klusi.ws.test.client.HelloWorldServiceClient.main(HelloWorldServiceClient.java:126)
    

    What am I doing wrong here? I assumed that the generated client should run without any problems.

    Best regards

    Thorsten

    #266305 Reply

    Riyad Kalla
    Member

    Thorsten,
    Strange. You are still running JBoss right? What does your main method look like in the HelloWorldServiceClient.java class?

    #266358 Reply

    klusi
    Member

    Yes, I had my JBoss running when I started the test client. I can post the source code of the client class when I get home from work later. But it is simply the generated client. I did not make any changes.

    #266383 Reply

    Brian Fernandes
    Moderator

    Thorsten,

    Which version of MyEclipse did you use to generate code? Version 5.1GA had a bug because of which it would sometimes generate incorrect code.
    For example:

    Object portType = client.getCommerceServicePortTypeLocalEndpoint();

    instead of the following correct code

    Object portType = client.getCommerceServicePort();

    So watch out for the generation of code which uses the LocalEndpoint instead of the actual service.

    Failing that, please post some code here so we may have a better understanding of the situation.

    #266410 Reply

    klusi
    Member

    Yes I am using MyEclipse 5.1. I will test your suggestion today and if it fails I will post the code.

    #266511 Reply

    klusi
    Member

    My client main() method is as follows:

    
        public static void main(String[] args) {
    
            HelloWorldServiceClient client = new HelloWorldServiceClient();
    
            //create a default service endpoint
            HelloWorldServicePortType helloWorldServicePortType = client
                    .getHelloWorldServiceHttpPort(); //PortTypeLocalEndpoint();
    
            String res = helloWorldServicePortType.example("client helloworld");
            System.out.println("Result = "+res);
            
            System.out.println("test client completed");
            System.exit(0);
        }
    

    As you can see, I had to replace the call of getHelloWorldServicePortTypeLocal to getHelloWorldServiceHttpPort(). It now seems to work.

    #266600 Reply

    forumans
    Member

    I am new to the Web Services. I have created a client from a WSDL file using wizard New->Web Services Client -> Located WSDL file.

    Tool created a package and bunch of .java classes. Which one is client .java class in that list? How to run that file? Help me plz.

    Thanks,
    Forumans

    #266675 Reply

    Brian Fernandes
    Moderator

    Forumans,

    What version of MyEclipse are you using?
    The client class is the class with the name *Client.java. It is generated in a separate package if you specified a package during client generation.

    Sorry for the confusion, we’ll try and make the client more obvious in the future.

    #266676 Reply

    Brian Fernandes
    Moderator

    Klusi,

    Thank you for following up with your experience, this bug has been put down already, glad it’s working for you now.

    Brian.

    #266837 Reply

    klingmank
    Member

    @Support-Brian wrote:

    Klusi,

    Thank you for following up with your experience, this bug has been put down already, glad it’s working for you now.

    Brian.

    Is this fixed in 5.5 milestone? I need to get a Client whipped out really quickly. What’s the workaround to modify the broken code, how much code do I have to change?

    #266841 Reply

    Brian Fernandes
    Moderator

    It has been fixed in 5.5M1. Otherwise you can stick with 5.1.0 and you need to change just a single line of code as described above.

    #306982 Reply

    asifsidd
    Member

    @Support-Brian wrote:

    It has been fixed in 5.5M1. Otherwise you can stick with 5.1.0 and you need to change just a single line of code as described above.

    Hi,
    I generated the WebService Client side stuff using My Exclipse 5.0,
    I used a url for my wsdl hosted on local tomcat.
    I am getting this error when I try do this and run:

    public static void main(String[] args) {

    HelloWorldServiceClient client = new HelloWorldServiceClient();

    //create a default service endpoint
    HelloWorldServicePortType helloWorldServicePortType = client.getHelloWorldServiceHttpPort();

    //TODO: Add custom client code here
    //
    //helloWorldServicePortType.yourServiceOperationHere();

    String s = helloWorldServicePortType.example(“A”);
    System.out.println(“test client completed” + s );
    System.exit(0);

    Issue: Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/commons/httpclient/methods/RequestEntity
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.getConstructor(Unknown Source)
    at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:108)
    at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
    at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
    at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
    at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
    at org.codehaus.xfire.client.Client.invoke(Client.java:335)
    at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
    at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
    at $Proxy8.example(Unknown Source)
    at test.HelloWorldServiceClient.main(HelloWorldServiceClient.java:125)

    but I am able to see my Webservice methods using “launch webservice explorer tool of eclipse. Even it allows to access method and returns output to screen.

    #306983 Reply

    asifsidd
    Member

    @Support-Brian wrote:

    It has been fixed in 5.5M1. Otherwise you can stick with 5.1.0 and you need to change just a single line of code as described above.

    Hi,
    I generated the WebService Client side stuff using My Exclipse 5.0,
    I used a url for my wsdl hosted on local tomcat.
    I am getting this error when I try do this and run:

    public static void main(String[] args) {

    HelloWorldServiceClient client = new HelloWorldServiceClient();

    //create a default service endpoint
    HelloWorldServicePortType helloWorldServicePortType = client.getHelloWorldServiceHttpPort();

    //TODO: Add custom client code here
    //
    //helloWorldServicePortType.yourServiceOperationHere();

    String s = helloWorldServicePortType.example(“A”);
    System.out.println(“test client completed” + s );
    System.exit(0);

    Issue: Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/commons/httpclient/methods/RequestEntity
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.getConstructor(Unknown Source)
    at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:108)
    at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
    at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
    at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
    at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
    at org.codehaus.xfire.client.Client.invoke(Client.java:335)
    at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
    at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
    at $Proxy8.example(Unknown Source)
    at test.HelloWorldServiceClient.main(HelloWorldServiceClient.java:125)

    but I am able to see my Webservice methods using “launch webservice explorer tool of eclipse. Even it allows to access method and returns output to screen.

    #306984 Reply

    asifsidd
    Member

    @Support-Brian wrote:

    It has been fixed in 5.5M1. Otherwise you can stick with 5.1.0 and you need to change just a single line of code as described above.

    Hi,
    I generated the WebService Client side stuff using My Exclipse 5.0,
    I used a url for my wsdl hosted on local tomcat.
    I am getting this error when I try do this and run:

    public static void main(String[] args) {

    HelloWorldServiceClient client = new HelloWorldServiceClient();

    //create a default service endpoint
    HelloWorldServicePortType helloWorldServicePortType = client.getHelloWorldServiceHttpPort();

    //TODO: Add custom client code here
    //
    //helloWorldServicePortType.yourServiceOperationHere();

    String s = helloWorldServicePortType.example(“A”);
    System.out.println(“test client completed” + s );
    System.exit(0);

    Issue: Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/commons/httpclient/methods/RequestEntity
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.getConstructor(Unknown Source)
    at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:108)
    at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
    at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
    at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
    at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
    at org.codehaus.xfire.client.Client.invoke(Client.java:335)
    at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
    at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
    at $Proxy8.example(Unknown Source)
    at test.HelloWorldServiceClient.main(HelloWorldServiceClient.java:125)

    but I am able to see my Webservice methods using “launch webservice explorer tool of eclipse. Even it allows to access method and returns output to screen.

Viewing 14 posts - 1 through 14 (of 14 total)
Reply To: [Closed] Generated WebService client doesn’t work

You must be logged in to post in the forum log in