Please help me to pass a file!

Discussion in 'ASP .Net Web Services' started by Daniel Johansson, Aug 25, 2003.

  1. Hello everyone

    Im am trying to pass a binary file from a web service to a
    client.(managed c++)
    I wan´t to use dataset.
    If I put down the files in a dataset I loose information
    I got the tip the use DIME
    It doesn´t work.
    Not with WSE 1.0 SP1 or WSE 2.0
    If I choose to enable the WSE on "WSE Settings" under the "Project"
    I get the errormessage
    "The WSE must be installed to enable this feature"
    can this be of importance? Do I need a service pack 2 to .NET?
    Have I missed anything during the installation process?
    Are there any other possibility to:

    "pass a binary file in a dataset from a web service to a client"

    This is my problem, and it must have been solved before, again, the
    problem
    must have been solved before. I can´t be the first person with this
    problem.

    Hence my question is? Is this even possible? I´m pretty sure that I use
    a correct
    syntax, I have been in contact with Christian Meyer, MVP and he is also
    pretty sure
    that my code is accurate.

    With the upmost highest regards

    // Daniel



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Daniel Johansson, Aug 25, 2003
    #1
    1. Advertising

  2. Daniel Johansson

    hs Guest

    Hi Daniel
    Not sure if this helps. Is your objective to pass a binary file as a Dime
    attachment?
    If yes. Then just attach this bin file directly to dime. e.g.

    C#
    string filePath = "C:/myBinaryFile.bin";

    DimeAttachment attchment = new DimeAttachment("application/octet-stream",
    TypeFormatEnum.MediaType, filePath);
    HttpSoapContext.ResponseContext.Attachments.Clear();
    HttpSoapContext.ResponseContext.Attachments.Add(attachment);
    hs, Aug 26, 2003
    #2
    1. Advertising

  3. Daniel Johansson

    Frank Drebin Guest

    I am pretty sure the form that submits the file needs to post a content-type
    "form/multi-part"... crap, or whatever it's called.. it needs to tell your
    page, that it's a multi-part MIME page, and not just some form elements..

    Least helpful post. Ever. Sorry!! hth


    "Daniel Johansson" <> wrote in message
    news:eyoFa%...
    > Hi hs!
    >
    > Let me show what I already have tried!
    >
    > I´m using WSE 1.0 SP1 on Microsoft.NET framework 1.0
    >
    > Here goes.
    >
    > //Create a new DimeAttachment class
    > CString m_sFilepath = Server->MapPath("/.../.../");
    > CString m_sFilename(inFileName) ; // an incomming string
    > FileStream *fs;
    > try
    > {
    > fs = new FileStream(m_sFilepath +
    > m_sFilename,FileMode::Open,FileAccess::Read);
    > //copy stream to stream
    > unsigned char sbuf __gc[];
    > sbuf = new unsigned char __gc[fs->Length];
    > fs->Read(sbuf, 0, sbuf.Length);
    > MemoryStream *ms;
    > ms = new MemoryStream();
    > //close file
    > fs->Close();
    > //attach body
    > DimeAttachment* da;
    > da = new DimeAttachment("application/octet-stream",
    > TypeFormatEnum::MediaType, ms);
    > HttpSoapContext *hsc;
    > hsc->get_ResponseContext()->get_Attachments()->Clear();
    > hsc->get_ResponseContext()->get_Attachments()->Add(da);
    > }
    >
    > I can compile it but not run it, due to "Object not set to an instance"
    >
    > HttpSoapContext->ResponseContext->Attachments->Clear();
    > HttpSoapContext->ResponseContext->Attachments->Add(attachment);
    >
    > The above doesn´t work either. "Left of -> must point on a
    > class/struct/union/"
    >
    > I have had the thread in ExpertsExchange
    > http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Ne
    > t/Q_20714751.html#9208316
    > and CodeProject
    > http://www.codeproject.com/script/comments/forums.asp?msg=589636&forumid
    > =3785&mode=all&userid=534084#xx589636xx
    >
    > With the highest regards
    >
    > // Daniel
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    Frank Drebin, Aug 27, 2003
    #3
    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. Replies:
    4
    Views:
    506
    Chris Uppal
    May 5, 2005
  2. Jerry
    Replies:
    20
    Views:
    7,930
    Roedy Green
    Sep 9, 2005
  3. KK
    Replies:
    2
    Views:
    550
    Big Brian
    Oct 14, 2003
  4. MuZZy
    Replies:
    7
    Views:
    1,746
    Mike Hewson
    Jan 7, 2005
  5. Daniel Johansson

    Please help me to pass a file!

    Daniel Johansson, Aug 25, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    115
    Daniel Johansson
    Aug 25, 2003
Loading...

Share This Page