Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / December 2004

Tip: Looking for answers? Try searching our database.

C# web service and sproxy generated proxy problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark Sztainbok - 01 Dec 2004 11:13 GMT
I have a C# web service for which I have generated a C++ proxy using sproxy.
I'm having a problem with the generated proxy and one of the methods of the
web service. The method has the following signature:
public bool submitTemperatureData(String userId, String password, String
consignmentGUID, String uid, ConfigurationData configuration,
TemperatureData[] data, bool handheld, SignatureData[] signatureData)

The problem I'm having is that sproxy generates a proxy with the following
code which doesn't allow me to pass an null array for the data or
signatureData parameters (it returns E_POINTER):

emplate <typename TClient>

inline HRESULT CExagoDataServiceT<TClient>::submitTemperatureData(

BSTR userId,

BSTR password,

BSTR consignmentGUID,

BSTR uid,

ConfigurationData configuration,

TemperatureData* data, int __data_nSizeIs,

bool handheld,

SignatureData* signatureData, int __signatureData_nSizeIs,

bool* submitTemperatureDataResult

)

{

if ( data == NULL )

return E_POINTER;

if ( signatureData == NULL )

return E_POINTER;

if ( submitTemperatureDataResult == NULL )

return E_POINTER;

This problem has only happened since I upgraded my Visual Studio .NET 2002
project to Visual Studio .NET 2003 so the behaviour is specific to the
proxies generated by the 2003 version of sproxy.

Has anyone else had this problem? If so, how did they fix it? Is there
anyway to fix it without having to manually change the generated proxy file?

Any help would be greatly appreciated.

Thanks,

Mark
Dan Rogers - 01 Dec 2004 19:50 GMT
Hi,

I don't think it's valid to pass a null pointer for an array that is
required.  An option you do have is to change the generated code to the
behaviors you desire.

I hope this helps,

Dan Rogers
Microsoft Corporation
--------------------
>From: "Mark Sztainbok" <sz@myretsu.com>
>Subject: C# web service and sproxy generated proxy problem
[quoted text clipped - 7 lines]
>Message-ID: <#TM2$a51EHA.1408@TK2MSFTNGP10.phx.gbl>
>Newsgroups:
microsoft.public.dotnet.framework.aspnet.webservices,microsoft.public.vc.atl
,microsoft.public.vc.utilities,microsoft.public.webservices
>NNTP-Posting-Host: adsl-21-105.swiftdsl.com.au 218.214.21.105
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10
.phx.gbl
>Xref: cpmsftngxa10.phx.gbl microsoft.public.vc.atl:65264
microsoft.public.vc.utilities:17001 microsoft.public.webservices:2570
microsoft.public.dotnet.framework.aspnet.webservices:26929
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
[quoted text clipped - 59 lines]
>
>Mark
Mark Sztainbok - 01 Dec 2004 21:59 GMT
Thing is that according to the WSDL file, the array isn't required as it has
minOccurs =0.

The proxy generated by the 2002 version of sproxy allowed a null array to be
passed and converted it correctly to an XML nil which became null again when
the ASMX file processed it.

If I pass a zero length array to the 2003 proxy, it generates an assertion
but the data still successfully goes to the web service so the 2003 version
of atlsoap.h does support zero length and null arrays. Just code in the
proxy that disallows.

I could manually remove the checks for the null arrays but this would cause
problems within my team as if they have to regenerate the proxy for some
reason, they may not remember/know to make the changes to the generated
code.

Any ideas of a way around this?

Mark

> Hi,
>
[quoted text clipped - 18 lines]
> >Message-ID: <#TM2$a51EHA.1408@TK2MSFTNGP10.phx.gbl>
> >Newsgroups:

microsoft.public.dotnet.framework.aspnet.webservices,microsoft.public.vc.atl
> ,microsoft.public.vc.utilities,microsoft.public.webservices
> >NNTP-Posting-Host: adsl-21-105.swiftdsl.com.au 218.214.21.105
> >Path:

cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10
> phx.gbl
> >Xref: cpmsftngxa10.phx.gbl microsoft.public.vc.atl:65264
[quoted text clipped - 66 lines]
> >
> >Mark
Mark Sztainbok - 01 Dec 2004 22:21 GMT
Another problem is that when I do a Rebuild on the project, it regenerates
the proxy using sproxy and overwrites any changes that I've made...

Mark

> Thing is that according to the WSDL file, the array isn't required as it has
> minOccurs =0.
[quoted text clipped - 39 lines]
> > >Message-ID: <#TM2$a51EHA.1408@TK2MSFTNGP10.phx.gbl>
> > >Newsgroups:

microsoft.public.dotnet.framework.aspnet.webservices,microsoft.public.vc.atl

> > ,microsoft.public.vc.utilities,microsoft.public.webservices
> > >NNTP-Posting-Host: adsl-21-105.swiftdsl.com.au 218.214.21.105
> > >Path:

cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10
> > phx.gbl
> > >Xref: cpmsftngxa10.phx.gbl microsoft.public.vc.atl:65264
[quoted text clipped - 68 lines]
> > >
> > >Mark
Dan Rogers - 01 Dec 2004 23:31 GMT
Some issues here.  A "nill" in XML is not the same thing as not passing the
element since on the wire it turns into "<fooElement nill="true"/> instead
of not being expressed.  Have you considered a less cryptic interface - I
was not able to figure out why you would want to process a nothing?  If you
really mean to make it an optional processing element, try encapsulating
the arguments here into a type on it's own, and then making that type the
argument.

I think you are stumbling on some of the cross platform/language issues
that you'll encounter with this kind of interface.  I do know that the
sproxy tool does what it does, so we can't change that.  To me, I think
there is a big difference between a nill argument and a null pointer - and
since there aren't really pointers in the CLR, I think that this is a
work-around for the differences between the languages ... it seems to be
saying "you must pass a pointer.".

Sorry I am not of more help here.

Dan  
--------------------
>From: "Mark Sztainbok" <sz@myretsu.com>
>References: <#TM2$a51EHA.1408@TK2MSFTNGP10.phx.gbl>
<2KBsU891EHA.2732@cpmsftngxa10.phx.gbl>
>Subject: Re: C# web service and sproxy generated proxy problem
>Date: Thu, 2 Dec 2004 08:59:03 +1100
[quoted text clipped - 7 lines]
>NNTP-Posting-Host: ext58.myretsu.com 203.62.151.58
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10
.phx.gbl
>Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:26964
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
[quoted text clipped - 120 lines]
>> >
>> >Mark
Mark Sztainbok - 02 Dec 2004 01:24 GMT
I've done a diff between the source of atlsoap.h in VS .NET 2002 and 2003
and also done one of the generated proxy and there is minimal differences
between the 2 and the only change in the function calls is the extra NULL
checks at the beginning.

The code was interacting perfectly with the ASP.NET web service when it was
compiled with VC++ 2002 so why did they make the change in VC++ 2003 as it
breaks code that previously worked?????

Anyway, I changed the code to use a C# wrapper struct that simply contains
the array as suggested and sproxy allows me to pass the array as NULL and
works so looks like I have a solution. Just annoying that I had to do this.

Mark

> Some issues here.  A "nill" in XML is not the same thing as not passing the
> element since on the wire it turns into "<fooElement nill="true"/> instead
[quoted text clipped - 30 lines]
> >NNTP-Posting-Host: ext58.myretsu.com 203.62.151.58
> >Path:

cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10
> phx.gbl
> >Xref: cpmsftngxa10.phx.gbl
[quoted text clipped - 128 lines]
> >> >
> >> >Mark

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.