# Call opc-ua method

**URL:** <https://forum.inductiveautomation.com/t/call-opc-ua-method/54399>\
**Category:** Ignition\
**Created:** [December 22, 2021, 3:20pm UTC](https://forum.inductiveautomation.com/t/call-opc-ua-method/54399 "2021-12-22T15:20:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![francesco.patea](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@francesco.patea](https://forum.inductiveautomation.com/u/francesco.patea)\
**Post date:** [December 22, 2021, 3:20pm UTC](https://forum.inductiveautomation.com/t/call-opc-ua-method/54399/1 "2021-12-22T15:20:24Z")

</div>

Hi all,  
I try to send a file to a machine with opc-ua method.  
the method is:  
Method node “WriteProgram“: To transfer a program from client → machine  
BrowseName = “/ProgramAdministration/WriteProgram“  
DisplayName = “WriteProgram“

Input argument DataType Description  
Level Uint16 integer ( 0 / 1)  
Write machine program integer ( 0 / 1)  
Write robot program integer ( 0 / 1)  
Write configurable pages integer ( 0 / 1)  
Program ByteString Zipped program file to download \<\<------------\>\>

My code is:  
filePath = ‘/appli/’ //read data from file  
fileName = “filename.zip”  
file = open(filePath+fileName, “rb”)  
v\_data = file.read()  
file.close()  
result = system.opcua.callMethod( “M028783”, “ns=2;i=399860”, “ns=2;i=399790”,[1, 1, 0, 0,v\_data] /

Return  
result:((2158690304L, u’Bad\_InvalidArgument’, u’One or more arguments are invalid.’), [(0L, u’Good’, u’Good; unspecified.’), (0L, u’Good’, u’Good; unspecified.’), (0L, u’Good’, u’Good; unspecified.’), (0L, u’Good’, u’Good; unspecified.’), (2158690304L, u\*\*‘Bad\_InvalidArgument’, u’One or more arguments are invalid.’)], )\*\*

someone can help me to understand this issue?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 22, 2021, 3:21pm UTC](https://forum.inductiveautomation.com/t/call-opc-ua-method/54399/2 "2021-12-22T15:21:14Z")

</div>

Is this your coworker or something?

> [@Calling method on OPC UA server for file sending to a press](https://forum.inductiveautomation.com/t/calling-method-on-opc-ua-server-for-file-sending-to-a-press/54139/3):
>
> Try using system.file.readFileAsBytes instead of opening the file in Jython, which just gives you a String value. [https://docs.inductiveautomation.com/display/DOC81/system.file.readFileAsBytes](https://docs.inductiveautomation.com/display/DOC81/system.file.readFileAsBytes) You need to be on a least Ignition 8.1.1 for this to work I think.

---

<div class="post-metadata">

**Author:** ![francesco.patea](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@francesco.patea](https://forum.inductiveautomation.com/u/francesco.patea)\
**Post date:** [December 22, 2021, 3:40pm UTC](https://forum.inductiveautomation.com/t/call-opc-ua-method/54399/3 "2021-12-22T15:40:11Z")

</div>

thanks. I installed in dev env ignition 8.1.12 but it has some problem to open opc-ua connection… I’m waiting a response from the support
