1 Reply Latest reply on Aug 2, 2005 6:41 AM by thomas.diesler

    Error launching WS Client

    christy

      HI,
      I decided to write WS client to test my web service. I looked the hello example in jboss documentation in chapter 12. Here my code:

      import javax.xml.namespace.QName;
      import javax.xml.rpc.ServiceFactory;
      import javax.xml.rpc.Call;
      import javax.xml.rpc.Service;
      import java.net.URL;
      public class TestWSClient {
      public static void main(String[] args) {
      String nmsp = "http://test.webservice.oceaninfo.ru";
      String qnameService = "TestWSService";
      String qnamePort = "TestWSInterfacePort";
      String urlstr = "http://debug/testws/Test?wsdl";
      try {
      URL url = new URL(urlstr);
      ServiceFactory factory = ServiceFactory.newInstance();
      javax.xml.rpc.Service serv = factory.createService(url, new QName(nmsp, qnameService));
      Call call = serv.createCall(new QName(nmsp,qnamePort),new QName(nmsp,"getId"));
      System.out.println("output:" + call.invoke(new Object[] {"argument"}));
      } catch (Exception e) {
      e.printStackTrace();
      }
      }
      }

      But I have the error:

      javax.xml.rpc.ServiceException: Error processing WSDL document:
      javax.xml.rpc.ServiceException: Error processing WSDL document:
      javax.xml.rpc.ServiceException: Cannot find service: {http://test.webservice.oceaninfo.ru}TestWSService
      at org.jboss.axis.client.Service.initService(Service.java:289)
      at org.jboss.axis.client.Service.(Service.java:191)
      at org.jboss.webservice.client.ServiceImpl.(ServiceImpl.java:110)
      at org.jboss.webservice.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:111)
      at TestWSClient.main(TestWSClient.java:51)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)

      I used wscompile to generate WSDL.
      It's strange, because I think I used right url. What is wrong?
      Thank you.

        • 1. Re: Error launching WS Client
          thomas.diesler

          The exception says, that there is no such service in the wsdl. So what is the wsdl service FQN?

          Also, have you looked at this FAQ


          Q: How can I leverage the WS4EE client deployment model in standlone java app?

          A: The ws4ee client deployment model has many advantages over DII. Most Java applications (except the most trivial ones) have a need for registry lookup (JNDI) and management (JMX). A very minimal jboss configuration has a tiny footprint and provides just that. Therefore, you might want to consider running your client app on jboss and mangage it through jmx-console and have a layer of indirection for resource lookup through JNDI. Additionally, you could then use the WS4EE client programming model and obtain preconfigured WS clients form JNDI.