3 Replies Latest reply on Aug 11, 2005 6:46 AM by Thomas Diesler

    problem with babelfish

    Mark Waschkowski Newbie

      Hi All,

      I'm using similiar code as below to connect to other web services, but it doesn't seem to be working for babelfish. Anyone tell me why? I'm wondering if its an incompatible WS somehow. If so, can anyone tell me how I could figure that out? Something in the wsdl maybe? Any ideas appreciated.

      Mark

      public class BabelFishWS {
      
       public static void main(String[] args)
      throws ServiceException, MalformedURLException, RemoteException {
       String wsdlUrl = "http://www.xmethods.com/sd/2001/BabelFishService.wsdl";
       String namespace = "http://www.xmethods.net/sd/BabelFishService.wsdl";
       String serviceName = "BabelFishService";
       String portName = "BabelFishPort";
      
       QName serviceQN = new QName(namespace, serviceName);
       QName portQN = new QName(namespace, portName);
      
       ServiceFactoryImpl sf = (ServiceFactoryImpl)ServiceFactory.newInstance();
       Service service = sf.createService(new URL(wsdlUrl), serviceQN);
      
       Call call = (Call) service.createCall(portQN,"BabelFish");
       String s = (String) call.invoke(new Object[]{"es_fr", "Hola Mundo"});
      
       System.out.println(s);
      
       }
      }


      I get the following error:

      Exception in thread "main" AxisFault
       faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
       faultSubcode:
       faultString: Read timed out
       faultActor:
       faultNode:
       faultDetail:
       {http://xml.apache.org/axis/}stackTrace: java.net.SocketTimeoutException: Read timed out
       at java.net.SocketInputStream.socketRead0(Native Method)
       at java.net.SocketInputStream.read(Unknown Source)
       at java.io.BufferedInputStream.fill(Unknown Source)
       at java.io.BufferedInputStream.read(Unknown Source)
       at org.jboss.axis.transport.http.HTTPSender.readHeadersFromSocket(HTTPSender.java:572)
       at org.jboss.axis.transport.http.HTTPSender.invoke(HTTPSender.java:130)
       at org.jboss.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:73)
       at org.jboss.axis.SimpleChain.doVisiting(SimpleChain.java:160)
       at org.jboss.axis.SimpleChain.invoke(SimpleChain.java:123)
       at org.jboss.webservice.client.ClientEngine.invoke(ClientEngine.java:128)
       at org.jboss.axis.client.Call.invokeEngine(Call.java:3054)
       at org.jboss.axis.client.Call.invoke(Call.java:3039)
       at org.jboss.axis.client.Call.invoke(Call.java:2629)
       at org.jboss.axis.client.Call.invoke(Call.java:2538)
       at org.jboss.axis.client.Call.invokeInternal(Call.java:1976)
       at org.jboss.axis.client.Call.invoke(Call.java:1914)
       at org.jboss.webservice.client.CallImpl.invoke(CallImpl.java:265)
       at com.BabelFishWS.main(BabelFishWS.java:31)
      
      
      org.jboss.axis.AxisFault: Read timed out
       at org.jboss.axis.AxisFault.makeFault(AxisFault.java:99)
       at org.jboss.axis.transport.http.HTTPSender.invoke(HTTPSender.java:136)
       at org.jboss.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:73)
       at org.jboss.axis.SimpleChain.doVisiting(SimpleChain.java:160)
       at org.jboss.axis.SimpleChain.invoke(SimpleChain.java:123)
       at org.jboss.webservice.client.ClientEngine.invoke(ClientEngine.java:128)
       at org.jboss.axis.client.Call.invokeEngine(Call.java:3054)
       at org.jboss.axis.client.Call.invoke(Call.java:3039)
       at org.jboss.axis.client.Call.invoke(Call.java:2629)
       at org.jboss.axis.client.Call.invoke(Call.java:2538)
       at org.jboss.axis.client.Call.invokeInternal(Call.java:1976)
       at org.jboss.axis.client.Call.invoke(Call.java:1914)
       at org.jboss.webservice.client.CallImpl.invoke(CallImpl.java:265)
       at com.BabelFishWS.main(BabelFishWS.java:31)
      Caused by: java.net.SocketTimeoutException: Read timed out
       at java.net.SocketInputStream.socketRead0(Native Method)
       at java.net.SocketInputStream.read(Unknown Source)
       at java.io.BufferedInputStream.fill(Unknown Source)
       at java.io.BufferedInputStream.read(Unknown Source)
       at org.jboss.axis.transport.http.HTTPSender.readHeadersFromSocket(HTTPSender.java:572)
       at org.jboss.axis.transport.http.HTTPSender.invoke(HTTPSender.java:130)
       ... 12 more
      


        • 1. Re: problem with babelfish
          Thomas Diesler Master

          Unfortunately Bablefish uses soap encoding, which is illegal with J2EE web services. But thats not the cause of the SocketTimeoutException.

          More likely

          http://services.xmethods.net:80/perl/soaplite.cgi

          was not responding.


          <?xml version="1.0"?>
          <definitions name="BabelFishService" xmlns:tns="http://www.xmethods.net/sd/BabelFishService.wsdl" targetNamespace="http://www.xmethods.net/sd/BabelFishService.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/">
           <message name="BabelFishRequest">
           <part name="translationmode" type="xsd:string"/>
           <part name="sourcedata" type="xsd:string"/>
           </message>
           <message name="BabelFishResponse">
           <part name="return" type="xsd:string"/>
           </message>
           <portType name="BabelFishPortType">
          
           <operation name="BabelFish">
           <input message="tns:BabelFishRequest" />
           <output message="tns:BabelFishResponse" />
           </operation>
           </portType>
           <binding name="BabelFishBinding" type="tns:BabelFishPortType">
           <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
           <operation name="BabelFish">
           <soap:operation soapAction="urn:xmethodsBabelFish#BabelFish"/>
          
           <input>
           <soap:body use="encoded" namespace="urn:xmethodsBabelFish" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
           </input>
           <output>
           <soap:body use="encoded" namespace="urn:xmethodsBabelFish" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
           </output>
           </operation>
           </binding>
           <service name="BabelFishService">
          
           <documentation>Translates text of up to 5k in length, between a variety of languages.</documentation>
           <port name="BabelFishPort" binding="tns:BabelFishBinding">
           <soap:address location="http://services.xmethods.net:80/perl/soaplite.cgi"/>
           </port>
           </service>
          </definitions>
          


          • 2. Re: problem with babelfish
            Mark Waschkowski Newbie

            Hi Thomas,

            Sorry for the delay in responding, just got back from a week at the cottage. Hard to come back to work you know? :)

            Anyway, thanks for the reply. I just tried it again and still same result. I went to:
            http://services.xmethods.net:80/perl/soaplite.cgi
            and I get nothing back, so I guess you are right that it was/is the problem.

            I'm not sure that I understand fully yet, because bablefish itself is working if you go through the web site. I guess its using a different service/port for its requests from the web site? I should see _something_ back from the service port right?

            Thanks again,

            Mark

            • 3. Re: problem with babelfish
              Thomas Diesler Master

              It is responding for me

              tdiesler@TDDELL /cygdrive/d/projects/jboss-head/testsuite
              $ wget --post-data=HiThere http://services.xmethods.net:80/perl/soaplite.cgi
              --12:45:48-- http://services.xmethods.net/perl/soaplite.cgi
               => `soaplite.cgi'
              Resolving services.xmethods.net... 64.124.140.30
              Connecting to services.xmethods.net[64.124.140.30]:80... connected.
              HTTP request sent, awaiting response... 500 Internal Server Error
              12:45:48 ERROR 500: Internal Server Error.
              


              You could try putting a valid soap message into a file and post that.