Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. "No appropriate constructor available"

"No appropriate constructor available"

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpc++question
12 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A adaoja

    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

    D Offline
    D Offline
    David Crow
    wrote on last edited by
    #2

    The HttpSoapContext class needs a default constructor. Can you show us the class declaration?

    A 1 Reply Last reply
    0
    • A adaoja

      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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #3

      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

      S D 2 Replies Last reply
      0
      • C Christian Graus

        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

        S Offline
        S Offline
        Steve S
        wrote on last edited by
        #4

        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.

        A 1 Reply Last reply
        0
        • D David Crow

          The HttpSoapContext class needs a default constructor. Can you show us the class declaration?

          A Offline
          A Offline
          adaoja
          wrote on last edited by
          #5

          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

          D 2 Replies Last reply
          0
          • S Steve S

            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.

            A Offline
            A Offline
            adaoja
            wrote on last edited by
            #6

            Hi Thank you both for the answer, I have previously tried both with and without the brackets. It´s a sealed class, does that make any difference? I have copied the class declaration in a reply above. Regards Daniel

            1 Reply Last reply
            0
            • C Christian Graus

              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

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #7

              Christian Graus wrote: For starters, it should say hsc = new HttpSoapContext(); hsc = new HttpSoapContext(); and hsc = new HttpSoapContext; are identical. They both call the default constructor.

              1 Reply Last reply
              0
              • A adaoja

                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

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #8

                This is the class documentation, not the declaration. A class's declaration is usually kept in a .H file.

                A 1 Reply Last reply
                0
                • D David Crow

                  This is the class documentation, not the declaration. A class's declaration is usually kept in a .H file.

                  A Offline
                  A Offline
                  adaoja
                  wrote on last edited by
                  #9

                  Hi Hmm.. I can´t find the declaration on my computer, is it possible? It´s under the namespace Microsoft.Web.Services imported from the dll with the same name. How do I proceed? // Daniel

                  1 Reply Last reply
                  0
                  • A adaoja

                    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

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #10

                    Oh well. I just wanted to see the available constructors. Is HttpSoapContext a C# thing?

                    A 1 Reply Last reply
                    0
                    • D David Crow

                      Oh well. I just wanted to see the available constructors. Is HttpSoapContext a C# thing?

                      A Offline
                      A Offline
                      adaoja
                      wrote on last edited by
                      #11

                      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

                      D 1 Reply Last reply
                      0
                      • A adaoja

                        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

                        D Offline
                        D Offline
                        David Crow
                        wrote on last edited by
                        #12

                        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.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups