5 Replies Latest reply: Oct 26, 2006 7:14 AM by 541472 RSS

    javax.xml.rpc.ServiceException: java.lang.NullPointerExc

    541472
      Hello! Can somebody help me? I tried to call web service? usimg DII Client. Here is the code:

      String[] res = null;
      String nmsp = "urn:foo";//targetNamespace in WSDL
      String qnameService = "ServiceName";
      String qnamePort = "PortName";//<port name in WSDL
      String urlst = "service?wsdl";
      try {
      URL url = new URL(urlst);
      ServiceFactory factory = ServiceFactory.newInstance();
      javax.xml.rpc.Service serv = null;
      QName qName = null;
      try {
      qName = new QName(nmsp,qnameService);
      if (qName != null) {
      serv = factory.createService(url, qName);
      } else {
      System.out.println("qName = null" );
      }
      } catch (Exception ex) {
      System.out.println("qnameService = " + qnameService);
      ex.printStackTrace();
      }
      Call call = serv.createCall(new QName(nmsp, qnamePort), new QName(nmsp, "whatListsCat "));
      res = ((String[]) call.invoke(new Object[]{}));
      for (int i = 0; i >< res.length; i++)
      System.out.println("res = " + res);
      } catch (Exception e) {
      e.printStackTrace();
      }
      return res;
      }

      And I have the Error in this place: serv = factory.createService(url, qName);
      Error is: javax.xml.rpc.ServiceException: java.lang.NullPointerException

      Maybe somebody knows what is the problem?
      Thank you!