June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
56
Task/SOAP/C/soap-1.c
Normal file
56
Task/SOAP/C/soap-1.c
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*Abhishek Ghosh, 26th October 2017*/
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
size_t write_data(void *ptr, size_t size, size_t nmeb, void *stream){
|
||||
return fwrite(ptr,size,nmeb,stream);
|
||||
}
|
||||
|
||||
size_t read_data(void *ptr, size_t size, size_t nmeb, void *stream){
|
||||
return fread(ptr,size,nmeb,stream);
|
||||
}
|
||||
|
||||
void callSOAP(char* URL, char * inFile, char * outFile) {
|
||||
|
||||
FILE * rfp = fopen(inFile, "r");
|
||||
if(!rfp)
|
||||
perror("Read File Open:");
|
||||
|
||||
FILE * wfp = fopen(outFile, "w+");
|
||||
if(!wfp)
|
||||
perror("Write File Open:");
|
||||
|
||||
struct curl_slist *header = NULL;
|
||||
header = curl_slist_append (header, "Content-Type:text/xml");
|
||||
header = curl_slist_append (header, "SOAPAction: rsc");
|
||||
header = curl_slist_append (header, "Transfer-Encoding: chunked");
|
||||
header = curl_slist_append (header, "Expect:");
|
||||
CURL *curl;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(curl, CURLOPT_POST, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_data);
|
||||
curl_easy_setopt(curl, CURLOPT_READDATA, rfp);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, wfp);
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header);
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)-1);
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE,1L);
|
||||
curl_easy_perform(curl);
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argC,char* argV[])
|
||||
{
|
||||
if(argC!=4)
|
||||
printf("Usage : %s <URL of WSDL> <Input file path> <Output File Path>",argV[0]);
|
||||
else
|
||||
callSOAP(argV[1],argV[2],argV[3]);
|
||||
return 0;
|
||||
}
|
||||
10
Task/SOAP/C/soap-2.c
Normal file
10
Task/SOAP/C/soap-2.c
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:dom="http://example.com/soap/wsdl">
|
||||
<soapenv:Header/>
|
||||
<soapenv:Body>
|
||||
<dom:soapFunc soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</soapenv:Body>
|
||||
</soapenv:Envelope>
|
||||
10
Task/SOAP/C/soap-3.c
Normal file
10
Task/SOAP/C/soap-3.c
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:dom="http://example.com/soap/wsdl">
|
||||
<soapenv:Header/>
|
||||
<soapenv:Body>
|
||||
<dom:anotherSoapFunc soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</soapenv:Body>
|
||||
</soapenv:Envelope>
|
||||
5
Task/SOAP/Clojure/soap.clj
Normal file
5
Task/SOAP/Clojure/soap.clj
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
(require '[clj-soap.core :as soap])
|
||||
|
||||
(let [client (soap/client-fn "http://example.com/soap/wsdl")]
|
||||
(client :soapFunc)
|
||||
(client :anotherSoapFunc))
|
||||
59
Task/SOAP/Kotlin/soap.kotlin
Normal file
59
Task/SOAP/Kotlin/soap.kotlin
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
// Kotlin Native v0.6
|
||||
|
||||
import kotlinx.cinterop.*
|
||||
import platform.posix.*
|
||||
import libcurl.*
|
||||
|
||||
fun writeData(ptr: COpaquePointer?, size: size_t, nmeb: size_t, stream: COpaquePointer?)
|
||||
= fwrite(ptr, size, nmeb, stream?.reinterpret<FILE>())
|
||||
|
||||
fun readData(ptr: COpaquePointer?, size: size_t, nmeb: size_t, stream: COpaquePointer?)
|
||||
= fread(ptr, size, nmeb, stream?.reinterpret<FILE>())
|
||||
|
||||
fun callSOAP(url: String, inFile: String, outFile: String) {
|
||||
val rfp = fopen(inFile, "r")
|
||||
if (rfp == null) {
|
||||
perror("Read File Open: ")
|
||||
exit(1)
|
||||
}
|
||||
val wfp = fopen(outFile, "w+")
|
||||
if (wfp == null) {
|
||||
perror("Write File Open: ")
|
||||
fclose(rfp)
|
||||
exit(1)
|
||||
}
|
||||
|
||||
var header: CPointer<curl_slist>? = null
|
||||
header = curl_slist_append (header, "Content-Type:text/xml")
|
||||
header = curl_slist_append (header, "SOAPAction: rsc")
|
||||
header = curl_slist_append (header, "Transfer-Encoding: chunked")
|
||||
header = curl_slist_append (header, "Expect:")
|
||||
|
||||
val curl = curl_easy_init()
|
||||
if (curl != null) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url)
|
||||
curl_easy_setopt(curl, CURLOPT_POST, 1L)
|
||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, staticCFunction(::readData))
|
||||
curl_easy_setopt(curl, CURLOPT_READDATA, rfp)
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, staticCFunction(::writeData))
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, wfp)
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header)
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, -1L)
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L)
|
||||
curl_easy_perform(curl)
|
||||
curl_easy_cleanup(curl)
|
||||
}
|
||||
|
||||
curl_slist_free_all(header)
|
||||
fclose(rfp)
|
||||
fclose(wfp)
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
if (args.size != 3) {
|
||||
println("You need to pass exactly 3 command line arguments, namely :-")
|
||||
println(" <URL of WSDL> <Input file path> <Output File Path>")
|
||||
return
|
||||
}
|
||||
callSOAP(args[0], args[1], args[2])
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue