|
oh, I known "First of all, SOAP Toolkit3.0 SDK or SOAP Toolkit3.0 Redistributable must be installed."
|
|
|
|
|
Hi bro,
I want to use SoapClient in my project but can not
declare the return value at MFC
Here is my code at .Net
dataGridView.DataSource = ServiceFunc.Test("pra1","pra2","pra3","pra4")
How can i declare at MFC
??? Test(LPCTSTR pra1, LPCTSTR pra2, LPCTSTR pra3, LPCTSTR pra4)
{
_variant_t varParams[4] = { pra1,pra2,pra3,pra4 };
_variant_t varResult;
m_hr = Invoke(L"Dat_Lenh", varParams, 4,&varResult);
???
Could u show me the way?
Thanks
|
|
|
|
|
I writed a webservice to test SoapClientBase class,
when call wrap web methods in local functions,the result of m_hr is E_INVALIDDARG ,someone meet the same thing, i need help, than:(ks
|
|
|
|
|
This means one of your parameters is not accepted by the API.
Check:the first parameter is the wsdl file (note: connecting to a http: protocol server requires a host name, NOT the IP address. Blame MS for that).
The second parameter is the Service as specified in the WSDL that you're calling.
The third parameter is the Port as specified in the WSDL.
So use your browser to view the wsdl, and use the values you see in it to populate your parameters.
|
|
|
|
|
Thanks for the great work,
My problem is the webservice i am accessing required username and password to connect to the webservice, In the intermediate class you have created in that in the init() you direclye creates oblect of the class, UI cannot see any way to pass username and password. Please help!!!.
Pavanbhai Pawar
Software Programmer,
Trans Tech Projects Pvt. Ltd.
Pune 411 004.
Mob: 9225527829
E-Mail Id:pawar@transtechprojects.com
Personal ID : pavanbhai_pawar@yahoo.com
|
|
|
|
|
First of all sorry for my English!!
I'm using this script to invoke a lot of web service and it works well.
I have a problem only with one web service with this attribute:
[SoapDocumentMethodAttribute]
Any idea??
Help me please!!
Lorenzo
|
|
|
|
|
I think that I have problem with complex type inside the WSDL!!
With this kind of type inside the wsdl my client crash. Is it possible??
Thanks in advance!
Lorenzo
Lorenzo Dalla Libera
|
|
|
|
|
I have the same problem... the arguments or parameters have complex type. Did you solve your problem? How?
Thanks,
Johann
|
|
|
|
|
i have developed a soap client using the high level interface and its working fine when i use webservices which return only one string back but if the webservice is returnning more than one complex data type it shows the result as "??????"
here is my code where i call the webservice and process the response.
hr = m_pSoapClient->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD, &dispparams, &result, &ExceptInfo, NULL);
if(FAILED(hr))
{
DisplayFault(_T("Invoke of method failed."));
}
else
{
VariantChangeType(&result, &result, 0, VT_BSTR);//line to be checked
// Display result.
// m_ResultCtl.SetWindowText(CString(result.bstrVal));
::MessageBox(NULL,CString(result.bstrVal),"HII",MB_OK);
}
|
|
|
|
|
Neil,
I am new to the MS world! Do you have a full example??
Cheers,
ted
|
|
|
|
|
I'm creating a client for a web service with VC6 on a Win2000 System.
The SOAP toolkit 3.0 is installed.
The Path to the DLL is ok C:\WINNT\system32\Mssoap30.dll
But I get allways this error:
soapclientbase.h(22) : error C2772: #import referenced a type from a missing type library; '__missing_type__' used as a placeholder
soapclientbase.h(22) : fatal error C1084: Cannot read type library file: 'C:\WINNT\system32\Mssoap30.dll': Fehler beim Laden der Typbibliothek/DLL.
Could anyone help me to solve this problem?
Have I maybe also to use the files mssoap30.lib and mssoap30.h of the toolkit?
Werner
|
|
|
|
|
hi,
I am trying to call webservice from a visual C++. whenever build the code i got the error
#pragma once
/****************************************************************************************************
Soap client helper class for C++
Usage:
1. Inherit a class from this base class
2. Call Init in constructor, like this:
Init("http://localhost/AuthService/AuthService.asmx?wsdl", "AuthService", "");
3. Wrap the webservice by writing proxy function for each web method
4. Call Invoke to execute the function, processing the input params and return value
be careful, the order of parameters should be reversed in the parameter array while callin Invoke
5. Then use this class to call webservice, like this:
AuthServiceClient service;
bool ret = service.IsAuthorized(strCode);
*******************************************************************************************************/
#include "SDKDef.h"
//import soapsdk
//modify the path if needed
#import "E:\Program Files\Common Files\MSSoap\Binaries\mssoap30.dll" \
exclude("IStream", "IErrorInfo", "ISequentialStream", "_LARGE_INTEGER", \
"_ULARGE_INTEGER", "tagSTATSTG", "_FILETIME")
using namespace MSSOAPLib30;
// Base class for calling a webservice using soap
class SoapClientBase
{
protected:
ISoapClient *m_pSoapClient;
char* m_pError;
HRESULT m_hr;
public:
SoapClientBase(void)
{
m_pSoapClient = NULL;
m_pError = NULL;
m_hr = 0;
}
virtual ~SoapClientBase(void)
{
Reset();
}
///////////////////////////////////////////////////////////////////
// Check error message issued by last call(if any)
char* GetLastError()
{
return m_pError;
}
////////////////////////////////////////////////////////////////
// Init SoapClient object
bool Init(char* szWSDLFile, char* szService, char* szPort)
{
Reset();
//create soapclient object
m_hr = ::CoCreateInstance(__uuidof(SoapClient30), NULL, CLSCTX_INPROC_SERVER, __uuidof(ISoapClient), (LPVOID *)&m_pSoapClient);
if (m_pSoapClient==NULL)
{
IssueError("Create soap client object fail");
return false;
}
//init soap client
_variant_t varWSDL = szWSDLFile;
_variant_t varWSML = "";
_bstr_t bstrService = szService;
_bstr_t bstrPort = szPort;
_bstr_t bstrNS = "";
m_hr = m_pSoapClient->MSSoapInit2(varWSDL, varWSML, bstrService, bstrPort, bstrNS);
if (FAILED(m_hr))
{
IssueError("Error calling MSSoapInit2");
return false;
}
return true;
}
protected:
///////////////////////////////////////////////////////////////////
// Record an error message issued by this class or inherited
void IssueError(char* szError)
{
if (m_pError)
delete [] m_pError;
m_pError = new char[strlen(szError)+1];
strcpy(m_pError, szError);
}
////////////////////////////////////////////////////////////////////
// Release interface, free memory, clean everything
void Reset()
{
if (m_pSoapClient)
{
m_pSoapClient->Release();
m_pSoapClient = NULL;
}
if (m_pError)
{
delete [] m_pError;
m_pError = NULL;
}
m_hr = S_OK;
}
protected:
/////////////////////////////////////////////////////////////////////////////////////////
// the following code is copied from ATL code(CComDispatchDriver), and modified
HRESULT GetIDOfName(LPCOLESTR lpsz, DISPID* pdispid)
{
return m_pSoapClient->GetIDsOfNames(IID_NULL, (LPOLESTR*)&lpsz, 1, LOCALE_USER_DEFAULT, pdispid);
}
// Invoke a method by DISPID with N parameters
HRESULT Invoke(DISPID dispid, VARIANT* pvarParams, int nParams, VARIANT* pvarRet = NULL)
{
DISPPARAMS dispparams = { pvarParams, NULL, nParams, 0};
return m_pSoapClient->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &dispparams, pvarRet, NULL, NULL);
}
// Invoke a method by name with Nparameters
HRESULT Invoke(LPCOLESTR lpszName, VARIANT* pvarParams, int nParams, VARIANT* pvarRet = NULL)
{
HRESULT hr;
DISPID dispid;
hr = GetIDOfName(lpszName, &dispid);
if (SUCCEEDED(hr))
hr = Invoke(dispid, pvarParams, nParams, pvarRet);
return hr;
}
};
error is :
error C2501: 'SoapClientBase::m_pSoapClient' : missing storage-class or type specifiers
error C2501: 'SoapClientBase::ISoapClient' : missing storage-class or type specifiers
error C2143: syntax error : missing ';' before '*'
error C2871: 'MSSOAPLib30' : a namespace with this name does not exist
please help me.
Brij Bihari Gupta(B.E.I.T.)
|
|
|
|
|
I hope this helps(even if it is late):
This problem ("missing storage-class or type specifiers") is generally caused by a misplaced #include "stdafx.h" .This line has to be the first "#include" in an .CPP file and must not be anywhere else(example: the .h file for that .cpp).The problem is generated by the "precompiled header" option of VC6.0(which is set by default).
|
|
|
|
|
Hi,
Iam trying to call webservice from a vc 6 win32 dll. Everything goes fine uptill the creation of inherited class, here is my code for inherited class
#pragma once
#include "SoapClientBase.h"
class ConsumeWEbService : public SoapClientBase
{
public:
ConsumeWEbService(void) : SoapClientBase()
{
Init("http://localhost/FXPWS/Service.asmx?wsdl", "ConsumeService", "");
}
LPCTSTR Identify(LPCTSTR input, LPCTSTR output, LPCTSTR schema)
{
_variant_t varParams[3] = { input, output, schema };
_variant_t varResult;
m_hr = Invoke(L"Identify", varParams, 3, &varResult);
return VARIANT_TRUE == varResult.boolVal;
}
};
Problem is when i try to create object of this class and I include the line #include "ConsumeWEbService.h" in any file of my project i got 102 errors, i know it has to do something with header file but can anybody guide me in this regard how i can call the service.
errors thrown are something like that:
error C2871: 'MSSOAPLib30' : does not exist or is not a namespace
error C2146: syntax error : missing ';' before identifier 'Dom'
error C2501: 'IXMLDOMDocumentPtr' : missing storage-class or type specifiers
error C2501: 'Dom' : missing storage-class or type specifiers
.
.
.
Bundle of thanks in advance, can anybody help me out?
|
|
|
|
|
You must have soap sdk installed first.
|
|
|
|
|
I have SOAP sdk 3.0 installed. I have included soap include and lib in my project directories. But errors are still coming while compiling. Is it possible that i can call VS.NET 2005 web service from VC6 win32 dll?
debug\mssoap30.tlh(201) : error C2146: syntax error : missing ';' before identifier 'Dom'
debug\mssoap30.tlh(201) : error C2501: 'IXMLDOMDocumentPtr' : missing storage-class or type specifiers
debug\mssoap30.tlh(201) : error C2501: 'Dom' : missing storage-class or type specifiers
debug\mssoap30.tlh(203) : error C2146: syntax error : missing ';' before identifier 'Envelope'
.
.
.
102 errors.
|
|
|
|
|
hi!
to remove this error add these line in ur stdAfx.h file before #endif
#import <msxml.dll> named_guids
using namespace MSXML;
Raj
|
|
|
|
|
add these lines before importing soap sdk
#import "msxml4.dll"
using namespace MSXML2;
|
|
|
|
|
Neither one of these worked for me.
|
|
|
|
|
Simply add...
#import <msxml4.dll>
... to stdafx.h to overcome this one. That's what gives you the smart pointers like IXMLDOMDocumentPtr. You'll need to rebuild your solution after this, if Visual Studio doesn't do it for you.
-- modified at 1:36 Wednesday 5th September, 2007
Rob
|
|
|
|
|
hello
you like make friends in China and all over the world.,.so lets start
any one have client server key logger code idea..plz reply me afri.591011@yahoo.com
|
|
|
|
|
hi
any one have client server key logger code idea..plz reply me afri.591011@yahoo.com
|
|
|
|
|
Hi,
I'm try to connect to a web service located on the Sun Application Server 9.0.
The service initialization goes well, but when I try to invoke the metod, it returns an error.
Does anybody know if the SOAP Toolkit 3 is incompatible with the Sun Application Server 9?
Thx
Luca
|
|
|
|
|
I am using Soap Client and my code is as the following.my question is How can I get Error message from varResult
Thanks.
#pragma once
#include "SoapClientBase.h"
class AuthServiceClient : public SoapClientBase
{
public:
AuthServiceClient(void) : SoapClientBase()
{
Init("http://localhost/AuthService/AuthService.asmx?wsdl", "AuthService", "");
}
bool IsAuthorized(LPCTSTR username, LPCTSTR password)
{
_variant_t varParams[2] = { password, username };
_variant_t varResult;
m_hr = Invoke(L"IsAuthorized", varParams, 2, &varResult);
return VARIANT_TRUE == varResult.boolVal;
}
};
|
|
|
|
|
try to debug your program and see what's in the varResult.
|
|
|
|
|