https://onetouch.apexedi.com/secure/onetouchapi.asmx?WSDL
Downloads a file to the users software via the OnetouchApexEDI web service.
Resource URL
https://onetouch.apexedi.com/secure/onetouchapi.asmx?WSDL
Code Samples
public static void GetFileByName(string methodCall) { string content = String.Format("username={0}&password={1}&filename={2}", encUserName, encPassword, fileName); Console.WriteLine(Download(FormatApexUrl(methodCall, ApexUrl, content), downLoadFile)); } public static string Download(string url, string downLoadFile) { HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url); IAsyncResult asyncResult = httpWebRequest.BeginGetResponse(null, null); asyncResult.AsyncWaitHandle.WaitOne(); string responseText = ""; using (HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.EndGetResponse(asyncResult)) using (StreamReader responseStreamReader = new StreamReader(httpWebResponse.GetResponseStream())) { responseText = responseStreamReader.ReadToEnd(); } return responseText; }
public static void GetFileByName(String methodCall) { String content = String.format("username=%s&password=%s&filename=%s", encUserName, encPassword, encFileName); try { String urlString = "https://localhost:54526/secure/onetouchapi.asmx/GetFileByName?username=" + encUserName + "&password=" + encPassword + "&filename=" + encFileName; System.out.println(HttpPost.DoDownload(ApexUrl + methodCall, content)); } catch(Exception ex) { System.out.println(ex); } } public static String DoDownload(String target, String content) { String response = ""; try { URL url = new URL(target); URLConnection conn = url.openConnection(); // Set connection parameters. conn.setDoInput (true); conn.setDoOutput (true); conn.setUseCaches (false); // Make server believe we are form data... conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); DataOutputStream out = new DataOutputStream (conn.getOutputStream()); // Write out the bytes of the content string to the stream. out.writeBytes(content); out.flush (); out.close (); // Read response from the input stream. BufferedReader in = new BufferedReader (new InputStreamReader(conn.getInputStream ())); String temp; while ((temp = in.readLine()) != null) { response += temp + "\n"; } temp = null; in.close(); //System.out.println("Server response:\n'" + response + "'"); } catch (MalformedURLException ex) { System.out.println(ex.getMessage()); } catch (IOException ioe) { System.out.println(ioe.getMessage()); } return response; }
begin url := apexUrl + '/' + 'GetFileByName'; param := TStringList.create; param.Add('username=demo1'); param.Add('password=medical1'); param.Add('filename=testreport.txt.txt'); Download(url, param); end; function Download(url : string; param: TStringList) : string; var text: string; fileBytes : array of byte; sHttpSocket: TIdHTTP; sshSocketHandler: TIdSSLIOHandlerSocketOpenSSL; resStream: TStringStream; fileStream : TFileStream; memStream : TMemoryStream; aStream : TStream; begin sHttpSocket := TIdHTTP.create; memStream := TMemoryStream.Create; sshSocketHandler := TIdSSLIOHandlerSocketOpenSSL.create; sHttpSocket.IOHandler := sshSocketHandler; sHttpSocket.Request.ContentType := 'application/x-www-form-urlencoded'; sHttpSocket.Request.Method := 'POST'; resStream := TStringStream.create; sHttpSocket.Post(url, param, resStream); resStream.SaveToFile('c:\dev\report6test.txt'); resStream.Seek(0, soFromBeginning); text := resStream.DataString; WriteLn(text); end;
POST /secure/onetouchapi.asmx HTTP/1.1 Host: onetouch.apexedi.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://tempuri.org/GetFileByName" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetFileByName xmlns="http://tempuri.org/"> <username>string</username> <password>string</password> <filename>string</filename> </GetFileByName> </soap:Body> </soap:Envelope>
POST /secure/onetouchapi.asmx HTTP/1.1 Host: onetouch.apexedi.com Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <GetFileByName xmlns="http://tempuri.org/"> <username>string</username> <password>string</password> <filename>string</filename> </GetFileByName> </soap12:Body> </soap12:Envelope>
GET /secure/onetouchapi.asmx/GetFileByName?username=string&password=string&filename=string HTTP/1.1 Host: onetouch.apexedi.com
POST /secure/onetouchapi.asmx/GetFileByName HTTP/1.1 Host: onetouch.apexedi.com Content-Type: application/x-www-form-urlencoded Content-Length: length username=string&password=string&filename=string
Sample Response
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetFileByNameResponse xmlns="http://tempuri.org/"> <GetFileByNameResult>base64Binary</GetFileByNameResult> </GetFileByNameResponse> </soap:Body> </soap:Envelope>
HTTP/1.1 200 OK Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <GetFileByNameResponse xmlns="http://tempuri.org/"> <GetFileByNameResult>base64Binary</GetFileByNameResult> </GetFileByNameResponse> </soap12:Body> </soap12:Envelope>
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <base64Binary xmlns="http://tempuri.org/">base64Binary</base64Binary>
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <base64Binary xmlns="http://tempuri.org/">base64Binary</base64Binary>