Home > Software engineering >  Consult! Vc6.0 program how to invoke the Java API to upload data
Consult! Vc6.0 program how to invoke the Java API to upload data

Time:10-02

As title, attach a code, has created the JVM virtual machine,
//for the test. The Demo CLASS, returns the JAVA CLASS CLASS object
Jclass CLS=theApp. Env - & gt; FindClass (" test/Demo ");
//according to the CLASS object of a CLASS to obtain an instance of this CLASS
Jobject obj=theApp. Env - & gt; AllocObject (CLS);

//get method in a class, the last parameter is the signature of the method, through the javap - s - p filename can gain
JmethodID mid=theApp. Env - & gt; GetMethodID (CLS, "append", "(Ljava/lang/String; I) Ljava/lang/String;" );
//object structure parameters and call the method
Const char szTest []="telecommunications";
Jstring arg=NewJString (theApp env, szTest);
Jstring MSG=(jstring) theApp. Env - & gt; CallObjectMethod (obj, mid, arg, 12);
String szvalue=https://bbs.csdn.net/topics/JStringToCString (theApp env, MSG);

The following is the interface documentation:
4 HTTP URL call example
4.1 call way
The URL FORMAT:
http://[url] : [port]/[fjyg/]/resource ${ResID}? _app_id_=${_app_id_value} & amp; _license_key_=${_license_key_value} & amp; ParamKey1=${Paramvalue1} & amp; ParamKey2=${ParamValue2}... .

The parameter name description
http://[url] : [port]/[fjyg/]/resource service address such as: localhost: 8080/crtmisweb_pr/resource
ResID service names such as:/syservice ctop/crtmis/owner/getowner
_app_id_value system administrators (call this system the outside of the service interface system ID)
_license_key_ value system administrators (peripheral system ID corresponding identification number)

5 example JAVA API call
5.1 the file configuration (parmas. Ini)
The parameter name description
ServerName service address such as: localhost: 8080/crtmisweb_pr/resource
AppId system administrators (call this system the outside of the service interface system ID)
LicenseKey system administrators (peripheral system ID corresponding identification number)
Note: please put the class directory configured file
5.2 call way
Platform provides ctopsdk jars, encapsulates the HTTP client calls, call as follows:
URSClient=new URSClient (" params2. Ini ");//read the configuration file
UrsClient. The register ();//the first call to need to register
HashMap Params=new HashMap (a);
//submit parameters setting
Params. Put (" MINRECNO ", "1");
Params. Put (" MAXRECNO ", "10");
//define the interface method to obtain
String outputXml=ursClient. Invoke (this, "SYSMINIBL.COM PANYNAME. PROJECTNAME. CTOPDEMO. VECHICLE. GETVECHICLELIST", params);//in accordance with the service name call


5.3 return data
<? The XML version="1.0" encoding="utf-8"?>

0 & lt;/retCode>
Operation is successful & lt;/retDesc>
0 & lt;/tipType>
1 & lt;/arrayCount>

<body>
1 & lt;/rsShowType> VEC_ID BRA_COLOR, BRA_NUM TRA_NO, GRA_STRING, STA_STRING, END_STRING, RN
5


1 & lt;/RN>




  • Related