wsdl2j**aÉú³É¿Í»§¶Ë

ʱ¼ä£º2013.03.27 ·¢²¼ÈË£ºÑ©·×·ÉXFFX

wsdl2j**aÉú³É¿Í»§¶Ë

Òѽâ¾öÎÊÌâ

¹È¸èÑ©·×·ÉXFFXÓû§ÔÚ2013.03.27Ìá½»Á˹ØÓÚ¡°´ÓÇ°ÓÐ×ùÁ齣ɽwsdl2j**aÉú³É¿Í»§¶Ë¡±µÄÌáÎÊ£¬»¶Ó­´ó¼ÒÓ¿Ô¾·¢±í×Ô¼ºµÄ¹Ûµã¡£Ä¿Ç°¹²ÓÐ1¸ö»Ø´ð£¬×îºó¸üÐÂÓÚ2024-08-29T20:11:46¡£Ï£Íû´ó¼ÒÄܹ»°ïÖúËý¡£

ÏêϸÎÊÌâÃèÊö¼°ÒÉÎÊ£ºÆÚ´ýÄúµÄ´ð°¸£¬²»ÖªµÀ˵ʲô,ËÍÄãÒ»¶äСºì»¨°É £¡

Ï£ÍûÒÔϵĻشð£¬Äܹ»°ïÖúÄã¡£

µÚ1¸ö»Ø´ð

Óû§Ãû£ºzixuan881°Ù0  

packageclient;imʾÂÛÓê¹ÛÇ°ÓýÂÌÉú¹ÛÉ«¹ãportj**ax.xml.namespace.ÐÂÇÒ±à»**ÖҺëQName;
importorg.apache.axis2.addressing.EndpointReference;
importorg.apache.axis2.client.Options;
importorg.apache.axis2.rpc.client.RPCServiceClient;publicclassRPCClient
{
publicÀ´×Ôstaticvoidmain(String[]ÎÊ´ðargs)throwsException
{
//ʹ±ß³Á×ÓÈõά³ªÉ¢²ãÑÏ·çÓÃRPC·½Ê½µ÷ÓÃWebService
RPCServiceClientserviceClient=newRPC×൱ÉÏÉ«ÐÂÔ˵۶ÊÅ®ServiceClient();
Option»÷¼þ³£Ì¬´ð×soptions=servÓêÀ§ÔÙ³ÐÇéÔõ°¡ÑÓiceClient.getOptions();
//Ö¸¶¨µ÷ÓÃWebServiceµÄURL
EndÒËÏ£Î÷³ÖpointReferencetargetEPR=newEndpointReference(
"http://localhost:8080/axis2/services/SimpleService");
options.setTo(targetEPR);
//Ö¸¶¨getGreeting·½·¨µÄ²ÎÊýÖµ
ObjectÎȹ¤µÃÌØÈ¥¹â¹¹[]opAddEntryAÁ¿Á÷»ªrgs=newObject[]{"³¬ÈË"};
//Ö¸¶¨getGreeting·½·¨·µ»ØÖµµÄÊýʱæþÝÀàÐ͵ÄClass¶ÔÏó
Class[]classes=newClass[]{String.class};
//Ö¸¶¨Òªµ÷ÓõÄgetGreeting·½·¨¼°WSDLÎļþµÄÃüÃû¿Õ¼ä
QNameopAddEntr»¤¸ßÓÅÔËëÓɹÌy=newQName("http://ws.apÊÓ×¼°û²¡¹¥Âýache.org/axÄÍͶֻ°ûË­is2","getGÔÓ¿ÉÈâ±¾ÏÂÏÖÂ̸ɰÉÊäreeting");
//µ÷ÓÃgetGreetiת²î²éÆ·ÊÒ¹¥ng·½·¨²¢Êä³ö¸Ã·½·¨´¬·þÏ·¹ÔºÓêÔ±¶Ëζ·çµÄ·µ»ØÖµ
System.out.println(serviceClient.invokeBlocking(opAddEÈ¡¸É¾öÈ¡Õ¼½µntry,opAddEntryArgs,classes)[0]);
//ÏÂÃæÊǵ÷ÓÃgetPrice·½·¨µÄ´úÂ룬ÕâЩ´úÂëÓëµ÷ÓÃgetGreeting·½·¨µÄ´úÂëÀàËÆ
classes=newClass[]{int.class};
opAddEntry=newQName("http://ws.apache.org/axis2","getPrice");
System.out.println(serviceClient.invokeBlocking(opAddEntry,newObject[]{},classes)[0]);
}
}ps:¸øÄã¸öj**a·½·¨£¬¸Ä¸Ä¾ÍºÃÁË