Java.net.malformedURLException.., While sending http requests from tini
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Shankar_Bandaru
Posted On:   Thursday, July 28, 2005 10:48 PM

Hi, Can anyone find what's the problem with this code..I am getting this error java.net.MalformedURLException in java.lang.Throwable.??? in java.lang.Throwable. (@JPC=4) in java.lang.Exception. (@JPC=2) in java.io.IOException. (@JPC=2) in java.net.MalformedURLException. (@JPC=2) in java.net.URL.??? in java.net.URL. (@JPC=b0026) in java.lang.System.??? import java.io.*; import java.net.ContentHandlerFactory; import java.net.*; public class TiniPostExample { public static void main(String[] argv) { try { System.out.println("Connecting to SQLServer   More>>

Hi,

Can anyone find what's the problem with this code..I am getting this error

			
java.net.MalformedURLException
in java.lang.Throwable.???
in java.lang.Throwable. (@JPC=4)
in java.lang.Exception. (@JPC=2)
in java.io.IOException. (@JPC=2)
in java.net.MalformedURLException. (@JPC=2)
in java.net.URL.???
in java.net.URL. (@JPC=b0026)
in java.lang.System.???


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

public class TiniPostExample
{
public static void main(String[] argv)
{
try
{
System.out.println("Connecting to SQLServer.....");
URL url = new URL("http","192.168.1.123",-1,"nwind/template/MyTemplate.xml");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
System.out.println("!!!!!!!!!!!!");
connection.setRequestProperty("contenttype","text/xml");
PrintWriter out = new PrintWriter(connection.getOutputStream());
// encode the message
String msg = " ";
System.out.println("2222222222222222");
StringBuffer sbf = new StringBuffer();
sbf.append("empdata=").append(msg);
System.out.println(sbf.toString());
// send the encoded message
out.println(sbf.toString());
out.flush();
out.close();

BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
while ((line = in.readLine()) != null)
{
System.out.println(line);
}
in.close();
}
catch(Exception ex)
{
ex.printStackTrace();
}


Regards,
Shankar    <<Less
About | Sitemap | Contact