Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: Passing arrays

$
0
0
Re: Passing arrays
Web Service Proxy Generator
Re: Passing arrays
04/03/2012
01:50:11 PM
3GY0TNQH1 Show this entire thread in new window
Gratar Image based on email address
From:
Rick Strahl
To:
Attachments:
None

Did you get this to work with the object interface?

+++ Rick ---



Thank you very much for your great support! - just placed an order on your Web store for this great product.

/Pål

You need to create an object instance and pass that. Not an array. Something like this:

loObj = loBridge.CreateInstance("namespace.typename") loObj.Property = "value" && works for most simple values // Use for properties that don't work (value types etc.) loBridge.SetProperty(loObj,"Property2",value) loResult = loBridge.InvokeMethod(loService,"Method",loObj);

+++ Rick ---



I'm afraid the code is not publically accessible, but I did receive some appendixes today, that they had forgotten... to send me. They seem to have
an object implementation also and I really think I should go that route - I think (and hope) you would agree...

The Proxy generator is new to me, but I was thinking along this line with VFP, does it make sense ?:

*-- Creates an instance loStructureListSite = loProxy.oBridge.CreateInstance('ServiceEAC.StructureListSite') loStructureListSite.Pwd = '' ... *-- Arrays creation loArr1 = loProxy.oBridge.CreateArray("System.String") loArr2 = loProxy.oBridge.CreateArray("System.String") *-- Add Items ? loArr1.AddItem('') ? loArr2.AddItem('') *-- Set properties ? loProxy.oBridge.SetProperty(loStructureListSite,'ListIdSite',loArr1) ? loProxy.oBridge.SetProperty(loStructureListSite,'InformationSite',loArr2) *-- lvResult = loProxy.oBridge.InvokeMethod(loProxy,"GetListSite",loStructureListSite)

Structure of the function ListSite:

public class StructureListSite { string _User; string _Pwd; string _IdTypeCA; string _DefaultIdSite; string[] _ListIdSite; string[] _InformationSite; int _State; [DataMember] public string User { get { return _User; } set { _User = value; } } [DataMember] public string Pwd { get { return _Pwd; } set { _Pwd = value; } } [DataMember] public string IdTypeCA { get { return _IdTypeCA; } set { _IdTypeCA = value; } } [DataMember] public string DefaultIdSite { get { return _DefaultIdSite; } set { _DefaultIdSite = value; } } [DataMember] public string[] ListIdSite { get { return _ListIdSite; } set { _ListIdSite = value; } } [DataMember] public string[] InformationSite { get { return _InformationSite; } set { _InformationSite = value; } } [DataMember] public int State { get { return _State; } set { _State = value; } } }

Is the code publically accessible? If so send me a link along with a code sample and I can try to run it. I can debug into wwDotnetBridge and see a little more error detail that might tell us what parameter is failing.

I know Reference parms are very tricky, but I don't remember offhand how that works - I actually have to look at the source code for this to see what I do with this.

Let me know....

+++ Rick ---



The .NET method was just copied from the Web Service documentation and it show's 6..., but both Reflector and the Proxy show's 8, so
I believe 8 must be correct.

Tried InvokeMethod - it gave me the same result.

I'm not surprised over your comment, so far it has not been a walk in the park trying to understand their documentation... I'll make contact
with them and check out, if they have supplied me with their latest documentation.

/Pål

There must be multiple overloads of the method you're trying to call because the method generated has 8 parameters while the .NET method you show has only 6. Check in Reflector to make sure you got the right signature - my guess is the one with 8 parameters has something different.

Part of the problem is that these parameters are reference parameters - I suspect that might cause problems when using InvokeMethod_ParameterArray because it won't know how to set the values back. I would try using InvokeMethod instead and passing the parameters in by refence.

FWIW, I can't help but marvel at the design of this service :-) Why would anybody create a service that has a bunch of out parameters when they could just return an object? Out parameters on a service are just never a good idea.

+++ Rick ---


I have downloaded the shareware version of the Proxy generator and I'm at the moment trying it out. It works like a charm
for other Web Service methods, that don't expect a string array passed in.

Have tried to read the documentation thoroughly, so I hope I haven't missed something obvious...
I receive a Type mismatch error back from the 'GetListSite2' method.

/Pål

The method 'GetListSite2' I'm talking to expect this:

int GetListSite2(string User, string Pwd, ref string IdTypeCA, ref string DefaultIdSite, ref string[] ListIdSite, ref string[] informationSite)

The proxy generated code:

FUNCTION GetListSite2(User as String,Pwd as String,IdTypeCA as String,DefaultIdSite as String,ListIdSite as StringArray,informationSite as StringArray,GetListSite2Result as Int32,GetListSite2ResultSpecified as Boolean) as Void LOCAL loException as Exception, lvResult as Void THIS.lError = .F. this.cErrorMsg = "" lvResult = .F. TRY lvResult = this.oService.GetListSite2(User,Pwd,@IdTypeCA,@DefaultIdSite,@ListIdSite,@informationSite,@GetListSite2Result,@GetListSite2ResultSpecified) CATCH to loException THIS.GetErrorDetail(loException) ENDTRY RETURN lvResult ENDFUNC

The test code from VFP:

LOCAL loArr as Westwind.WebConnection.ComArray loArr = loProxy.oBridge.CreateInstance("Westwind.WebConnection.ComArray") *-- Create the array instance with type loArr.Create("System.Object") loArr1 = loProxy.oBridge.CreateArray("System.String") loArr2 = loProxy.oBridge.CreateArray("System.String") *-- Add Items ? loArr1.AddItem('') ? loArr2.AddItem('') loArr.AddItem(' ') loArr.AddItem(' ') loArr.AddItem(m.IdTypeCA) loArr.AddItem(m.DefaultIdSite) loArr.AddItem(loArr1) loArr.AddItem(loArr2) loArr.AddItem(m.GetListSite2Result) loArr.AddItem(m.GetListSite2ResultSpecified) lcResult = loProxy.oBridge.InvokeMethod_ParameterArray(loProxy, "GetListSite2",loArr)












Rick Strahl
West Wind Technologies

Making waves on the Web

from Maui, Hawaii


Viewing all articles
Browse latest Browse all 10393

Trending Articles