ÀûÓÃwebservice»ñÈ¡¹É¼Û(java)
×î½üÏîÄ¿ÖÐÓÐÐèÒªÓõ½¹É¼Û£¬ÓÚÊÇÔÚÍøÉÏÕÒÁËÒ»·¬£¬Ã»ÓÐÒ»¸öÖ±½Ó¾ÍÄÜÓõġ£×Ô¼ºÃþË÷ÁËһϣ¬ÖÕÓڸ㶨һ¸ö¹Ë´ó¼Ò²Î¿¼¡£
package test;
import java.util.Arrays;
import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
/**
*
* ¹¦ÄܸÅÊö£º<br>
*
* @author applerockhool
* @version 2010-4-29
*/
public class Test {
public static void main(String[] args) {
try {
// WebService URL,Ïêϸ˵Ã÷Ö±½Ó½øÈëÍøÖ·
String service_url = "http://www.webxml.com.cn/WebServices/ChinaStockWebService.asmx";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(service_url));
// ÉèÖÃÒªµ÷Óõķ½·¨
call.setOperationName(new QName("http://WebXml.com.cn/",
"getStockInfoByCode"));
// ¼ÓÈë²ÎÊý
call.addParameter(
new QName("http://WebXml.com.cn/", "theStockCode"),
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
// É趨·µ»ØÀàÐÍ
call.setReturnClass(String[].class);
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://WebXml.com.cn/getStockInfoByCode");
// É趨¹ÉƱ´úÂë
String code = "sh600028";
/*
* ¡¾·µ»Ø½á¹û˵Ã÷:¡¿
* String(0)¹ÉƱ´úºÅ¡¢String(1)¹ÉƱÃû³Æ¡¢String(2)ÐÐÇéʱ¼ä¡¢String(3)×îмۣ¨Ôª£©¡¢
* String(4)×òÊÕÅÌ£¨Ôª£©¡¢String(5)½ñ¿ªÅÌ£¨Ôª£©¡¢String(6)Õǵø¶î£¨Ôª£©¡¢String(7)×îµÍ£¨Ôª£©¡¢
* String(8)×î¸ß£¨Ôª£©¡¢String(9)Õǵø·ù£¨%£©¡¢String(10)³É½»Á¿£¨ÊÖ£©¡¢String(11)³É½»¶î£¨ÍòÔª£©¡¢
* String(12)¾ºÂò¼Û£¨Ôª£©¡¢String(13)¾ºÂô¼Û£¨Ôª£©¡¢String(14)ί±È£¨%£©¡¢String(15)-String(19)ÂòÒ» -
* ÂòÎ壨Ԫ£©/ÊÖ¡¢String(20)-String(24)ÂôÒ» - ÂôÎ壨Ԫ£©/ÊÖ¡£
*/
String[] result = (String[]) call.invoke(new Object[] { code });
System.out.println(Arrays.deepToString(result));
} catch (Exception e) {
System.err.println(e.toString());
}
}
}
×¢Ò⣺
Ïà¹ØÎĵµ£º
Nutz Java ±àÂë¹æ·¶ (V1.0) By:zozoh 0. ¹æ·¶µÄ¹æ·¶ 1. ´úÂë¸ñʽ 2.1 °ü 2.2 ÀàºÍ½Ó¿Ú 2.3 ³ÉÔ±±äÁ¿ 2.4 ³£Á¿ 2.5 ¾Ö²¿±äÁ¿ 2.6 ³ÉÔ±º¯ÊýºÍ¾²Ì¬º¯Êý ......
ÕâƪÎÄ×ÖдµÄºÜºÃ£¬ÍƼö¸ø×Ô¼ººÍ´ó¼Ò£¡
ÊÂÎñ²ßÂÔ: Á˽âÊÂÎñÏÝÚå
ÔÚ Java ƽ̨ÖÐʵÏÖÊÂÎñʱҪעÒâµÄ³£¼û´íÎó
¼¶±ð£º Öм¶
Mark Richards, Ö÷¹ÜºÍ¸ß¼¶¼¼Êõ¼Ü¹¹Ê¦, Collaborative Consulting, LLC
2009 Äê 3 ÔÂ 06 ÈÕ
ÊÂÎñ´¦ÀíµÄÄ¿±êÓ¦¸ÃÊÇʵÏÖÊý¾ÝµÄ¸ß¶ÈÍêÕûÐÔºÍÒ»ÖÂÐÔ¡£±¾ÎÄÊÇΪ Java ƽ̨¿ª· ......
/**
* ÓйØÈÕÆÚ¹¤¾ßÀà(extends TimeUtil)
*
* TimeUtilÖ÷Òª¹¦ÄÜÓУº
* 1.¸÷ÖÖÈÕÆÚÀàÐÍ£¨×Ö·û£¬util.Date£¬sql.Date£¬CalendarµÈ£©×ª»»
* 2.»ñÈ¡Ö¸¶¨ÈÕÆÚµÄÄê·Ý£¬Ô·ݣ¬ÈÕ·Ý£¬Ð¡Ê±£¬·Ö£¬Ã룬ºÁÃë
* 3.»ñÈ¡µ±Ç°/ϵͳÈÕÆÚ(Ö¸¶¨ÈÕÆÚ¸ñʽ)
* 4.»ñÈ¡×Ö·ûÈÕÆÚÒ»¸öÔµÄÌìÊý
* 5.»ñÈ¡Ö¸¶¨Ô·ݵĵÚÒ»Ìì,×îºóÒ»Ìì
*
* Date ......
javaÈëÃÅ
Ò»¡¢javaÊÇʲô
javaÊÇÒ»ÖÖ¼ÆËã»ú±à³ÌÓïÑÔ£¬Èí¼þ¿ª·¢Æ½Ì¨£¬Èí¼þÔËÐÐƽ̨£¬»¹ÊÇÒ»ÖÖÈí¼þ²¿Êð»·¾³¡£
¶þ¡¢javaÓÐʲô
java¼¼ÊõÓÐÈý¸ö·ÖÖ§£ºJava SE¡¢Java EEºÍJava ME¡£
Èý¡¢javaÄܸÉʲô
Ö÷ÒªÓÐÈý¸ö·½Ã棺×ÀÃæÓ¦ÓóÌÐòµÄ¿ª·¢¡¢ÆóÒµ¼¶µÄÓ¦ÓúÍǶÈëʽÉ豸¡£
ËÄ¡¢javaµÄÌصã
javaÊÇÒ»ÖÖ¼òµ¥µÄ¡¢ÃæÏò¶ÔÏóµÄ¡¢·Ö² ......