tried multi Part form with one file.pdf to own .Net listener
the "POST" did not arrive to "web server" ?
my example (took from craig, with some corrections) :
on :
httpRequest.SendFormDataArray...
got error, so I tried .POST
code example :
HttpMimeRequest ; S Q=$C(34)
S HOST = "127.0.0.1" ;"localhost" S PORT = "8080"
Set httpRequest=##class(%Net.HttpRequest).%New() Set httpRequest.Server=HOST Set httpRequest.Port = PORT
// Create root MIMEPart Set RootMIMEPart=##class(%Net.MIMEPart).%New()
//Create binary subpart and insert file data Set BinaryMIMEPart=##class(%Net.MIMEPart).%New()
Set contentDisp="" Set contentDisp=contentDisp_"form-data; name="_Q_"fileUpload"_Q Set contentDisp=contentDisp_"; filename="_Q_file_Q ;Set BinaryMIMEPart.ContentDisposition=contentDisp Do BinaryMIMEPart.SetHeader("Content-Disposition",contentDisp) Set BinaryMIMEPart.ContentType="application/pdf" ;"application/octet-stream"
Set ContentType= "multipart/form-data; boundary="_RootMIMEPart.Boundary Set httpRequest.ContentType=ContentType
// do we need it : ? Do BinaryMIMEPart.SetHeader("Content-Type", ContentType)
Set stream=##class(%FileBinaryStream).%New() Set stream.Filename=file Do stream.LinkToFile(file) Set BinaryMIMEPart.Body=stream
// Insert both subparts into the root part Do RootMIMEPart.Parts.Insert(BinaryMIMEPart)
// create MIME writer; write root MIME message Set writer=##class(%Net.MIMEWriter).%New()
// Prepare outputting to the HttpRequestStream Set status=writer.OutputToStream(httpRequest.EntityBody) if ('status) {do $SYSTEM.Status.DisplayError(status) Quit}
// Now write down the content Set status=writer.WriteMIMEBody(RootMIMEPart) if ('status) {do $SYSTEM.Status.DisplayError(status) Quit}
// QueryString Example ; Set jq = " index.htm?CUSTID=myCust"
I saw the 101-201 lectures, and it was very explanatory, to a developers, with not too much math background.
on the internet there are so much stuff,
but from this lecture I succeed to understand, and as developer I have the ability to implement it.
I want to implement a specific Neural net called : symbolic regression
given data-set(thousands rows, currently on a IRIS ^global) will predict next value , do you know on some existing Lab(prefered Microsoft tool) , so I can download and run , as you showed, in the lectures ?
or IRIS can add the SYMBOLIC REGRESSION in integratedML ?
go to post
Hi Stefan,
1.
yes , it's much closer, I'll check if it's actually fires the event.
2. each property\method definition in class I'll have to make the wrap on iris get/set (no connection to event)?
3. get method arguments byRef from the irisClass ?
did not see any doc about, can it be done ?
go to post
I ask, only on .myProperty (in class) string change
I can trigger this event , with .Net Notify ?
how is the code syntax for that ?
I have done it On older Cache .net provider
go to post
now I ask, only on .myProperty (in class) string change
can I "listen" to specific ^Global change or Node change ?
go to post
Hi Stefan,
1. this example looks, much better. and I understand your example.
you actually wrap property values set/get with Iris native commands get/set
2. now I want to add to this : .myProperty event handler,
so if .myProperty changed (in objectscript) I want to add in .Net notify listener
to fire event with .Net syntax ,
how can I do it ?
go to post
I think , I have difficulty to understand your example:
iris Class :
PCG.myClass
with property:
myProperty
set objMyClass = ##class(PCG.myClass).%New()
set objMyClass.myProperty = "string Property"
in .Net :
1. I need to wrap the : PCG.myClass
2. make an instance of the myClass
3. set to .myProperty as String value, I expect syntax :
objNetMyClass.myProprty = "String Text in .Net Project"
go to post
can you advice with code example, step-by-step
how to generate the proxy class, and then how I use it in .Net environment
go to post
>
can I set also :
oM["click"].type="double" ?
is the oM, persistent, like set ^oM("click","type")="double" ?
or actually, I want to set "^global" values by objects/methods syntax, but maintain the direct approach of ^globals ?
not using some clumsy .openId(?)
just get/set values
go to post
>do array.SetAt(downobject,"down")
how I set the: .id=val and .type=val1
go to post
Hi Eduard
I use cache 2018.1.4
IO.SocketClass
1. how to implement send JSON Array message via SocketClass ?
2. message that include file data(binary or base64) in one of the JSON Array "index" like:
["name", MyBinaryData, "12345"]
is the class methods limited by Cache String Max ?
if yes, how to bypass this obstucle ?
code examples on send / receive will help
go to post
Hi Marc,
I have another Topic, that did not get an answer (from26/08/2020) ,
can you help about, or notice the Owner ? :
Dmitriy,
1. I tried the open socket script, you wrote, and it works OK.
2.now I want to send some string messages on the opened socket,
how I do it ?
I have to add on each "MyMessage" string some header before ?
can you write exact script how I implement using send message(s), and handle get response on each
message.
did not find any docs about
go to post
Hi Marc,
1. I built ASP.NET some "server" http listener with [HttpPost] controller
2. I activate your code meanwhile on 1 file (.pdf)
with URL ...serverAsp/postfile/ ...
and got correctly the "file" from your POST() code, means in .NET:
var request = System.Web.HttpContext.Current.Request;
var files = request.Files.Count;
---> files.Count = 1
so .NET server recognized multi-part structure with 1 file !
4. I saw you made little changes to Craig code, and made it more simpler with just .Post(Url), without any "adapters"... and nor .SendFormDataArray...
that did not work for me in the beginning.
5. I'll made more testing , to see if the whole file is transfered correctly
but its seems to work.
thanks,
go to post
Hi Marc,
1.
P1 ;
Set url = HOST_"http://"_HOST_":"_PORT_"/"_jq
Set tSC = httpRequest.SendFormDataArray(.httpResponse,"POST", httpRequest, "", "", url)
//Set rc=httpRequest.Post(jq)
the error I get:
<METHOD DOES NOT EXIST>P1+2^HTTP3 *SendFormDataArray,%Net.HttpRequest
2. I asked berfore:
in what Part I set contentDisposition ?
I mean not in SetHeaders, but as another part in Body ?
or, I don't need it ?
go to post
tried multi Part form with one file.pdf to own .Net listener
the "POST" did not arrive to "web server" ?
my example (took from craig, with some corrections) :
on :
httpRequest.SendFormDataArray...
got error, so I tried .POST
code example :
HttpMimeRequest ;
S Q=$C(34)
S HOST = "127.0.0.1" ;"localhost"
S PORT = "8080"
Set httpRequest=##class(%Net.HttpRequest).%New()
Set httpRequest.Server=HOST
Set httpRequest.Port = PORT
// Create root MIMEPart
Set RootMIMEPart=##class(%Net.MIMEPart).%New()
//Create binary subpart and insert file data
Set BinaryMIMEPart=##class(%Net.MIMEPart).%New()
Set contentDisp=""
Set contentDisp=contentDisp_"form-data; name="_Q_"fileUpload"_Q
Set contentDisp=contentDisp_"; filename="_Q_file_Q
;Set BinaryMIMEPart.ContentDisposition=contentDisp
Do BinaryMIMEPart.SetHeader("Content-Disposition",contentDisp)
Set BinaryMIMEPart.ContentType="application/pdf" ;"application/octet-stream"
Set ContentType= "multipart/form-data; boundary="_RootMIMEPart.Boundary
Set httpRequest.ContentType=ContentType
// do we need it : ?
Do BinaryMIMEPart.SetHeader("Content-Type", ContentType)
Set stream=##class(%FileBinaryStream).%New()
Set stream.Filename=file
Do stream.LinkToFile(file)
Set BinaryMIMEPart.Body=stream
// Insert both subparts into the root part
Do RootMIMEPart.Parts.Insert(BinaryMIMEPart)
// create MIME writer; write root MIME message
Set writer=##class(%Net.MIMEWriter).%New()
// Prepare outputting to the HttpRequestStream
Set status=writer.OutputToStream(httpRequest.EntityBody)
if ('status) {do $SYSTEM.Status.DisplayError(status) Quit}
// Now write down the content
Set status=writer.WriteMIMEBody(RootMIMEPart)
if ('status) {do $SYSTEM.Status.DisplayError(status) Quit}
// QueryString Example ;
Set jq = " index.htm?CUSTID=myCust"
//set url="alfresco/service/sample/upload.json?"
// _"alf_ticket=TICKET_caee62bf36f0ea5bd51194fce161f99092b75f62"
;set url="http://localhost:8080"
;set status=httpRequest.Post(url,0)
;if ('status) {do $SYSTEM.Status.DisplayError(status) Quit}
P1 ;
;Set url = HOST_"http://"_HOST_":"_PORT_"/"_jq
;Set tSC = httpRequest.SendFormDataArray(.httpResponse,"POST", httpRequest, "", "", url)
Set rc=httpRequest.Post(jq)
//
go to post
Hi Craig,
I followed your code, there some obstacles, that I cannot implement your example :
1. I run the from standard Module.int (not class)
2. what is the syntax : ..%HttpRequest.SetHeader(...) ?
3. what is : ..Adapter.SendFormDataArray(.tHttpResponse,"POST", ..%HttpRequest, "", "", tURL) ?
what the ..Adapter means in standard module ?
I used just :
Set RootMIMEPart=##class(%Net.MIMEPart).%New()
Set BinaryMIMEPart=##class(%Net.MIMEPart).%New()
Set contentDisp=contentDisp_"form-data; name="_Q_"fileUpload"_Q
BPT> Set contentDisp=contentDisp_"; filename="_Q_file_Q
SET contentDisp=contentDisp_"; filename="_Q_file_Q
Set BinaryMIMEPart.ContentDisposition=contentDisp
Do BinaryMIMEPart.SetHeader("Content-Disposition",contentDisp)
Set BinaryMIMEPart.ContentType="application/octet-stream"
and so on...
using standard objects
go to post
extreme types , C# .net project <-> cache :
1. stream ,
can I use C# stream and setting it in Cache stream , any doc about or code example ?
2.C# ArraySegment to cache (2018.4) "array" or ^global ?
3. C# byte[] , as I mentioned above, is not working Cache as byte stream, maybe it's implemented as string settings.
4. from C# , call cache procedure , working ok,
but I did not found, how to get back an argument(or more than one) byRef ?
something like :
XTPcon.CallMyProc(proc,method,arg1, arg2, .BackVal1, .BackVal2)
no docs about
go to post
byte[] myByte....
node.Set(myByte)
if I set data from Image (or Bitmap) in byte[] array , it will be set correctly in : node.Set(myByte) ?
got error, in C# project :
InterSystems.Globals.GlobalsException: 'NodeReference.setBytesImpl: Array exceeds maximum length 3641144
go to post
Dmitriy,
1. I tried the open socket script, you wrote, and it works OK.
2.now I want to send some string messages on the opened socket,
how I do it ?
I have to add on each "MyMessage" string some header before ?
can you write exact script how I implement using send message(s), and handle get response on each
message.
did not find any docs about
go to post
VS code for object script as plugin in MS Visual Studio 2017
1. is it possible to add IS object script as plugin to MS VS2017,
so I can use normally C#, C++ , JavaScript ... and additionally as plugin with IS IRIS objectscript
with full Debug mode ?
2. Hebrew Fonts
in the standard VS2017 the Hebrew letters combined with English are working correctly
so I expect accordingly , the IRIS plugin will work OK.
3. now installing another VS Code ... (?) I think may harm the MS VS2017
regards
go to post
VS studio , with Hebrew Fonts also.
1. I use visual studio 2015 - microsoft for MS projects
it handle correctly Hebrew Language fonts.
2. the current ObjectScript studio (from cube), cannot handle correctly the Hebrew language(RTL) ?
what option you can advice for me:
1. enable to correct the Hebrew Font in intersystems Studio , so it will look ok ?
or :
2. add plugin IRIS (cache) to MS VS-2015 , so I can use Object script Code, additional to all Existing Code (C++,C#, javascript...)
installing another VS Code, I think can harm the VS2015
go to post
I saw the 101-201 lectures, and it was very explanatory, to a developers, with not too much math background.
on the internet there are so much stuff,
but from this lecture I succeed to understand, and as developer I have the ability to implement it.
I want to implement a specific Neural net called : symbolic regression
given data-set(thousands rows, currently on a IRIS ^global) will predict next value , do you know on some existing Lab(prefered Microsoft tool) , so I can download and run , as you showed, in the lectures ?
or IRIS can add the SYMBOLIC REGRESSION in integratedML ?
any help will be appreciated