You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Sunanda Kariakarawana <su...@emirates.com> on 2005/09/06 14:46:41 UTC

Please help me on how to get XML stream through a service

Hi,

Can someone please help to get an xml stream through a service? I have
created a service. It will call a method in a java class which will query
the database and create the xml stream and return it to the service. From
the service I want to flush it to the response stream. I am using Tapestry
3.0.3 and Tomcat 4.1.12.

public class LOVService extends AbstractService
{
  public static final String SERVICE_NAME = "listOfValues";
  
  public ILink getLink(IRequestCycle cycle, IComponent component, Object[]
parameters)
  {
    return constructLink(cycle, SERVICE_NAME, null, parameters, true);
  }
  
  public void service(
      IEngineServiceView engine,
      IRequestCycle cycle,
      ResponseOutputStream output)
      throws ServletException, IOException
      {
      output.setContentType("text/xml");
      /*I am getting the xml here.*/
  }
   
  public String getName()
  {
    return SERVICE_NAME;
  }
} 

Thanks in advance.
Sunanda

Re: Please help me on how to get XML stream through a service

Posted by Damian Krzeminski <da...@pingtel.com>.
I am using this to download files form the server in the project I am working on 
(http://www.sipfoundry.org/sipXconfig/). Maybe it'll give you some ideas on how to solve your problem:

download service: 
http://scm.sipfoundry.org/rep/sipX/main/sipXconfig/web/src/org/sipfoundry/sipxconfig/components/DownloadService.java
download link:
http://scm.sipfoundry.org/rep/sipX/main/sipXconfig/web/src/org/sipfoundry/sipxconfig/components/DownloadLink.java

Do not forget to register your service in .application file.
Damian


Sunanda Kariakarawana wrote:
> Hi,
> 
> Can someone please help to get an xml stream through a service? I have
> created a service. It will call a method in a java class which will query
> the database and create the xml stream and return it to the service. From
> the service I want to flush it to the response stream. I am using Tapestry
> 3.0.3 and Tomcat 4.1.12.
> 
> public class LOVService extends AbstractService
> {
>   public static final String SERVICE_NAME = "listOfValues";
>   
>   public ILink getLink(IRequestCycle cycle, IComponent component, Object[]
> parameters)
>   {
>     return constructLink(cycle, SERVICE_NAME, null, parameters, true);
>   }
>   
>   public void service(
>       IEngineServiceView engine,
>       IRequestCycle cycle,
>       ResponseOutputStream output)
>       throws ServletException, IOException
>       {
>       output.setContentType("text/xml");
>       /*I am getting the xml here.*/
>   }
>    
>   public String getName()
>   {
>     return SERVICE_NAME;
>   }
> } 
> 
> Thanks in advance.
> Sunanda
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: Please help me on how to get XML stream through a service

Posted by Patrick Casey <pa...@adelphia.net>.
	How about something like:

	
	public void service(IEngineServiceView acrg0, IRequestCycle cycle,
			ResponseOutputStream response) throws
ServletException, IOException {
		Object[] parms = this.getParameters(cycle);
		
		Document d = <get zee Document>
		response.setContentType("text/xml");
		d.write(response);
	}

> -----Original Message-----
> From: Sunanda Kariakarawana [mailto:sunanda.k@emirates.com]
> Sent: Tuesday, September 06, 2005 5:47 AM
> To: tapestry-user@jakarta.apache.org
> Subject: Please help me on how to get XML stream through a service
> 
> Hi,
> 
> Can someone please help to get an xml stream through a service? I have
> created a service. It will call a method in a java class which will query
> the database and create the xml stream and return it to the service. From
> the service I want to flush it to the response stream. I am using Tapestry
> 3.0.3 and Tomcat 4.1.12.
> 
> public class LOVService extends AbstractService
> {
>   public static final String SERVICE_NAME = "listOfValues";
> 
>   public ILink getLink(IRequestCycle cycle, IComponent component, Object[]
> parameters)
>   {
>     return constructLink(cycle, SERVICE_NAME, null, parameters, true);
>   }
> 
>   public void service(
>       IEngineServiceView engine,
>       IRequestCycle cycle,
>       ResponseOutputStream output)
>       throws ServletException, IOException
>       {
>       output.setContentType("text/xml");
>       /*I am getting the xml here.*/
>   }
> 
>   public String getName()
>   {
>     return SERVICE_NAME;
>   }
> }
> 
> Thanks in advance.
> Sunanda



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org