Question Token Ibragimov · Apr 2, 2024

Hello!

Trying to configure tortoise GIT in Linux System

NAME="Red Hat Enterprise Linux Server"
VERSION="7.9 (Maipo)"
My steps

1. Enable [write-access](http://docs.intersystems.com/ens20151/csp/docbook/DocBook.UI.Page.cls?K…) to CACHELIB database via the Management Portal. (This is required for csp-page with settings import.)
2. Import project in %SYS:

    %SYS> do $system.OBJ.ImportDir("/arch/cache-tort-git-master/","*.xml","ck",,1)

3. Now you can disable write-access to CACHELIB.
4. In Management Portal select the new %SourceControl.

12
0 334
Question Token Ibragimov · Mar 7, 2024

Hello!

How I can send Synchronous request ?

For example when I cannot call another process until my first business process do not finish.

ClassMethod Main() {

 set sc = FirstProcess()

//Dont start until first process finish
set sc = SecondProcess() 

}

ClassMethod FirstProcess() {

Set sc = ##class(Ens.Director).CreateBusinessService("BusinessServiceName", .BService)

Set sc = BService.ProcessInput(BSRequest,.BSResponse)

}

ClassMethod SecondProcess() {

Set sc = ##class(Ens.Director).CreateBusinessService("BusinessServiceName", .BService)

Set sc = BService.
4
0 275
Question Token Ibragimov · Feb 28, 2024

Hello!

How I can call my Business process - "process.ReconciliationPayments" from method. Like this.

ClassMethod getReportPavlodarEnergoSbyt()
{

s sc = $$$OK

ensBS = ##class(Ens.BusinessService).%New()

requestObj.operationDate="2024-02-28"
requestObj.provider="Provider"
requestObj.processId=$SYSTEM.Util.CreateGUID()

ensBS.SendRequestAsync("process.ReconciliationPayments",requestObj"payment")

q sc

}

7
0 366
Question Token Ibragimov · Jan 11, 2024

Hello!

Trying to delete txt file in folder:  /tmp/test

set sc = ##class(%File).Delete("/tmp/test/test1.txt", .ret)

ret=-13

How I can delete file in Lunix system?

7
1 279
Question Token Ibragimov · Oct 31, 2023

Hello,

I'm making rest API service with Authentication.

How I can return HTTP Status 403 if user enter invalid login or password?

Now returning Http status 200.

Class RestAPI Extends %CSP.REST
{

XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap]
{
<Routes>

<Map Prefix="/restforms" Forward="Form.REST.Main"/>
<Route Url="/auth/:login/:pass" Method="GET" Call="CheckUser" Cors="true"/>
</Routes>
}

ClassMethod CheckUser(userAw, pwdAw) As %String
{

set %response.ContentType = "application/json"

// my code to check auth

Set object = {}
Set object.status = -1
Set object.message = "HTTP/1.

3
0 338
Question Token Ibragimov · Jan 23, 2023

Hello

i'm trying to read http json response from service. The response size  res.HttpResponse.Data.Size =  19610854 

ClassMethod getData(pCode,pDate, pGlb) As %Status
{

    Do res.Get("TestService/getData?dateTo="_$ZDate(pDate,3))
    Set stat=res.HttpResponse.StatusCode
    Do res.HttpResponse.Data.Rewind() 
    Set httpResponse=res.HttpResponse.Data.Read(res.HttpResponse.Data.Size,.sc)
    Set dynObj = [].%FromJSON(httpResponse)
    Set iter = dynObj.Stmt.%GetIterator()
    While iter.%GetNext(.key, .
2
1 612
Question Token Ibragimov · Mar 24, 2022

Hello!

I need to create strong random password including letters and integers. Does Cache Object Script has methods to generate password or I have to create my own method ?

6
0 714
Question Token Ibragimov · Feb 18, 2022

i have create rest api service. Trying to get value from post request:

{   "UserName": "Tom",  "UserID": 123 }

here is my class

Class User.REST Extends %CSP.REST
{ XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap]
{
<Routes>
<Map Prefix="/restforms" Forward="Form.REST.Main"/> <Route Url="/test" Method="GET" Call="test"/>
<Route Url="/CreatePost" Method="POST" Call="post" Cors="true"/>
</Routes>
}

ClassMethod post() As %Status
{
    set sc = $$$OK
    set req = %request.content
    set userName = req.

3
0 825
Question Token Ibragimov · Feb 16, 2022

Hello.

I'm trying add header to soap request.

header:

<soapenv:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-sece…">
        <wsse:UsernameToken>
            <wsse:Username>TEST</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-…">Test!123</wsse:Password>
        </wsse:UsernameToken>
    </wsse:Security>
</soapenv:Header>

I create class

Class WebService.Header Extends %SOAP.

4
0 738
Question Token Ibragimov · Oct 13, 2021

hello!

i have object bellow

Set object = ##class(%ZEN.proxyObject).%New()
set object.city = "New York"
set object.Target = "TEST" 
set object.Details = "TEST"
set object.RefCode = "123"
set object.Reason = "123TTTT"

I want to get string from json object. 

Could you help please ?

8
0 1188
Question Token Ibragimov · Jun 11, 2020

Hello,

I'm trying to upload file to SFTP server.  

I have access to SFTP server . 
My code is bellow 

Try {
Set sftp = ##class(%Net.SSH.Session).%New()

Set sc = sftp.AuthenticateWithUsername(username,password)
if 'sftp.Connect(host){
            Set status = $$$ERROR($$$GeneralError,"Cannot connect to sftp  ")
            Quit       
}
Set sc = sftp.OpenSFTP(.t)

If 'sftp.Disconnect() Write "Failed to logout",!

} Catch ex {
Set status=$$$ERROR($$$GeneralError,$ZE)
Quit
}

The output : $lb(5001,"Cannot connect to sftp "

What i'm doing wrong ?

10
1 2029
Question Token Ibragimov · Aug 8, 2019

Hello! I'm sending get request. When send the request bellow 

Set httprequest=##class(%Net.HttpRequest).%New()
Set httprequest.Server=url
Do httprequest.Get("/"_par1_"/"_par2)
 Set statusCode = httprequest.HttpResponse.StatusCode

I get http status 200, but should get 410 status. Since the parameters passed are not valid. 

If I send request differently as below, I get http status 410, which is correct. 

Do httprequest.Get("/2019/0912")

What is the difference between these two requests Do httprequest.Get("/"_par1_"/"_par2) and Do httprequest.Get("/2019/0912")?

8
1 424
Question Token Ibragimov · Jun 28, 2019

Hello,

I have a problem with sending soap request.

I get wsdl . The wsdl class bellow

Class Data.SOAP.PrinServ.NotificationRequest Extends (%RegisteredObject, %XML.Adaptor) [ ClassType = "", CompileAfter = Data.SOAP.PrinServ.Lang, Inheritance = right, ProcedureBlock ]
{

Parameter ELEMENTQUALIFIED = 1;

Parameter NAMESPACE = "http://tempuri.

3
0 625
Question Token Ibragimov · Feb 22, 2019

Hello,

I'm trying to convert JSON response to object in cache 2010.

My Code is bellow:

set sc = ##class(%ZEN.Auxiliary.jsonProvider).%ParseJSON(resptext,,.pObject,1)

my JSON response

{"access_token":"DSAFFDSGFDGTRHTRHTRH","in":"2522","refresh":"","scope":"send","token_type":"Bearer"}

the result :  "9@%ZEN.proxyObject" 

6
0 746
Question Token Ibragimov · Feb 11, 2019

Hello,
Having difficulty with sending POST request.

How I can send parameters in the body of request, if i'm using ContentType:"application/x-www-form-urlencoded".

Version of ensemble: 2010

My code is bellow:

Set httpRequest=##class(%Net.HttpRequest).%New()
set httpRequest.SSLConfiguration="1"
Set httpRequest.ContentCharset="utf-8"
Set httpRequest.Server="test.oath.com"
Set httpRequest.Port=443
Set httpRequest.Https=1
Set httpRequest.Location = "/auth/key"
set httpRequest.ContentType="application/x-www-form-urlencoded"
Set httpRequest.ContentCharset="utf-8"    
do httpRequest.EntityBody.

2
0 11379
Question Token Ibragimov · Dec 10, 2018

Hello!

I'm trying to get files from FTP server.  Bellow my code:

Set sc=$$$OK
    set ftp = ##class(%Net.FtpSession).%New()
    set ftp.Timeout = 5
    set host="speedtest.tele2.net"
    set port = 21
    
    If 'ftp.Connect(host,"USER","USER",port) Write ftp.ReturnMessage,! Quit sc
    Write "Ftp server messsage:",!,ftp.ReturnMessage,!
Set stream=##class(%GlobalCharacterStream).%New()
If 'ftp.Binary() Write "Can not swap to binary mode",! Quit sc
Write "Mode now: ",ftp.Type,!
If 'ftp.Retrieve("512KB.zip",stream) Write "Failed to get file",! Quit sc
Write "Length of file received: ",stream.Size,!
If 'ftp.

5
0 1724
Question Token Ibragimov · Sep 6, 2018

Hello!

I'm sending http resuest to the web service :

Set httpRequest=##class(%Net.HttpRequest).%New()
Set httpRequest.Server="177.127.120.10"
Set httpRequest.ContentType="text/xml" 
Set httpRequest.Https=1
Set httpRequest.ContentCharset="UTF-8"
Do httpRequest.SetHeader("Accept","text/xml")
Set httpRequest.Timeout=300     

Set xml="<CheckContractRequest><IIN>"_IINPay_"</IIN>"
_"<FirstName>"_name_"</FirstName>"
_"<LastName>"_surname_"</LastName>"
_"<MiddleName>"_middlename_"</MiddleName>"
_"<BirthDate>"_birthDate_"</BirthDate>"
_"<ContractType>CONST</ContractType></CheckContractRequest>"

do httpRequest.

13
0 1377
Question Token Ibragimov · Aug 14, 2018

Hello,

while sending JSON request :

Set Object = ##class(%ZEN.proxyObject).%New()
Set Object.iin="123132132"
Set Object.firstName=name
Set Object.lastName=surname
Set Object.middleName=middlename
Set Object.birthDate=birthDate
Set Object.contractType="Z001"

set sc = ##class(%ZEN.Auxiliary.jsonProvider).%ObjectToJSON(Object)

Set sc = ##class(%ZEN.Auxiliary.jsonProvider).%WriteJSONStreamFromObject(httpRequest.EntityBody, Object)

Set sc = httpRequest.Post("", 2)

receive error bellow:

"Corrupt body: json: cannot unmarshal number into Go struct field CheckContractRequest.iin of type string".

18
0 1684
Question Token Ibragimov · Aug 16, 2017

Hi!

When trying to receive xml response 

set sc = ##class(%XML.TextReader).ParseString(str,.reader)

I'm getting error bellow: 

Invalid character (Unicode: 0x1A) while processing Anonymous Stream at line 2 offset 281

 

How I can ignore this error? Thank you.

2
0 450
Question Token Ibragimov · Jun 9, 2017

hello!

how I can add to my request header? if i'm using web service.

s ws =##class(Data.SOAP.Base.Ws.ServiceSoap).%New()
s resp=##class(%XML.DataSet).%New()
s resp = ws.Getaccblocks(IIN)

i need send request like bellow

<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope
    xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
    xmlns:s='http://www.w3.org/2001/XMLSchema'>

<header>
.
2
0 599
Question Token Ibragimov · Jan 23, 2017

Hello,

I am a new member here . Could you help me to resolve the problem?

While sending request to WebServer I'm getting error: ERROR #6235: Unexpected namespace for tag CardData :

                    <CardData xmlns="http://111.12.123.11/">
                        <IBAN xmlns="">-</IBAN>
                        <ACCOUNT_BALANCE xmlns="">0.00</ACCOUNT_BALANCE>
                        <AVAILABLE_AMOUNT xmlns="">0.00</AVAILABLE_AMOUNT>
                        <CREDIT_LIMIT xmlns="">0.00</CREDIT_LIMIT>
                        <MAXIMUM_INSTALMENT xmlns="">0.

8
0 1519