https://onetouch.apexedi.com/secure/onetouchapi.asmx?WSDL
Transmits a claim or statement batch.
The Upload call authenticates the user and allows them to post a claim or statement file to Apex EDI's webserver.
Resource URL
https://onetouch.apexedi.com/secure/onetouchapi.asmx?WSDL
Code Samples
public static string UploadFile(string url, string localFile) { // string urlParameters = String.Format("username={0]&password={1}&isClaim=true", encUserName, encPassword); WebClient wc = new WebClient(); byte[] response = wc.UploadFile(url, "post", localFile); string retVal = wc.Encoding.GetString(response); return retVal; }
public static String DoHTTPFilePost(String fileName, String urlString, ArrayListerrors) { String retVal = ""; HttpsURLConnection conn = null; DataOutputStream dos = null; DataInputStream inStream = null; String lineEnd = System.getProperty("line.separator"); String twoHyphens = "--"; String boundary = "*****"; int bytesRead, bytesAvailable, bufferSize; byte[] buffer; int maxBufferSize = 1 * 1024 * 1024; try { // ------------------ CLIENT REQUEST FileInputStream fileInputStream = new FileInputStream(new File(fileName)); // open a URL connection to the Servlet URL url = new URL(urlString); conn = (HttpsURLConnection) url.openConnection(); // Allow Outputs conn.setDoOutput(true); // Don't use a cached copy. conn.setUseCaches(false); // Use a post method. conn.setRequestMethod("POST"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary); dos = new DataOutputStream(conn.getOutputStream()); dos.writeBytes(twoHyphens + boundary + lineEnd); dos.writeBytes("Content-Disposition: form-data; name=\"upload\";" + " filename=\"" + fileName + "\"" + lineEnd); dos.writeBytes(lineEnd); // create a buffer of maximum size bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); buffer = new byte[bufferSize]; // read file and write it into form... bytesRead = fileInputStream.read(buffer, 0, bufferSize); while (bytesRead > 0) { dos.write(buffer, 0, bufferSize); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); bytesRead = fileInputStream.read(buffer, 0, bufferSize); } // send multipart form data necesssary after file data... dos.writeBytes(lineEnd); dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd); // close streams fileInputStream.close(); dos.flush(); dos.close(); } catch (MalformedURLException ex) { errors.add(ex.getMessage()); } catch (IOException ioe) { errors.add(ioe.getMessage()); } // ------------------ read the SERVER RESPONSE try { inStream = new DataInputStream(conn.getInputStream()); String str; StringBuilder sb = new StringBuilder(); while ((str = inStream.readLine()) != null) { sb.append(str); //System.out.println("Server response is: " + str); //System.out.println(""); } inStream.close(); retVal = sb.toString(); } catch (IOException ioex) { errors.add(ioex.getMessage()); } System.out.println(retVal); return retVal; }
function DoHTTPFilePost(fileName : string; fileDesc : string): string; var url, text: string; sHttpSocket: TIdHTTP; sshSocketHandler: TIdSSLIOHandlerSocketOpenSSL; resStream: TStringStream; fileStream: TIdMultipartFormDataStream; begin url := 'https://onetouch.apexedi.com/secure/OneTouchAPI.asmx/Upload?username=[username]&password=[password]&isClaim=true'; sHttpSocket := TIdHTTP.create; sshSocketHandler := TIdSSLIOHandlerSocketOpenSSL.create; sHttpSocket.IOHandler := sshSocketHandler; sHttpSocket.Request.ContentType := 'multipart/form-data'; sHttpSocket.Request.Method := 'POST'; sHttpSocket.Request.Connection := 'KEEP-ALIVE'; try fileStream := TIdMultipartFormDataStream.create; fileStream.AddFile('file1', 'c:\tmp\test.txt', 'multipart/form-data'); resStream := TStringStream.create; sHttpSocket.Post(url, fileStream, resStream); resStream.Seek(0, soFromBeginning); text := resStream.DataString; WriteLn(text); except on E: Exception do WriteLn(E.ClassName + ' error raised, with message : ' + E.Message); end; fileStream.Free; 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/Upload" <?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> <Upload xmlns="http://tempuri.org/" /> </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> <Upload xmlns="http://tempuri.org/" /> </soap12:Body> </soap12:Envelope>
GET /secure/onetouchapi.asmx/Upload? HTTP/1.1 Host: onetouch.apexedi.com
POST /secure/onetouchapi.asmx/Upload HTTP/1.1 Host: onetouch.apexedi.com Content-Type: application/x-www-form-urlencoded Content-Length: length
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> <UploadResponse xmlns="http://tempuri.org/"> <UploadResult>string</UploadResult> </UploadResponse> </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> <UploadResponse xmlns="http://tempuri.org/"> <UploadResult>string</UploadResult> </UploadResponse> </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"?> <string xmlns="http://tempuri.org/">string</string>
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <string xmlns="http://tempuri.org/">string</string>