Token Ibragimov · Jan 27, 2017 go to post

Hi Alexander!

I guess namespace should be xmlns="http://testws/"

Below code:

ws=##class(Data.SOAP.WSSoap).%New()

 xml="<request>"

 response = ws.GetContractsExt(xml)
response = ##class(Data.SOAP.PaymentResponseExt).%New()

Thank you for your response!

Token Ibragimov · Jan 27, 2017 go to post

Hi Alexander!

Please, below wsdl:

 

The version is :

Cache for UNIX (Red Hat Enterprise Linux 5 for x86-64) 2010.1.2 (Build 600U) Mon May 10 2010 23:28:54 EDT

Did you use SOAP Client Wizard to generate SOAP client classes from WSDL?

Yes

Thank you for your response!

Token Ibragimov · Aug 14, 2018 go to post

remove the line, but still getting error:

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

HTTP/1.1 400 Bad Request
ACCESS-CONTROL-ALLOW-CREDENTIALS: false
ACCESS-CONTROL-ALLOW-METHODS: POST
ACCESS-CONTROL-ALLOW-ORIGIN: *
ACCESS-CONTROL-EXPOSE-HEADERS: APIm-Debug-Trans-Id, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Global-Transaction-ID
CONNECTION: Keep-Alive
CONTENT-ENCODING: gzip
CONTENT-TYPE: text/plain
DATE: Tue, 14 Aug 2018 13:45:21 GMT
TRANSFER-ENCODING: chunked
X-BACKSIDE-TRANSPORT: OK OK
X-GLOBAL-TRANSACTION-ID: 647439117

Token Ibragimov · Aug 14, 2018 go to post

set sc=##class(Example.TEST).Check(901205300353,"Ivan","Ivanov","Ivanovich","05.12.1990","Z")                                                    
User-Agent: IBM-APIConnect/5.0
Host: 127.0.0.1
Accept-Encoding: gzip
x-ibm-client-id: test
x-ibm-client-secret: test
Content-Length: 180
Content-Type: application/json; charset=utf-8
 
{
        "birthDate":"05.12.1990",
        "contractType":"Z",
        "firstName":"Ivan",
        "iin":901205300353,
        "lastName":"Ivanov",
        "middleName":"Ivanovich"
}1POST /test/ HTTP/1.1

Token Ibragimov · Aug 15, 2018 go to post

Thanks a lot Eduard!

Could you say how to parse JSON response in my case?

the response:

{

    "code": 0,

    "message": "OK"

}

Token Ibragimov · Aug 22, 2018 go to post

Hi Eduard!

still didn't parse the response.  Here is my code, can you help please?

Set httpResponse=httpRequest.HttpResponse.Data

Set sc = ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(httpResponse,,.Object,1)

Token Ibragimov · Aug 23, 2018 go to post

Forgot to mention that I added ClassMethod %ConvertJSONToObject to %ZEN.Auxiliary.jsonProvider. Is it correct ?

the response is empty: resp=""

I check the code in cache version2016 . 

When set property

Set httpRequest.SSLCheckServerIdentity=0, 

the response was successfull :

HTTP/1.1 200 OK
ACCESS-CONTROL-ALLOW-CREDENTIALS: false
ACCESS-CONTROL-ALLOW-METHODS: POST
ACCESS-CONTROL-ALLOW-ORIGIN: *
ACCESS-CONTROL-EXPOSE-HEADERS: 
CONNECTION: Keep-Alive
CONTENT-ENCODING: gzip
CONTENT-TYPE: application/json
DATE: Thu, 23 Aug 2018 03:31:32 GMT
TRANSFER-ENCODING: chunked
USER-AGENT: IBM-APIConnect/5.0
X-BACKSIDE-TRANSPORT: OK OK
X-GLOBAL-TRANSACTION-ID: 699524573
 
{"code":0,"message":"OK"}
httpResponse="{""code"":0,""message"":""OK""}"

Token Ibragimov · Sep 7, 2018 go to post

Hi Eduard!

Thank you for your response.  I have change the code,  method return output status=0. 

I have sent the request using Postman utility and receive the response after 30 seconds. 

how i can know that request was sent sussecfully and how to get readable response? Thank you.

Token Ibragimov · Sep 7, 2018 go to post
Set sc = httpRequest.Post("/sample/", 1)

The output:

set sc=##class(Example.TEST).xmlRequest("891208300335","Ivan","Ivanov","Ivanovich","08.12.1989","ОПВ")
POST /sample/ HTTP/1.1
User-Agent: IBM-APIConnect/5.0
Host: 172.27.139.151
Accept-Encoding: gzip
Accept: text/xml
x-ibm-client-id: adsad-adsadsa-asdsad
x-ibm-client-secret: 13213213asdsadsadsad
Content-Length: 251
Content-Type: text/xml; charset=UTF-8
 
<CheckContractRequest><IIN>891208300335</IIN><FirstName>Ivan</FirstName>
<LastName>Ivanov</LastName><MiddleName>Ivanovich</MiddleName>
<BirthDate>08.12.1989</BirthDate><ContractType>ОПВ</ContractType></CheckContractRequest>0

Set sc = httpRequest.Post("/sample/", 2)
zw sc

output: sc=1

Token Ibragimov · Sep 7, 2018 go to post

sc=1
0

resp=<OBJECT REFERENCE>[138@%Net.HttpResponse]
+----------------- general information ---------------
|      oref value: 138
|      class name: %Net.HttpResponse
| reference count: 3
+----------------- attribute values ------------------
|    ContentBoundary = ""
|        ContentInfo = ""
|      ContentLength = ""
|        ContentType = ""
|               Data = "139@%Stream.GlobalBinary"
|        HttpVersion = ""
|       ReasonPhrase = ""
|         StatusCode = ""
|         StatusLine = ""
 
 

Token Ibragimov · Sep 13, 2018 go to post

Hello Eduard!

Now I'm getting error: 415 Unsupported Media Type.  In the code i set:

Do httpRequest.SetHeader("accept","text/xml")
Set httpRequest.ContentType="text/xml"   

HTTP/1.1 415 Unsupported Media Type
ACCESS-CONTROL-ALLOW-CREDENTIALS: false
ACCESS-CONTROL-ALLOW-METHODS: POST
ACCESS-CONTROL-ALLOW-ORIGIN: *
ACCESS-CONTROL-EXPOSE-HEADERS: APIm-Debug-Trans-Id, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Global-Transaction-ID
CONNECTION: Keep-Alive
CONTENT-ENCODING: gzip
CONTENT-TYPE: text/plain
DATE: Thu, 13 Sep 2018 13:55:03 GMT
TRANSFER-ENCODING: chunked
USER-AGENT: IBM-APIConnect/5.0
X-BACKSIDE-TRANSPORT: OK OK
X-GLOBAL-TRANSACTION-ID: 2956707581
 
Unsupported Media Type
str=<OBJECT REFERENCE>[19@%Stream.FileCharacterGzip]
+----------------- general information ---------------
|      oref value: 19
|      class name: %Stream.FileCharacterGzip
|           %%OID: $lb("C:\InterSystems\Ensemble2016\mgr\Temp\VqdL7hXdFahzDg.http","%Stream.FileCharacterGzip","")
| reference count: 3
+----------------- attribute values ------------------
|     (%Concurrency) = 1
|          %Location = ""  <Set>
|         (%LockRef) = ""
|          (%Locked) = 0
|              AtEnd = 0
|                BOM = ""
|         (CurrFile) = ""
|                 Id = "C:\InterSystems\Ensemble2016\mgr\Temp\VqdL7hXdFahzDg.http"  <Set>
|     LineTerminator = $c(13,10)  <Set>
|      (MakePermLoc) = 0
|             (Mode) = 1
|(NormalizedDirectory) = "C:\InterSystems\Ensemble2016\mgr\Temp\"
|(OidTranslateTable) = "RAW"
|         (ReadMode) = 0
|           ReadSize = 48
|      RemoveOnClose = 1
|        (StoreFile) = "VqdL7hXdFahzDg.http"
|  StreamFormatWrite = 1
|         (TempFile) = ""
|     TranslateTable = "RAW"  <Set>
|      UseVMSVersion = 0
|   (VariableRecord) = 0

Token Ibragimov · Sep 14, 2018 go to post

compare headers between postman and cache I found the difference in content type.  

In postman : Content-Type: text/xml

In cache: Content-Type: text/xml; charset=UTF-8

How I can remove charset=UTF-8 from header in cache ?

Token Ibragimov · Sep 14, 2018 go to post

Thanks a lot Eduard! It's working. But another problem has occured: the response is non readable: 

<?xml version="1.0" encoding="UTF-8"?>
 <CheckContractResponse><code>-1</code><message>Неверный тип договора</message></CheckContractResp>

Token Ibragimov · Feb 22, 2019 go to post

Hello Eduard! Thank you for feedback.

In my case it doesn't work, the output: 

Set ^tk("object")=pObject
Set ^tk("access_token1")=pObject."access_token"
Set ^tk("access_token2")=pObject.in

the response:

^tk("respText")="{""access_token"":""4SDFDSFDSF-aSDASDASD"",""expires_in"":""3300"",""refresh_token"":"""",""scope"":""sms_send"",""token_type"":""Bearer""}"

^tk("access_token1")=""
^tk("access_token2")="" 

^tk("object")="9@%ZEN.proxyObject"

Token Ibragimov · Mar 27, 2019 go to post

Hello!

Trying to unrar archive in terminal , but the process is blocked.   

Cache run in Windows server 2012

Code bellow

        Set cmdLine="""C:\Program Files (x86)\WinRAR\Rar.exe"" x "_path_" *.dbf "_pathToExt
        Set errCode=$ZF(-100,cmdLine)

Why the command is not executed?

Token Ibragimov · Mar 27, 2019 go to post

 Hello, Eduard! Thanks for the answer!

I change to $ZF(-1) and it works

Set cmdLine="""C:\Program Files (x86)\WinRAR\Rar.exe"" x "_"C:\billing\gor.rar "_"*.dbf"_" C:\billing\"
 Set errCode=$ZF(-1,cmdLine)