Board index » cppbuilder » ms soap sdk client m

ms soap sdk client m

Has anyone got the MS Soap SDK to work in BCB5?

I can load a WSDL file using the MSXML parser fine but loading the
same file with the SOAP client mssoapinit function gives an error
informing us that "WSDLReader: XML Parser failed at linenumber 0,
lineposition 0, reason is: The system cannot locate the object
specified."

Firstly the XML version, all is well:

  CComPtr<Msxml2_tlb::IXMLDOMDocument> pXMLDOMDocument;
  HRESULT HRes;

  if(SUCCEEDED( HRes =
pXMLDOMDocument.CoCreateInstance(Msxml2_tlb::CLSID_DOMDocument) ))
  {VARIANT_BOOL isSuccessful;

    pXMLDOMDocument->set_async(VARIANT_FALSE);
    pXMLDOMDocument->set_validateOnParse(VARIANT_TRUE);
    pXMLDOMDocument->set_resolveExternals(VARIANT_TRUE);

pXMLDOMDocument->load(TVariantInParam("http://www.epionet.com/webservices/epiowebservices/livecitycams.wsdl"),
(TOLEBOOL*)&isSuccessful);
    if( isSuccessful == VARIANT_FALSE)
    {
      long lErrorCode;
      pXMLDOMDocument->get_parseError()->get_errorCode(&lErrorCode);
      if(lErrorCode)
      {
        CComBSTR bstrReason;
        pXMLDOMDocument->get_parseError()->get_reason(&bstrReason);
        Edit1->Text = AnsiString(bstrReason);
      }
    }
    else
    {    
        Edit1->Text = "Success!";
    }
  }

and now the SOAP version which fails.

  CComPtr<ISOAPClient> pSOAPClient;
  HRESULT HRes;

  if(SUCCEEDED( HRes = pSOAPClient.CoCreateInstance(CLSID_SoapClient)
))
  {
    CComBSTR
bstrWSDLFile("http://www.epionet.com/webservices/epiowebservices/livecitycams.wsdl");
    HRes = pSOAPClient->set_ClientProperty( L"ServerHTTPRequest",
VARIANT_FALSE);

    // [1] Loads the specified WSDL file
    HRes = pSOAPClient->mssoapinit(bstrWSDLFile,
                                  NULL,
                                  NULL,
                                  NULL);

    if(FAILED( HRes))
    {
      Edit1->Text = pSOAPClient->faultstring;
    }
  }

Any tips or suggestions are much appreciated.
Thanks,

Mark

 

Re:ms soap sdk client m


On Thu, 18 Apr 2002 22:25:19 +0000 (UTC), ?@?.??? (Mark Holland)
wrote:

Quote

>Has anyone got the MS Soap SDK to work in BCB5?

I did get it to work. It prefferred WideString to CComBSTR

For your reference. How to access the shakespearean quote web service.
This is BCB 5

Header file.

//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------

#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>  
#include "MSSOAPLib_TLB.h"
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE-managed Components
  TEdit *edQuotation;
  TButton *btQuote;
  void __fastcall btQuoteClick(TObject *Sender);
private:        // User declarations

  TAutoDriver<ISOAPClient> pSOAPClient;

public:         // User declarations
  __fastcall TForm1(TComponent* Owner);
  __fastcall ~TForm1();

Quote
};

//---------------------------------------------------------------------------

CPP File

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)

{
  CoInitialize(NULL);

  pSOAPClient.Bind(CLSID_SoapClient);

  if(pSOAPClient.IsBound())
  {
    pSOAPClient->set_ClientProperty( L"ServerHTTPRequest",
VARIANT_TRUE);

    WideString
wstrWSDL("http://www.nickhodges.com/bin/ShakespeareWS.exe/wsdl/IShakespeare");
    if(SUCCEEDED( pSOAPClient->mssoapinit( (wstrWSDL), NULL, NULL,
NULL)))
    {
      pSOAPClient->set_ConnectorProperty(L"UseProxy", VARIANT_TRUE);
      btQuote->Enabled = true;
    }
    else
    {
      edQuotation->Text = pSOAPClient->faultstring;
    }
  }

Quote
}

//---------------------------------------------------------------------------
__fastcall TForm1::~TForm1()
{
  CoUninitialize();
Quote
}

//---------------------------------------------------------------------------
void __fastcall TForm1::btQuoteClick(TObject *Sender)
{                                                      
  HRESULT HRes;
  TAutoArgs<0> _args;

  HRes = pSOAPClient.Invoke(dfMethod,
WideString("GetShakespeareInsult"), &_args, true );
  TVariant vInsult(_args.GetRetVariant());
  if(vInsult.vt == VT_BSTR)
  {
    edQuotation->Text = vInsult;
  }

Quote
}

//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

Other Threads