By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,771 Members | 1,685 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,771 IT Pros & Developers. It's quick & easy.

SOAP Proxy for VC++

P: n/a
Hello,

Please help me to resolve next problem: I have Web service
installed on the network and I can communicate with it via
WSDL file from several applications including VC++6
application using SOAP Toolkit 2. After that I installed
VC++ .NET 2003 and tried to generate proxy class
using 'Add Web Reference .' menu (SProxy.exe). This wizard
just failed to generate right proxy class because it
always returns S_OK error code, but can't read data from
Web Service. I've checked generated code and didn't see
any functions name as part of argument of 'SendRequest()'
function.

Here is my WSDL file:
<?xml version="1.0" encoding="utf-8"?>
<definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://soapinterop.org/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
targetNamespace="http://soapinterop.org/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types />
<message name="echoStringRequest">
<part name="inputString" type="s:string" />
</message>
<message name="echoStringResponse">
<part name="return" type="s:string" />
</message>
<message name="multIntRequest">
<part name="input" type="s:int" />
</message>
<message name="multIntResponse">
<part name="return" type="s:int" />
</message>
<portType name="InteropTestPortType">
<operation name="echoString">
<input message="tns:echoStringRequest" />
<output message="tns:echoStringResponse" />
</operation>
<operation name="multInt">
<input message="tns:multIntRequest" />
<output message="tns:multIntResponse" />
</operation>
</portType>
<binding name="InteropTestBinding"
type="tns:InteropTestPortType">
<soap:binding
transport="http://schemas.xmlsoap.org/soap/http"
style="rpc" />
<operation name="echoString">
<soap:operation soapAction="http://stage-
internal.reflectivity.com/nusoap_server.html"
style="rpc" />
<input>
<soap:body use="encoded"
namespace="http://soapinterop.org/"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /
</input>
<output>
<soap:body use="encoded"
namespace="http://soapinterop.org/"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" / </output>
</operation>
<operation name="multInt">
<soap:operation soapAction="http://stage-
internal.reflectivity.com/nusoap_server.html"
style="rpc" />
<input>
<soap:body use="encoded"
namespace="http://soapinterop.org/"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" / </input>
<output>
<soap:body use="encoded"
namespace="http://soapinterop.org/"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /

</output>
</operation>
</binding>
<service name="InteropTest">
<port name="InteropTestPort"
binding="tns:InteropTestBinding">
<soap:address location="http://stage-
internal.reflectivity.com/nusoap_server.html" />
</port>
</service>
</definitions>
///////////////////////////////////////////////////////////
///////////
And Here is generated by SProxy.exe class for VC++ .NET
2003:

//
// sproxy.exe generated file
// do not modify this file
//
// Created: 09/15/2003@15:45:53
//

#pragma once
#ifndef _WIN32_WINDOWS
#pragma message("warning: defining _WIN32_WINDOWS =
0x0410")
#define _WIN32_WINDOWS 0x0410
#endif

#include <atlsoap.h>

namespace InteropTest
{

template <typename TClient = CSoapSocketClientT<> >
class CInteropTestT :
public TClient,
public CSoapRootHandler
{
protected:

const _soapmap ** GetFunctionMap();
const _soapmap ** GetHeaderMap();
void * GetHeaderValue();
const wchar_t * GetNamespaceUri();
const char * GetServiceName();
const char * GetNamespaceUriA();
HRESULT CallFunction(
void *pvParam,
const wchar_t *wszLocalName, int
cchLocalName,
size_t nItem);
HRESULT GetClientReader(ISAXXMLReader **ppReader);

public:

HRESULT __stdcall QueryInterface(REFIID riid, void
**ppv)
{
if (ppv == NULL)
{
return E_POINTER;
}

*ppv = NULL;

if (InlineIsEqualGUID(riid, IID_IUnknown)
||
InlineIsEqualGUID(riid,
IID_ISAXContentHandler))
{
*ppv =
static_cast<ISAXContentHandler *>(this);
return S_OK;
}

return E_NOINTERFACE;
}

ULONG __stdcall AddRef()
{
return 1;
}

ULONG __stdcall Release()
{
return 1;
}

CInteropTestT(ISAXXMLReader *pReader = NULL)
:TClient(_T("http://stage-
internal.reflectivity.com/nusoap_server.html"))
{
SetClient(true);
SetReader(pReader);
}

~CInteropTestT()
{
Uninitialize();
}

void Uninitialize()
{
UninitializeSOAP();
}

HRESULT echoString(
BSTR inputString,
BSTR* __retval
);

HRESULT multInt(
int input,
int* __retval
);
};

typedef CInteropTestT<> CInteropTest;

struct __CInteropTest_echoString_struct
{
BSTR inputString;
BSTR __retval;
};

extern __declspec(selectany) const _soapmapentry
__CInteropTest_echoString_entries[] =
{

{
0x0B8B8DA7,
"inputString",
L"inputString",
sizeof("inputString")-1,
SOAPTYPE_STRING,
SOAPFLAG_NONE | SOAPFLAG_IN | SOAPFLAG_RPC
| SOAPFLAG_ENCODED | SOAPFLAG_NULLABLE,
offsetof(__CInteropTest_echoString_struct,
inputString),
NULL,
NULL,
-1,
},
{
0x11515F60,
"return",
L"return",
sizeof("return")-1,
SOAPTYPE_STRING,
SOAPFLAG_NONE | SOAPFLAG_OUT |
SOAPFLAG_RPC | SOAPFLAG_ENCODED | SOAPFLAG_NULLABLE,
offsetof(__CInteropTest_echoString_struct,
__retval),
NULL,
NULL,
-1,
},
{ 0x00000000 }
};

extern __declspec(selectany) const _soapmap
__CInteropTest_echoString_map =
{
0xC9995F96,
"echoString",
L"echoString",
sizeof("echoString")-1,
sizeof("echoString")-1,
SOAPMAP_FUNC,
__CInteropTest_echoString_entries,
sizeof(__CInteropTest_echoString_struct),
1,
-1,
SOAPFLAG_NONE | SOAPFLAG_RPC | SOAPFLAG_ENCODED,
0x534A4B71,
"http://soapinterop.org/",
L"http://soapinterop.org/",
sizeof("http://soapinterop.org/")-1
};
struct __CInteropTest_multInt_struct
{
int input;
int __retval;
};

extern __declspec(selectany) const _soapmapentry
__CInteropTest_multInt_entries[] =
{

{
0x07AA4A90,
"input",
L"input",
sizeof("input")-1,
SOAPTYPE_INT,
SOAPFLAG_NONE | SOAPFLAG_IN | SOAPFLAG_RPC
| SOAPFLAG_ENCODED,
offsetof(__CInteropTest_multInt_struct,
input),
NULL,
NULL,
-1,
},
{
0x11515F60,
"return",
L"return",
sizeof("return")-1,
SOAPTYPE_INT,
SOAPFLAG_NONE | SOAPFLAG_OUT |
SOAPFLAG_RPC | SOAPFLAG_ENCODED,
offsetof(__CInteropTest_multInt_struct,
__retval),
NULL,
NULL,
-1,
},
{ 0x00000000 }
};

extern __declspec(selectany) const _soapmap
__CInteropTest_multInt_map =
{
0xDF5AA74D,
"multInt",
L"multInt",
sizeof("multInt")-1,
sizeof("multInt")-1,
SOAPMAP_FUNC,
__CInteropTest_multInt_entries,
sizeof(__CInteropTest_multInt_struct),
1,
-1,
SOAPFLAG_NONE | SOAPFLAG_RPC | SOAPFLAG_ENCODED,
0x534A4B71,
"http://soapinterop.org/",
L"http://soapinterop.org/",
sizeof("http://soapinterop.org/")-1
};

extern __declspec(selectany) const _soapmap *
__CInteropTest_funcs[] =
{
&__CInteropTest_echoString_map,
&__CInteropTest_multInt_map,
NULL
};

template <typename TClient>
inline HRESULT CInteropTestT<TClient>::echoString(
BSTR inputString,
BSTR* __retval
)
{
if ( __retval == NULL )
return E_POINTER;

HRESULT __atlsoap_hr = InitializeSOAP(NULL);
if (FAILED(__atlsoap_hr))
{
SetClientError
(SOAPCLIENT_INITIALIZE_ERROR);
return __atlsoap_hr;
}

CleanupClient();

CComPtr<IStream> __atlsoap_spReadStream;
__CInteropTest_echoString_struct __params;
memset(&__params, 0x00, sizeof(__params));
__params.inputString = inputString;

__atlsoap_hr = SetClientStruct(&__params, 0);
if (FAILED(__atlsoap_hr))
{
SetClientError(SOAPCLIENT_OUTOFMEMORY);
goto __skip_cleanup;
}

__atlsoap_hr = GenerateResponse(GetWriteStream());
if (FAILED(__atlsoap_hr))
{
SetClientError(SOAPCLIENT_GENERATE_ERROR);
goto __skip_cleanup;
}

__atlsoap_hr = SendRequest(_T("SOAPAction:
\"http://stage-
internal.reflectivity.com/nusoap_server.html\"\r\n"));
if (FAILED(__atlsoap_hr))
{
goto __skip_cleanup;
}
__atlsoap_hr = GetReadStream
(&__atlsoap_spReadStream);
if (FAILED(__atlsoap_hr))
{
SetClientError(SOAPCLIENT_READ_ERROR);
goto __skip_cleanup;
}

// cleanup any in/out-params and out-headers from
previous calls
Cleanup();
__atlsoap_hr = BeginParse(__atlsoap_spReadStream);
if (FAILED(__atlsoap_hr))
{
SetClientError(SOAPCLIENT_PARSE_ERROR);
goto __cleanup;
}

*__retval = __params.__retval;
goto __skip_cleanup;

__cleanup:
Cleanup();
__skip_cleanup:
ResetClientState(true);
memset(&__params, 0x00, sizeof(__params));
return __atlsoap_hr;
}

template <typename TClient>
inline HRESULT CInteropTestT<TClient>::multInt(
int input,
int* __retval
)
{
if ( __retval == NULL )
return E_POINTER;

HRESULT __atlsoap_hr = InitializeSOAP(NULL);
if (FAILED(__atlsoap_hr))
{
SetClientError
(SOAPCLIENT_INITIALIZE_ERROR);
return __atlsoap_hr;
}

CleanupClient();

CComPtr<IStream> __atlsoap_spReadStream;
__CInteropTest_multInt_struct __params;
memset(&__params, 0x00, sizeof(__params));
__params.input = input;

__atlsoap_hr = SetClientStruct(&__params, 1);
if (FAILED(__atlsoap_hr))
{
SetClientError(SOAPCLIENT_OUTOFMEMORY);
goto __skip_cleanup;
}

__atlsoap_hr = GenerateResponse(GetWriteStream());
if (FAILED(__atlsoap_hr))
{
SetClientError(SOAPCLIENT_GENERATE_ERROR);
goto __skip_cleanup;
}

__atlsoap_hr = SendRequest(_T("SOAPAction:
\"http://stage-
internal.reflectivity.com/nusoap_server.html\"\r\n"));
if (FAILED(__atlsoap_hr))
{
goto __skip_cleanup;
}
__atlsoap_hr = GetReadStream
(&__atlsoap_spReadStream);
if (FAILED(__atlsoap_hr))
{
SetClientError(SOAPCLIENT_READ_ERROR);
goto __skip_cleanup;
}

// cleanup any in/out-params and out-headers from
previous calls
Cleanup();
__atlsoap_hr = BeginParse(__atlsoap_spReadStream);
if (FAILED(__atlsoap_hr))
{
SetClientError(SOAPCLIENT_PARSE_ERROR);
goto __cleanup;
}

*__retval = __params.__retval;
goto __skip_cleanup;

__cleanup:
Cleanup();
__skip_cleanup:
ResetClientState(true);
memset(&__params, 0x00, sizeof(__params));
return __atlsoap_hr;
}

template <typename TClient>
ATL_NOINLINE inline const _soapmap **
CInteropTestT<TClient>::GetFunctionMap()
{
return __CInteropTest_funcs;
}

template <typename TClient>
ATL_NOINLINE inline const _soapmap **
CInteropTestT<TClient>::GetHeaderMap()
{
static const _soapmapentry
__CInteropTest_echoString_atlsoapheader_entries[] =
{
{ 0x00000000 }
};

static const _soapmap
__CInteropTest_echoString_atlsoapheader_map =
{
0xC9995F96,
"echoString",
L"echoString",
sizeof("echoString")-1,
sizeof("echoString")-1,
SOAPMAP_HEADER,

__CInteropTest_echoString_atlsoapheader_entries,
0,
0,
-1,
SOAPFLAG_NONE | SOAPFLAG_RPC |
SOAPFLAG_ENCODED,
0x534A4B71,
"http://soapinterop.org/",
L"http://soapinterop.org/",
sizeof("http://soapinterop.org/")-1
};

static const _soapmapentry
__CInteropTest_multInt_atlsoapheader_entries[] =
{
{ 0x00000000 }
};

static const _soapmap
__CInteropTest_multInt_atlsoapheader_map =
{
0xDF5AA74D,
"multInt",
L"multInt",
sizeof("multInt")-1,
sizeof("multInt")-1,
SOAPMAP_HEADER,

__CInteropTest_multInt_atlsoapheader_entries,
0,
0,
-1,
SOAPFLAG_NONE | SOAPFLAG_RPC |
SOAPFLAG_ENCODED,
0x534A4B71,
"http://soapinterop.org/",
L"http://soapinterop.org/",
sizeof("http://soapinterop.org/")-1
};
static const _soapmap * __CInteropTest_headers[] =
{

&__CInteropTest_echoString_atlsoapheader_map,
&__CInteropTest_multInt_atlsoapheader_map,
NULL
};

return __CInteropTest_headers;
}

template <typename TClient>
ATL_NOINLINE inline void *
CInteropTestT<TClient>::GetHeaderValue()
{
return this;
}

template <typename TClient>
ATL_NOINLINE inline const wchar_t *
CInteropTestT<TClient>::GetNamespaceUri()
{
return L"http://soapinterop.org/";
}

template <typename TClient>
ATL_NOINLINE inline const char *
CInteropTestT<TClient>::GetServiceName()
{
return NULL;
}

template <typename TClient>
ATL_NOINLINE inline const char *
CInteropTestT<TClient>::GetNamespaceUriA()
{
return "http://soapinterop.org/";
}

template <typename TClient>
ATL_NOINLINE inline HRESULT
CInteropTestT<TClient>::CallFunction(
void *,
const wchar_t *, int,
size_t)
{
return E_NOTIMPL;
}

template <typename TClient>
ATL_NOINLINE inline HRESULT
CInteropTestT<TClient>::GetClientReader(ISAXXMLRea der
**ppReader)
{
if (ppReader == NULL)
{
return E_INVALIDARG;
}

CComPtr<ISAXXMLReader> spReader = GetReader();
if (spReader.p != NULL)
{
*ppReader = spReader.Detach();
return S_OK;
}
return TClient::GetClientReader(ppReader);
}

} // namespace InteropTest

///////////////////////////////////////////////////////////
////////////

I've tried to call multInt(33, &iRes) and return code was
S_OK, but iRes was always = 0. This function should return
2*33 = 66 and it works with soap toolkit 2 and WSP wizard
for VC++6.

Thanks a lot for your time,
Regards
Leonid

Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.