Results 1 to 5 of 5
  1. #1
    DannyArcher is offline Member
    Join Date
    Jan 2011
    Posts
    5
    Rep Power
    0

    Default Consuming Spellcheck Web Service

    Hi. I am new to Java and I am trying to use a spellcheck WebService which I have found below:
    http://ws.cdyne.com/SpellChecker/check.asmx?wsdl


    I am trying to read back the incorrect words however I am getting the following output:
    Java Code:
    Incorrect Words: 4
    Incorrect Word: org.netbeans.end2end.check.client.Words@987a33
    Incorrect Word: org.netbeans.end2end.check.client.Words@7eb6e2
    Incorrect Word: org.netbeans.end2end.check.client.Words@118d189
    Incorrect Word: org.netbeans.end2end.check.client.Words@648016
    BUILD SUCCESSFUL (total time: 3 seconds)
    The code currently is this:
    Java Code:
    package spellcheckws;
    
    import org.netbeans.end2end.check.client.DocumentSummary;
    import java.util.*;
    
    public class SpellCheck {
    
        public static void main(String[] args) {
    
            String textToCheck = "This is somme text which shud be cheecked by tha checker";
    
            int incorrectCount = checkTextBodyV2(textToCheck).getMisspelledWordCount();
            System.out.println("Incorrect Words: " + incorrectCount);
    
            ListIterator li = checkTextBodyV2(textToCheck).getMisspelledWord().listIterator();
    
            while (li.hasNext()) {
                System.out.println("Incorrect Word: " + li.next());
            }
        }
    
        private static DocumentSummary checkTextBodyV2(java.lang.String bodyText) {
            org.netbeans.end2end.check.client.Check service = new org.netbeans.end2end.check.client.Check();
            org.netbeans.end2end.check.client.CheckSoap port = service.getCheckSoap();
            return port.checkTextBodyV2(bodyText);
        }
    
    }
    Can anyone help me identify what is the problem? Also how can I display the word recommendations?

    Thanks!

  2. #2
    eRaaaa is online now Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    5

    Default

    You must invoke the getWord method of the Words-object.

    --> System.out.println("Incorrect Word: " + ((Words)li.next()).getWord());

    or use a generic ListIterator

    ListIterator<Words> li
    ....
    System.out.println("Incorrect Word: " + li.next().getWord());

    or maybe

    for (Words word : checkTextBodyV2(textToCheck).getMisspelledWord()) {
    System.out.println("Incorrect Word: " + word.getWord());
    }

    If you have then the Words-object you could invoke getSuggestionCount() and getSuggestions(index) or getSuggestions() ...

  3. #3
    DannyArcher is offline Member
    Join Date
    Jan 2011
    Posts
    5
    Rep Power
    0

    Default

    Hi eRaaaa, I tried doing this before and each time where I invoke 'Words', it gives an error saying 'Cannot Find Symbol'
    EG:
    Java Code:
    ListIterator<Words> li = checkTextBodyV2(textToCheck).getMisspelledWord().listIterator();
    or

    Java Code:
            while (li.hasNext()) {
                System.out.println("Incorrect Word: " + ((Words) li.next().getWord()));
            }
    Is there something else I need to import other than Java.util.* or is there something else I am missing?

    Thanks!


    EDIT:

    Actually I just added the following import:

    Java Code:
    import org.netbeans.end2end.check.client.Words;
    I don't entirely understand why it worked but it is working now!!! Thank you for your help!
    Last edited by DannyArcher; 01-01-2011 at 09:26 PM. Reason: Update

  4. #4
    eRaaaa is online now Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    5

    Default

    I do not use Netbeans and I dont know how your client code looks like.
    You could try

    import org.netbeans.end2end.check.client.Words;

    or look into your packages and search the Words class :)

    (or use the auto import mechanism in Netbeans : Shift+Ctrl+I ?? )

  5. #5
    DannyArcher is offline Member
    Join Date
    Jan 2011
    Posts
    5
    Rep Power
    0

    Default

    Added below import which worked:

    Java Code:
    import org.netbeans.end2end.check.client.Words;
    Thank you!

Similar Threads

  1. Error on consuming webservice
    By lzoratto in forum CLDC and MIDP
    Replies: 0
    Last Post: 06-08-2010, 01:51 PM
  2. avoiding memory over-consuming
    By itaipee in forum New To Java
    Replies: 4
    Last Post: 12-14-2009, 11:59 AM
  3. Consuming a Web Service?
    By jaden in forum New To Java
    Replies: 0
    Last Post: 08-21-2009, 09:21 PM
  4. Consuming web service with return custom object
    By dream_ in forum Networking
    Replies: 1
    Last Post: 04-16-2009, 06:56 AM
  5. Consuming a Web Service using Java
    By gopikrishnatb in forum Web Frameworks
    Replies: 2
    Last Post: 03-02-2009, 09:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •