Hi Rick,
I'm referring to this article: https://west-wind.com/wsdlgenerator/docs/_3420o5sp6.htm
I'm trying to pass an object "oData" to .NET via wwDotnetBridge. The object has two properties: ID (string) and XmlFile (byte array). First, I have to create the object in VFP by using CreateInstance() of wwDotnetBridge. Second, I have to set the two properties of the object oData.ID and oData.XmlFile. Third, I have to send the object with SendData(oData).
testXmlFile = FILETOSTR("C:\Temp\test.xml")
oData = loBridge.CreateInstance("ComInterop.MailData")
oData.ID = "123" && works
* oData.XmlFile(1) = CREATEBINARY(testXmlFile) && Error: The parameter is incorrect.
* Instead trying with InvokeMethod
loBridge.InvokeMethod(oData.ID(1), "passBinary", CREATEBINARY(testXmlFile)) && Error: System.DBNull.passBinary wasn't found
com = loBridge.CreateInstance("ComInterop.Operations")
success = com.SendData(oData)
[ClassInterface(ClassInterfaceType.AutoDual), Guid("..."), ComVisible(true)]
public class MailData
{
// Methods
...
// Properties
public string ID { get; set; }
public byte[] XmlFile { get; set; }
}
Obviously, I'm using InvokeMethod() the wrong way. Is there any way to achieve what I want, assigning the object oData a binary value?
Any help would be greatly appreciated.
Thanks, Manni
Had to switch to using another method of the Assembly. Sometimes it gets too hard to deal with the different types.
Thanks for reading, Manni
Well your syntax is definitely not right. I'm not sure what the (1)
means in that context but whatever it is, it's unlikely to point at the right things either for the assignment in your code or the instance passed to InvokeMethod()
.
+++ Rick ---
Sorry there was a mistake in the code posted, here is what I tried to do:
loBridge.InvokeMethod(oData.XmlFile, "passBinary", CREATEBINARY(testXmlFile)) && Error: System.DBNull.passBinary wasn't found
XmlFile is defined as
public byte[] XmlFile { get; set; }
in the C# assembly.