?
Solved

C# BabelFishService web service.

Posted on 2006-03-25
8
Medium Priority
?
682 Views
Last Modified: 2012-06-21
Hello,

I am trying use the BabelFishService translation web service. In my asp.net site, which includes C# for the coding.

The wsdl is from:

www.xmethods.com/sd/2001/BabelFishService.wsdl

In the C# code below I create a BabelFishService object and tried to translate the german word habe, which should return 'have'.

Through I found the C# code becomes locked for a time, then returns a time of exception. But does not become locked for all words I have tried to translate. I just wondered if there was an try, catch exception I could use if the webservice cannot translate the word entered?

Does anyone know if the web-service should return " " value to the string translation, if the word could not be translated by the webservice?

BabelFishService webservice = new BabelFishService();
string translation = webservice.BabelFish("de_en", "habe");

Thanks
0
Comment
Question by:EmailSurfer
  • 4
  • 3
8 Comments
 
LVL 13

Accepted Solution

by:
devsolns earned 240 total points
ID: 16291199
Im not sure how the web service works but yeah definaly but a try catch around it.


try {

}
catch(SoapException se)
{

}
catch(Exception e)
{

}

SoapException may contain some information.  My guess is it should return null if translation didnt take place.
0
 

Author Comment

by:EmailSurfer
ID: 16293352
Thanks

Do you think the wsdl should describe the exceptions objects used in this web service? And what should be return from the BabelFish method?

http://www.xmethods.com/sd/2001/BabelFishService.wsdl

Thanks
0
 

Author Comment

by:EmailSurfer
ID: 16301751
Could anyone advise?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 13

Expert Comment

by:devsolns
ID: 16302477
Well it does tell you whats expected back,

<message name="BabelFishResponse">
<part name="return" type="xsd:string" />
</message>

and its a simple string.  as far as what the service does if it cant translate that really depends on its implementation and that isnt shown in the wsdl.  i dont see any comments that tell you this.


"Do you think the wsdl should describe the exceptions objects used in this web service?"

It can but it doesnt or else you see something in the <wsdl:fault/> element.  catching the soap exception should give you whatever info you need.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16307513
Babelfish Reference:

Translation Web Service in C#
http://www.codeproject.com/cs/webservices/translation.asp

Bob
0
 
LVL 13

Expert Comment

by:devsolns
ID: 16311364
But that code on code project is not accessing the web service.  its using a http post method and "replicating" what youd do in a browser.
0
 

Author Comment

by:EmailSurfer
ID: 16325181
Thanks

It seems to working now I think the web service was being timed-out.

Could I ask finally, is there anyway in C# to test if the user presses the enter in a textfield?

Thanks again
0
 
LVL 13

Expert Comment

by:devsolns
ID: 16352517
Yup,

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.textBox1.KeyPress += new KeyPressEventHandler(textBox1_KeyPress);
        }

        void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)13)
            {
                //do something
            }
        }
    }
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question