how to pass data directly in stream on the WS calls

Discussion in 'ASP .Net Web Services' started by Bob, Jun 24, 2004.

  1. Bob

    Bob Guest

    I'm trying to centralize some of the common Web User Controls used in all of
    our web applications (like header, footer) and put them in a web service to
    be called by all the other web applications. There are a couple of ways I
    can think of that can probably accomplish what I need. I'm most interested
    in rendering the control on the WS server end, and then stream the result to
    the consuming clients (the other web applications). I think this is
    definitely doable but just can't quite figure how this should work. The
    following is what I have so far on the WS server end in the asmx class:

    [WebMethod]
    public void GetPageHeader() {
    /*oad the user control */
    UserControl uc = new UserControl();
    UserControl header =
    (UserControl)uc.LoadControl(@"~\UI\HeaderNoMenu.ascx");

    /*render the user control into the HttpResponse stream */
    TextWriter tw = new
    StreamWriter(this.Context.Response.OutputStream);
    HtmlTextWriter htw = new HtmlTextWriter(tw);
    header.RenderControl(htw);
    }

    This compiles ok and runs without error when invoked from a browse (it
    doesn't show anything in the browser as expected). However, I'm not sure
    how to get the stream from the client end as no stream is exposed anywhere.
    A fragment of the proxy class generated is shown below.

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]

    [System.Web.Services.WebServiceBindingAttribute(Name="CommonUIElementsSoap",
    Namespace="http://tempuri.org/")]
    public class CommonUIElements :
    System.Web.Services.Protocols.SoapHttpClientProtocol {



    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.o
    rg/GetPageHeader", RequestNamespace="http://tempuri.org/",
    ResponseNamespace="http://tempuri.org/",
    Use=System.Web.Services.Description.SoapBindingUse.Literal,
    ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    public void GetPageHeader() {
    this.Invoke("GetPageHeader", new object[0]);
    }


    Do I need to implement something myself in order to get the stream, like
    maybe using SoapExtension class? Any suggestions would be helpful.
     
    Bob, Jun 24, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bob
    Replies:
    0
    Views:
    329
  2. Peter C
    Replies:
    1
    Views:
    645
    Hywel Jenkins
    Oct 6, 2003
  3. Steve Pugh
    Replies:
    2
    Views:
    634
    Peter C
    Oct 6, 2003
  4. vin pane
    Replies:
    6
    Views:
    395
    Jonathan Burd
    Jan 27, 2005
  5. mathieu
    Replies:
    7
    Views:
    419
    James Kanze
    Jan 4, 2008
Loading...

Share This Page