"No appropriate constructor available"
-
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
The
HttpSoapContext
class needs a default constructor. Can you show us the class declaration? -
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
For starters, it should say hsc = new HttpSoapContext(); Other than that, HttpSoapContext obviously needs something passed into it's constructor, there's no constructor that takes no parameters. You may or may not have worked that out from the prior response. The other possibility is that HttpSoapContext is a class in the .NET framework, unless you're using Managed C++, there is no guarentee this class even *exists* in the C++ framework you're using. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
-
For starters, it should say hsc = new HttpSoapContext(); Other than that, HttpSoapContext obviously needs something passed into it's constructor, there's no constructor that takes no parameters. You may or may not have worked that out from the prior response. The other possibility is that HttpSoapContext is a class in the .NET framework, unless you're using Managed C++, there is no guarentee this class even *exists* in the C++ framework you're using. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
Are the brackets mandatory for the default ctor then, or are you just hammering home the point? I know in the past I've done things like ps = new CString; without complaint/problems at runtime* Steve S *DEVELOPER101: Just because it compiles, that doesn't mean it will work.
-
The
HttpSoapContext
class needs a default constructor. Can you show us the class declaration?Hi Thank you for the answer, the class declaration goes as follows. ******************************* HttpSoapContext Class HttpSoapContext Members | Microsoft.Web.Services Namespace Requirements Namespace: Microsoft.Web.Services Platforms: Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family Assembly: Microsoft.Web.Services (in Microsoft.Web.Services.dll) Provides access to the SoapContext associated with a SOAP request and SOAP response for XML Web services created using ASP.NET. This class cannot be inherited. For a list of all members of this type, see HttpSoapContext Members. System.Object Microsoft.Web.Services.HttpSoapContext [C++] public __gc __sealed class HttpSoapContext Thread Safety Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe. Remarks The SoapContext provides access to the WS-Security, WS-Routing, and other XML Web services architecture-specific details associated with a SOAP message. Use this class to gain access from within an XML Web service to the the SoapContext associated with a SOAP request through the static members RequestContext and ResponseContext.When an XML Web service method is a one-way method, an XML Web service cannot gain access to the SoapContext using the static members of this class. To gain access to the SoapContext for one-way methods, the class implementing the XML Web service should inherit from System.Web.Services.WebService and add code within the one-way method to get the Context property. Requirements Namespace: Microsoft.Web.Services Platforms: Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family Assembly: Microsoft.Web.Services (in Microsoft.Web.Services.dll) ******************************** Regards Daniel
-
Are the brackets mandatory for the default ctor then, or are you just hammering home the point? I know in the past I've done things like ps = new CString; without complaint/problems at runtime* Steve S *DEVELOPER101: Just because it compiles, that doesn't mean it will work.
-
For starters, it should say hsc = new HttpSoapContext(); Other than that, HttpSoapContext obviously needs something passed into it's constructor, there's no constructor that takes no parameters. You may or may not have worked that out from the prior response. The other possibility is that HttpSoapContext is a class in the .NET framework, unless you're using Managed C++, there is no guarentee this class even *exists* in the C++ framework you're using. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
Christian Graus wrote: For starters, it should say hsc = new HttpSoapContext();
hsc = new HttpSoapContext();
andhsc = new HttpSoapContext;
are identical. They both call the default constructor. -
Hi Thank you for the answer, the class declaration goes as follows. ******************************* HttpSoapContext Class HttpSoapContext Members | Microsoft.Web.Services Namespace Requirements Namespace: Microsoft.Web.Services Platforms: Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family Assembly: Microsoft.Web.Services (in Microsoft.Web.Services.dll) Provides access to the SoapContext associated with a SOAP request and SOAP response for XML Web services created using ASP.NET. This class cannot be inherited. For a list of all members of this type, see HttpSoapContext Members. System.Object Microsoft.Web.Services.HttpSoapContext [C++] public __gc __sealed class HttpSoapContext Thread Safety Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe. Remarks The SoapContext provides access to the WS-Security, WS-Routing, and other XML Web services architecture-specific details associated with a SOAP message. Use this class to gain access from within an XML Web service to the the SoapContext associated with a SOAP request through the static members RequestContext and ResponseContext.When an XML Web service method is a one-way method, an XML Web service cannot gain access to the SoapContext using the static members of this class. To gain access to the SoapContext for one-way methods, the class implementing the XML Web service should inherit from System.Web.Services.WebService and add code within the one-way method to get the Context property. Requirements Namespace: Microsoft.Web.Services Platforms: Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family Assembly: Microsoft.Web.Services (in Microsoft.Web.Services.dll) ******************************** Regards Daniel
This is the class documentation, not the declaration. A class's declaration is usually kept in a .H file.
-
This is the class documentation, not the declaration. A class's declaration is usually kept in a .H file.
-
Hi Thank you for the answer, the class declaration goes as follows. ******************************* HttpSoapContext Class HttpSoapContext Members | Microsoft.Web.Services Namespace Requirements Namespace: Microsoft.Web.Services Platforms: Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family Assembly: Microsoft.Web.Services (in Microsoft.Web.Services.dll) Provides access to the SoapContext associated with a SOAP request and SOAP response for XML Web services created using ASP.NET. This class cannot be inherited. For a list of all members of this type, see HttpSoapContext Members. System.Object Microsoft.Web.Services.HttpSoapContext [C++] public __gc __sealed class HttpSoapContext Thread Safety Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe. Remarks The SoapContext provides access to the WS-Security, WS-Routing, and other XML Web services architecture-specific details associated with a SOAP message. Use this class to gain access from within an XML Web service to the the SoapContext associated with a SOAP request through the static members RequestContext and ResponseContext.When an XML Web service method is a one-way method, an XML Web service cannot gain access to the SoapContext using the static members of this class. To gain access to the SoapContext for one-way methods, the class implementing the XML Web service should inherit from System.Web.Services.WebService and add code within the one-way method to get the Context property. Requirements Namespace: Microsoft.Web.Services Platforms: Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family Assembly: Microsoft.Web.Services (in Microsoft.Web.Services.dll) ******************************** Regards Daniel
Oh well. I just wanted to see the available constructors. Is
HttpSoapContext
a C# thing? -
Oh well. I just wanted to see the available constructors. Is
HttpSoapContext
a C# thing?I guess so, but it has a "C++ definition" since [Visual Basic] NotInheritable Public Class HttpSoapContext [C#] public sealed class HttpSoapContext [C++] public __gc __sealed class HttpSoapContext [JScript] public class HttpSoapContext ... hence it should be supported in c++ also. Is there a problem that the class is sealed? I haven´t had any problem with other conversions from C# into C++ when I have worked with web services. Regards Daniel
-
I guess so, but it has a "C++ definition" since [Visual Basic] NotInheritable Public Class HttpSoapContext [C#] public sealed class HttpSoapContext [C++] public __gc __sealed class HttpSoapContext [JScript] public class HttpSoapContext ... hence it should be supported in c++ also. Is there a problem that the class is sealed? I haven´t had any problem with other conversions from C# into C++ when I have worked with web services. Regards Daniel
adaoja wrote: Is there a problem that the class is sealed? It just means that it can't be a base class. Other than that, I do not know. Regardless, it sounds like you need to supply some parameters during construction of the object.