"No appropriate constructor available"

D

Daniel Johansson

Hi

I´m new to C++ and working with passing files back and fourth to a
webservice. I have found som code in C# that does this for me but I can´t
convert it into C++. Can someone please help me with the two last lines?

DimeAttachment attachment = new DimeAttachment("application/octet-stream",
TypeFormatEnum.MediaType, ms);
HttpSoapContext.ResponseContext.Attachments.Clear();
HttpSoapContext.ResponseContext.Attachments.Add(attachment);

I keep on getting the error C2512

....
HttpSoapContext *hsc;
hsc = new HttpSoapContext;
....

is not possible


Regards

// Daniel
 
T

Tanveer Gani [MSFT]

--------------------
From: "Daniel Johansson" <[email protected]>
Subject: "No appropriate constructor available"
Date: Tue, 19 Aug 2003 21:39:51 +0200
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <#[email protected]>
Newsgroups: microsoft.public.dotnet.languages.vc
NNTP-Posting-Host: cauchy.campus.luth.se 130.240.197.152
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vc:27371
X-Tomcat-NG: microsoft.public.dotnet.languages.vc

Hi

I´m new to C++ and working with passing files back and fourth to a
webservice. I have found som code in C# that does this for me but I can´t
convert it into C++. Can someone please help me with the two last lines?

DimeAttachment attachment = new DimeAttachment("application/octet-stream",
TypeFormatEnum.MediaType, ms);
HttpSoapContext.ResponseContext.Attachments.Clear();
HttpSoapContext.ResponseContext.Attachments.Add(attachment);

I keep on getting the error C2512

...
HttpSoapContext *hsc;
hsc = new HttpSoapContext;
...

is not possible


Regards

// Daniel

Daniel,

I don't see a "new HttpSoapContext" in the C# code. You're mistranslating
the code. The C# version of "." in C++ is either of ".", "->" or "::"
depending on context. So it, could be, e.g.,

HttpSoapContext::ResponseContext::Attachments::Add(attachment);

or

HttpSoapContext::ResponseContext->Attachements.Add(attachment);

etc.

You need more information about the classes and namespaces in the
assemblies referenced by the C# code.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top