Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JAVA µ÷ÓÃWeb ServiceµÄ·½·¨

1.ʹÓÃHttpClient
Óõ½µÄjarÎļþ£ºcommons-httpclient-3.1.jar
·½·¨£º
Ô¤Ïȶ¨ÒåºÃSoapÇëÇóÊý¾Ý£¬¿ÉÒÔ½èÖúÓÚXMLSpy ProfessionalÈí¼þÀ´×öÕâÒ»²½Éú³É¡£
String soapRequestData = "<?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>" +
" <getCountryCityByIp xmlns=\"http://WebXml.com.cn/\">" +
" <theIpAddress>219.137.167.157</theIpAddress>" +
" </getCountryCityByIp>" +
" </soap12:Body>" +
"</soap12:Envelope>";
È»ºó¶¨ÒåÒ»¸öPostMethod£¬ÕâʱÐèÒªÖ¸¶¨web·þÎñµÄUrl;
PostMethod postMethod = new PostMethod(“http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx”);
È»ºó°ÑSoapÇëÇóÊý¾ÝÌí¼Óµ½PostMethodÖÐ
byte[] b = soapRequestData.getBytes("utf-8");
InputStream is = new ByteArrayInputStream(b,0,b.length);
RequestEntity re = new InputStreamRequestEntity(is,b.length,"application/soap+xml; charset=utf-8");
postMethod.setRequestEntity(re);
×îºóÉú³ÉÒ»¸öHttpClient¶ÔÏ󣬲¢·¢³öpostMethodÇëÇó
HttpClient httpClient = new HttpClient();
statusCode = httpClient.executeMethod(postMethod);
String soapRequestData = postMethod.getResponseBodyAsString();
soapRequestData¾ÍÊǵ÷ÓÃweb·þÎñµÄSoapÏìÓ¦Êý¾Ý£¬ÊÇxml¸ñʽµÄ£¬¿ÉÒÔͨ¹ý½âÎö soapRequestDataÀ´»ñµÃµ÷ÓÃweb·þÎñµÄ·µ»ØÖµ¡£
2.ʹÓÃXfire
Óõ½µÄjarÎļþxfire-all-1.2.4.jar, jdom-1.0.jar
·½·¨£º
¶¨ÒåÒ»¸öClient¶ÔÏó£¬Ö¸¶¨web·þÎñµÄwsdlµÄµØÖ·
Client c = new Client(new URL(“http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx?wsdl”));
µ÷ÓÃClient¶ÔÏóµÄinvoke·½·¨£¬Ö¸¶¨web·þÎñµÄ·½·¨Ãû£¬ºÍ²ÎÊý£¬·µ»ØÖµÊÇÒ»¸öObjectÐ͵ÄÊý×é¡£
ÏÂÃæ´úÂëµ÷ÓÃgetVersionTime·½·¨£¬Õâ¸ö·½·¨Ã»ÓвÎÊýÓÃËùÒÔºóÒ»¸ö²ÎÊýʹÓÃnew Object[0]¡£
Object[] results = c.invoke(“getVersionTime”, new Object[0]);
3.ʹÓÃaxis2
ÏÂÔØaxis2-1.4
·½·¨£º


Ïà¹ØÎĵµ£º

javaÖÐÈçºÎʹÓÃamcharts


×î½ü¹«Ë¾Åöµ½ÐèÒªÓÃͼ±íµÄÐÎʽÏÔʾһЩÊý¾Ý£¬ÎҾͿªÊ¼µ½ÍøÉϲéѯ£¬²éµ½ÁËjfreechartºÍamcharts,ÕâÁ½ÕßÎÒ¶¼ÊµÏÖ¹ýÁË£¬jfreechart×îºóÉú³ÉͼƬ£¬µ«ÊÇͼƬЧ¹û²»ÊÇÎÒÏëÒªµÄ£¬È»ºóÓÖÑо¿amcharts ËüµÄЧ¹ûȷʵºÜºÃ£¬¶øÇÒ¹Ù·½ÍøÕ¾ÉÏ»¹ÓкÃЩÀý×ӿɹ©ÏÂÔØ£¬ÍøÖ·ÊÇ:www.amcharts.com
£¨ÏëÒªÍê³ÉÒ»¸öamchartsͼÐÎÐèÒªswfobjects. ......

ʹÓÃJava NIO±àд¸ßÐÔÄܵķþÎñÆ÷

תÔصØÖ·£ºhttp://www.javaeye.com/topic/40489
´ÓJDK 1.4¿ªÊ¼£¬JavaµÄ±ê×¼¿âÖоͰüº¬ÁËNIO£¬¼´ËùνµÄ“New IO”¡£ÆäÖÐ×îÖØÒªµÄ¹¦ÄܾÍÊÇÌṩÁË“·Ç×èÈû”µÄIO£¬µ±È»°üÀ¨ÁËSocket¡£NonBlockingµÄIO¾ÍÊǶÔselect(Unixƽ̨ÏÂ)ÒÔ¼° WaitForMultipleObjects(Windowsƽ̨)µÄ·â×°£¬ÌṩÁ˸ßÐÔÄÜ¡¢Ò×ÉìËõµÄ·þÎ ......

¸´Ï°¡¶Thinking in Java¡·±Ê¼Ç¶þ:µÚʮһÕ±ʼÇ

JavaÈÝÆ÷Àà¿âÖ÷Òª°üº¬Á½ÖÖÀàÐÍCollection(List,Set,Queue)ºÍMap£¬ËüÃǵÄÇø±ðÔÚÓÚÿ¸ö²Û±£´æµÄÔªËظöÊý£¬CollectionÖ»±£´æÒ»¸ö£¬¶øMap±£´æ¼üºÍÖµ¡£
1.µ±Ê¹ÓÃArrays.asList()ʱ£¬Ëü»áÔÚʹÓÃÒ»¸öfinalµÄÊý×é×÷Ϊµ×²ãʵÏÖ£¬Òò´ËÈκÎÉè¼Æµ½¸ü¸ÄÆ䳤¶È´óСµÄ²Ù×÷¶¼½«Å×UnsuportedExceptioÒì³£¡£
2.finalµÄÊý×飬²»Äܸıä´óС£¬µ ......

ÔÚ Java »·¾³ÖÐʹÓà XQuery

XML Êý¾Ý¸ñʽºÜÄÑËÑË÷£¬µ«ÊÇ×î½üËæ×Å XQuery API µÄ³öÏÖ£¬XML ËÑË÷±äµÃ·Ç³£Áé»îºÍ¼òµ¥¡£¶ÔÓÚʹÓà SAX¡¢DOM¡¢JDOM¡¢JAXP µÈ´¦Àí XML ÎĵµµÄ Java™ ³ÌÐòÔ±À´Ëµ£¬¹¤¾ßÏäÖÐÔö¼Ó XQuery API for Java ÊÇÒ»¼þÖµµÃ¸ßÐ˵ÄÊ¡£ÏÖÔÚ Java ³ÌÐòÔ±²»ÓÃÔÙÇóÖúÓÚϵͳµ÷ÓûòÕß±¿×¾µÄ API ¾ÍÄÜÀûÓà XQuery µÄÇ¿´ó¹¦ÄÜÁË£¬Sun ÌṩÁËÒ» ......

JavaÖжѺÍÕ»µÄÇø±ð

     Õ»Óë¶Ñ¶¼ÊÇJavaÓÃÀ´ÔÚRamÖдæ·ÅÊý¾ÝµÄµØ·½¡£ÓëC++²»Í¬£¬Java×Ô¶¯¹ÜÀíÕ»ºÍ¶Ñ£¬³ÌÐòÔ±²»ÄÜÖ±½ÓµØÉèÖÃÕ»»ò¶Ñ¡£
     JavaµÄ¶ÑÊÇÒ»¸öÔËÐÐʱÊý¾ÝÇø,ÀàµÄ¶ÔÏó´ÓÖзÖÅä¿Õ¼ä¡£ÕâЩ¶ÔÏóͨ¹ýnew¡¢newarray¡¢anewarrayºÍmultianewarrayµÈÖ¸ÁÁ¢£¬ËüÃDz»ÐèÒª³ÌÐò´úÂëÀ´ÏÔʽµÄÊÍ·Å¡£
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ