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. ATL / WTL / STL
  4. Return String array from C++ ATL Server Web Service

Return String array from C++ ATL Server Web Service

Scheduled Pinned Locked Moved ATL / WTL / STL
c++tutorialcsharpwcfgraphics
3 Posts 3 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.
  • B Offline
    B Offline
    baker_tony
    wrote on last edited by
    #1

    Hi, I want to be able to pass back an array of CString's from an ATL Server Web Service to a C# web Form's application. Any ideas on how to do this? e.g. here is example code on returning a single string (a BSTR): namespace MyLabService { // all struct, enum, and typedefs for your webservice should go inside the namespace // IMyLabService - web service interface declaration // [ uuid("911E5A7B-194B-4070-B080-36234B341D15"), object ] __interface IMyLabService { // HelloWorld is a sample ATL Server web service method. It shows how to // declare a web service method and its in-parameters and out-parameters [id(1)] HRESULT HelloWorld([out, retval]BSTR *bstrOutput); }; // MyLabService - web service implementation // [ request_handler(name="Default", sdl="GenMyLabWSDL"), soap_handler( name="MyLabService", namespace="urn:MyLabService", protocol="soap" ) ] class CMyLabService : public IMyLabService { public: // This is a sample web service method that shows how to use the // soap_method attribute to expose a method as a web method [ soap_method ] HRESULT HelloWorld(/*[out, retval]*/ BSTR *bstrOutput) { CComBSTR bstrOut(L"Hello World"); *bstrOutput = bstrOut.Detach(); return S_OK; } }; // class CMyLabService } // namespace MyLabService Instead of: [id(1)] HRESULT HelloWorld([out, retval]BSTR *bstrOutput); I would like something like: [id(1)] HRESULT HelloWorld([out, retval]vector *Output); I would really appreciate help on this one!!!! Cheers, Tony.

    S T 2 Replies Last reply
    0
    • B baker_tony

      Hi, I want to be able to pass back an array of CString's from an ATL Server Web Service to a C# web Form's application. Any ideas on how to do this? e.g. here is example code on returning a single string (a BSTR): namespace MyLabService { // all struct, enum, and typedefs for your webservice should go inside the namespace // IMyLabService - web service interface declaration // [ uuid("911E5A7B-194B-4070-B080-36234B341D15"), object ] __interface IMyLabService { // HelloWorld is a sample ATL Server web service method. It shows how to // declare a web service method and its in-parameters and out-parameters [id(1)] HRESULT HelloWorld([out, retval]BSTR *bstrOutput); }; // MyLabService - web service implementation // [ request_handler(name="Default", sdl="GenMyLabWSDL"), soap_handler( name="MyLabService", namespace="urn:MyLabService", protocol="soap" ) ] class CMyLabService : public IMyLabService { public: // This is a sample web service method that shows how to use the // soap_method attribute to expose a method as a web method [ soap_method ] HRESULT HelloWorld(/*[out, retval]*/ BSTR *bstrOutput) { CComBSTR bstrOut(L"Hello World"); *bstrOutput = bstrOut.Detach(); return S_OK; } }; // class CMyLabService } // namespace MyLabService Instead of: [id(1)] HRESULT HelloWorld([out, retval]BSTR *bstrOutput); I would like something like: [id(1)] HRESULT HelloWorld([out, retval]vector *Output); I would really appreciate help on this one!!!! Cheers, Tony.

      S Offline
      S Offline
      Stefan Pedersen
      wrote on last edited by
      #2

      SAFEARRAY Don't have a clue how they are handled in C# though. Sorry.

      1 Reply Last reply
      0
      • B baker_tony

        Hi, I want to be able to pass back an array of CString's from an ATL Server Web Service to a C# web Form's application. Any ideas on how to do this? e.g. here is example code on returning a single string (a BSTR): namespace MyLabService { // all struct, enum, and typedefs for your webservice should go inside the namespace // IMyLabService - web service interface declaration // [ uuid("911E5A7B-194B-4070-B080-36234B341D15"), object ] __interface IMyLabService { // HelloWorld is a sample ATL Server web service method. It shows how to // declare a web service method and its in-parameters and out-parameters [id(1)] HRESULT HelloWorld([out, retval]BSTR *bstrOutput); }; // MyLabService - web service implementation // [ request_handler(name="Default", sdl="GenMyLabWSDL"), soap_handler( name="MyLabService", namespace="urn:MyLabService", protocol="soap" ) ] class CMyLabService : public IMyLabService { public: // This is a sample web service method that shows how to use the // soap_method attribute to expose a method as a web method [ soap_method ] HRESULT HelloWorld(/*[out, retval]*/ BSTR *bstrOutput) { CComBSTR bstrOut(L"Hello World"); *bstrOutput = bstrOut.Detach(); return S_OK; } }; // class CMyLabService } // namespace MyLabService Instead of: [id(1)] HRESULT HelloWorld([out, retval]BSTR *bstrOutput); I would like something like: [id(1)] HRESULT HelloWorld([out, retval]vector *Output); I would really appreciate help on this one!!!! Cheers, Tony.

        T Offline
        T Offline
        TW
        wrote on last edited by
        #3

        Use of SOAP 3 will save you a lot of time. Go MSDN and download the kit, look into the sample. String array can be a comma separated, Recordset, XML format. SAFEARRAY is in fact not more than a struct, why must you stuck with it? Be more creative in solving the problem. :)

        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