× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi,
it depends what kind of service you get from the http 
server/service. Post, get, soap? SSL?

If you just want to transfer some data through an URL and 
get an answer in return:

Example: 
java URLDialog <url> <path> <returnfile>

If you run on the iSeries (path=.):
java URLDialog http://80.203.193.6/cgidev2p/urldialog.pgm?
user=mko . answer.html

Example on a local pc:
java URLDialog http://80.203.193.6/cgidev2p/urldialog.pgm?
user=mko e:\test\sockets answer.html

Java code:

import java.io.*;
import java.net.*;

public class URLDialog {
    public static void main(String[] args) throws Exception {

        if (args.length != 3) {
            System.err.println("Usage:  java URLDialog "
                               + "[url] [path] [file]");
            System.exit(1);
        }

      String web = args[0];
        String path = args[1];
        String filename = args[2];

        URL url = new URL(web);
        URLConnection connection = url.openConnection();
        connection.setDoOutput(true);

        PrintWriter out = new PrintWriter(
                              connection.getOutputStream());
        out.close();
        BufferedReader in = new BufferedReader(
                                new InputStreamReader(
                                connection.getInputStream
()));
        String inputLine;
      File outputFile = new File(path , filename); 
      System.out.println("Destination: " + path);
      try{
         PrintWriter outFileStream = new PrintWriter(new 
FileOutputStream(outputFile));
           while ((inputLine = in.readLine()) != null) 
outFileStream.println(inputLine);
           outFileStream.flush();
         outFileStream.close();
         in.close();
       }catch (IOException exc){
           System.out.println("Error opening file! Does 
Directory exist?");
           System.exit(1);
         }
    }
}



Rgds,
Magne



Hi Folks, 

I've a XML file created on as400. 

I want to send it to a website directly. 

Has anyone done this kind of thing before? 

If you have, then can you provide us with a working example. 

Many Thanks in advance. 

Rajesh Anand 
Email:Rajesh_anand@xxxxxx 

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.