<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "what am i doing wrong?"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/4.page</link>
		<description><![CDATA[Latest messages posted in the topic "what am i doing wrong?"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>what am i doing wrong?</title>
				<description><![CDATA[ hello, i'm trying to make a little program and this web service should be perfect for me, so i've tryed to implement a java client for the service using AXIS but i'm getting this error:

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
  faultString: java.net.ConnectException: Operation timed out: connect
 faultActor:
 faultNode:
 faultDetail:
        {http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: Opera
tion timed out: connect


and my code is:

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import javax.xml.rpc.ParameterMode;

public class EjemploWS {
   public EjemploWS() {}
   
   public String ask() throws Exception {
   		String endpoint =
                                 "http://ws.geonames.org/postalCodeSearch.jws";
		Service  service = new Service();
       	        Call call = (Call)service.createCall();

       	        call.setTargetEndpointAddress(new java.net.URL(endpoint));
       	        call.setOperationName("postalCodeSearch");
       	        call.addParameter("postalcode",                          
                                            XMLType.XSD_STRING,ParameterMode.IN);
       	        call.setReturnType(XMLType.XSD_STRING);

       	       String result = (String)call.invoke(new Object [] 
                                                                        {"28933"});

		return result;
   	}
}


What am i doing wrong??? Can somebody help me?

thanks]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/137.page#694</guid>
				<link>http://forum.geonames.org/gforum/posts/list/137.page#694</link>
				<pubDate><![CDATA[Thu, 10 Aug 2006 15:04:01]]> GMT</pubDate>
				<author><![CDATA[ Anonymous]]></author>
			</item>
			<item>
				<title>Re:what am i doing wrong?</title>
				<description><![CDATA[ Hi

The geonames webserives follow the lightweight REST principle and you don't need a SOAP library to access it. 
A simple java program will do the job : (with jdom.org for the xml parsing)

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
	public static List&lt;PostalCode&gt; postalCodeSearch&#40;String postalCode,
			String placeName, String countryCode&#41; throws Exception {
		List&lt;PostalCode&gt; postalCodes = new ArrayList&lt;PostalCode&gt;&#40;&#41;;

		String url = "http://ws.geonames.org/postalCodeSearch?";
		if &#40;postalCode != null&#41; {
			url = url + "postalcode=" + postalCode;
		}
		if &#40;placeName != null&#41; {
			if &#40;!url.endsWith&#40;"&"&#41;&#41; {
				url = url + "&";
			}
			url = url + "placename=" + URLEncoder.encode&#40;placeName, "UTF8"&#41;;
		}
		if &#40;countryCode != null&#41; {
			if &#40;!url.endsWith&#40;"&"&#41;&#41; {
				url = url + "&";
			}
			url = url + "country=" + countryCode;
		}

		URLConnection conn = new URL&#40;url&#41;.openConnection&#40;&#41;;
		conn.setRequestProperty&#40;"User-Agent", USER_AGENT&#41;;
		SAXBuilder parser = new SAXBuilder&#40;&#41;;
		Document doc = parser.build&#40;conn.getInputStream&#40;&#41;&#41;;

		Element root = doc.getRootElement&#40;&#41;;
		for &#40;Object obj : root.getChildren&#40;"code"&#41;&#41; {
			Element codeElement = &#40;Element&#41; obj;
			PostalCode code = new PostalCode&#40;&#41;;
			code.setPostalCode&#40;codeElement.getChildText&#40;"postalcode"&#41;&#41;;
			code.setPlaceName&#40;codeElement.getChildText&#40;"name"&#41;&#41;;
			code.setCountryCode&#40;codeElement.getChildText&#40;"countryCode"&#41;&#41;;

			code.setLatitude&#40;Double
					.parseDouble&#40;codeElement.getChildText&#40;"lat"&#41;&#41;&#41;;
			code.setLongitude&#40;Double.parseDouble&#40;codeElement
					.getChildText&#40;"lng"&#41;&#41;&#41;;

			postalCodes.add&#40;code&#41;;
		}

		return postalCodes;
	}
</pre>
		</div>]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/137.page#695</guid>
				<link>http://forum.geonames.org/gforum/posts/list/137.page#695</link>
				<pubDate><![CDATA[Thu, 10 Aug 2006 18:26:36]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
	</channel>
</rss>