Results 1 to 2 of 2

Thread: This is my client program..Hessian.

  1. #1
    Join Date
    Oct 2004
    Location
    singapore
    Posts
    11

    Default This is my client program..Hessian.

    Hi,

    This is my client program...

    URL url = new URL("http://localhost:8080/s2appv2/RemoteService");
    URLConnection uc = url.openConnection();
    FileInputStream fis = new FileInputStream(uploadFile);
    byte[] outbuf = new byte[ (int) uploadFile.length()];

    OutputStream os = uc.getOutputStream();
    HessianOutput out = new HessianOutput(os);
    out.startCall("uploadFile");

    while(-1 != (numBytes = fis.read(outbuf)) && !stop){
    out.writeBytes(outbuf);
    }
    out.completeCall();

    This is my Web.xml

    <servlet>
    <servlet-name>remote</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet-mapping>
    <servlet-name>remote</servlet-name>
    <url-pattern>/RemoteService</url-pattern>
    </servlet-mapping>


    This is my remote-servlet.xml

    <beans>
    <bean id="remoteService" class="com.surgosystems.common.ServiceInterfaceImp l"/>

    <bean name="/RemoteService" class="org.springframework.remoting.caucho.Hessian ServiceExporter">
    <property name="service"><ref bean="remoteService"/></property>
    <property name="serviceInterface">
    <value>com.surgosystems.common.ServiceInterface</value>
    </property>
    </bean>
    </beans>


    This is my ServiceInferfaceImpl Class

    public void uploadFile()
    {
    System.out.println("SUCCESSFUL : Upload Stream Saved to .");
    }


    Am I doing correct...coz when I run the client program I don't see any messages in the server console. Your help is greatly appreciated.

  2. #2
    Join Date
    Aug 2004
    Location
    Amsterdam, Netherlands
    Posts
    450

    Default

    Am I doing correct...coz when I run the client program I don't see any messages in the server console. Your help is greatly appreciated.
    If you're client program uses the right things (I don't know Hessian's client API that well), probably yes.

    But usage of the HessianServiceExporter is best done in combination with the HessianProxyFactoryBean. Using this (either setup programmatically or by including it in an app.ctx--mind you, all this at the lcient side), you don't have to do all this friggin' Hessian stuff yourself, it's all done for you.

    Have a look at the remoting docs, there's a pretty decent example there.

Similar Threads

  1. Replies: 2
    Last Post: Oct 10th, 2005, 05:12 PM
  2. Replies: 1
    Last Post: Aug 23rd, 2005, 09:24 AM
  3. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM
  4. Replies: 16
    Last Post: Nov 19th, 2004, 09:36 AM
  5. Protocol Exceptions with Hessian & Burlap
    By dortman in forum Remoting
    Replies: 1
    Last Post: Sep 28th, 2004, 02:08 PM

Posting Permissions

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