Results 1 to 5 of 5
Thread: Consuming Spellcheck Web Service
- 01-01-2011, 07:06 PM #1
Member
- Join Date
- Jan 2011
- Posts
- 5
- Rep Power
- 0
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:
The code currently is this: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)
Can anyone help me identify what is the problem? Also how can I display the word recommendations?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); } }
Thanks!
- 01-01-2011, 09:12 PM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
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() ...
- 01-01-2011, 09:21 PM #3
Member
- Join Date
- Jan 2011
- Posts
- 5
- Rep Power
- 0
Hi eRaaaa, I tried doing this before and each time where I invoke 'Words', it gives an error saying 'Cannot Find Symbol'
EG:
orJava Code:ListIterator<Words> li = checkTextBodyV2(textToCheck).getMisspelledWord().listIterator();
Is there something else I need to import other than Java.util.* or is there something else I am missing?Java Code:while (li.hasNext()) { System.out.println("Incorrect Word: " + ((Words) li.next().getWord())); }
Thanks!
EDIT:
Actually I just added the following import:
I don't entirely understand why it worked but it is working now!!! Thank you for your help!Java Code:import org.netbeans.end2end.check.client.Words;
Last edited by DannyArcher; 01-01-2011 at 09:26 PM. Reason: Update
- 01-01-2011, 09:29 PM #4
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
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 ?? )
- 01-01-2011, 09:33 PM #5
Member
- Join Date
- Jan 2011
- Posts
- 5
- Rep Power
- 0
Similar Threads
-
Error on consuming webservice
By lzoratto in forum CLDC and MIDPReplies: 0Last Post: 06-08-2010, 01:51 PM -
avoiding memory over-consuming
By itaipee in forum New To JavaReplies: 4Last Post: 12-14-2009, 11:59 AM -
Consuming a Web Service?
By jaden in forum New To JavaReplies: 0Last Post: 08-21-2009, 09:21 PM -
Consuming web service with return custom object
By dream_ in forum NetworkingReplies: 1Last Post: 04-16-2009, 06:56 AM -
Consuming a Web Service using Java
By gopikrishnatb in forum Web FrameworksReplies: 2Last Post: 03-02-2009, 09:59 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks