Search the web
Sign In
New User? Sign Up
weblogs-com
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Weblogs.com respose error   Message List  
Reply | Forward Message #28 of 108 |
Re: [weblogs-com] Re: Weblogs.com respose error

sure, here is a working java class that pings weblogs.
Joel


--- andy_kishore <andy_kishore@...> wrote:

> Hi Joel,
>
> Thanks for your reply....i tried what you said but
> same results again
> ...Could you send me sum code you might have written
> which works.
> That would be gr8.
>
> Andy.
>
> --- In weblogs-com@yahoogroups.com, Joel Nylund
> <jnylund@y...> wrote:
> >
> > Andy, the length of this message is 205, I would
> put
> > the contents in a StringBuffer or String, then get
> the
> > length, use this variable in the "Content-lengh"
> field
> > of the header.
> >
> > thanks
> > Joel
> >
>
>
>
>
>
>

Fri Nov 4, 2005 11:35 am

jnylund
Online Now Online Now
Send Email Send Email

import java.net.*;
import java.io.*;
import java.util.*;
import java.net.URLEncoder;

public class WeblogsPing {

public static final int SOCKET_TIMEOUT_VALUE = 60 * 1000;

public static int PORT = 0;

public static String IP = null;

public Socket s = null;

public PrintWriter out = null;

public InputStream is = null;

public static boolean soap = false;

// Pass in rpc.weblogs.com 80 1
// Pass in rpc.weblogs.com 80 1

public static void main(String rgs[]) {

IP="rpc.weblogs.com";
PORT=80;

boolean showPage = true;
String url = null;

url = " /RPC2";

HTTPWrapper httpWrapper = new HTTPWrapper();
int bcount = 0;
StringBuffer sb = new StringBuffer();

try {
String data = null;
data = "<?xml version=\"1.0\"?>\r\n" + "<methodCall>\r\n"
+ "<methodName>weblogUpdates.ping</methodName>\r\n"
+ "<params>\r\n" + "<param>\r\n"
+ "<value>Joels Blog</value>\r\n" + "</param>\r\n"
+ "<param>\r\n"
+ "<value>http://feeds.feedburner.com/JoelsBlog/</value>\r\n"
+ "</param>\r\n" + "</params>\r\n"
+ "</methodCall>\r\n";
Socket s = null;
s = new Socket(IP, PORT);
s.setSoTimeout(SOCKET_TIMEOUT_VALUE);
PrintWriter out = new PrintWriter(s.getOutputStream());
String output = ("POST " + url + " HTTP/1.0\r\n"
+ "User-Agent: Java RPC Client (WinNT)\r\n"
+ "Content-Length: " + data.length() +
"\r\n"+"Content-Type: text/xml\r\n\r\n");
String finalOutput = output + data;
System.out.println("outgoing request:\n" + finalOutput);
out.print(finalOutput);
out.flush();

DataInputStream is = new DataInputStream(new BufferedInputStream(s

.getInputStream()));
int thechar;
while ((thechar = is.read()) != -1) {
bcount = bcount + 1;
sb.append((char) thechar);
}

is.close();
out.close();
s.close();

} catch (Exception e) {
e.printStackTrace();
}



System.out.println("Page of Length " + sb.length() + " returned");
System.out.println(sb);


}



}


Forward
Message #28 of 108 |
Expand Messages Author Sort by Date

I tried pinging Weblogs through Java code but everytime i get the following response: < ? x m l v e r s i o n = " 1 . 0 " ? > < m e t h o d R e s p o n s e ......
andy_kishore
Offline Send Email
Nov 3, 2005
12:29 pm

Andy, can you post the exact request you are sending, typically I have seen this error when you send the wrong content length (are you sure the length is 250?)...
Joel Nylund
jnylund
Online Now Send Email
Nov 3, 2005
12:41 pm

Hi, This is what my request looks like: // THIS IS WHERE I'M SETTING THE HEADERS con.setRequestProperty("Content-Type","text/xml"); ...
andy_kishore
Offline Send Email
Nov 3, 2005
12:47 pm

Andy, the length of this message is 205, I would put the contents in a StringBuffer or String, then get the length, use this variable in the "Content-lengh"...
Joel Nylund
jnylund
Online Now Send Email
Nov 3, 2005
4:01 pm

Hi Joel, Thanks for your reply....i tried what you said but same results again ...Could you send me sum code you might have written which works. That would be...
andy_kishore
Offline Send Email
Nov 4, 2005
5:16 am

sure, here is a working java class that pings weblogs. Joel ... import java.net.*; import java.io.*; import java.util.*; import java.net.URLEncoder; public...
Joel Nylund
jnylund
Online Now Send Email
Nov 4, 2005
11:35 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help