java调用WebService的例子
![Snap.gif](http://www.blogjava.net/images/blogjava_net/senlin-blog/20983/Snap.gif)
MsgService ms=new MsgServiceLocator(); MsgServiceSoap msgServer=ms.getMsgServiceSoap(); String strSystemID ="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"; //UAP系统ID,32位。 String strAccessUserName ="aaa"; //需要申请 String strAccessPassWord ="aaa"; //需要申请 String strSMSurl =http://*/MsgService.asmx; //短信webService地址 SendMMSIn pIn =new SendMMSIn(); //消息参数类 pIn.setFromUserMobile(""); //发送者手机 pIn.setMobileList(new String[]{"13510985723"}); //接收手机列表 SimpleDateFormat bartDateFormat =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); pIn.setSendTime(bartDateFormat.format(new Date(System.currentTimeMillis()))); // 发送时间 // 添加彩信内容--文字 MMcontent mm1 =new MMcontent(); mm1.setCharSet("UTF-8"); String mm1Content="使用WS发送彩信!"; mm1.setContentBytes(mm1Content.getBytes("UTF-8")); mm1.setContentID("text1.txt"); mm1.setContentType(MMcontentType.TEXT); // 添加彩信内容--图片 MMcontent mm2 =new MMcontent(); mm2.setCharSet("UTF-8"); byte[] bytes = getByteFromFile("F:\\mmsjp.jpg"); mm2.setContentBytes(bytes); mm2.setContentType(MMcontentType.JPEG); mm2.setContentID("mmsjp.jpg"); MMcontent[] mmcs =new MMcontent[] {mm1,mm2}; pIn.setMmsContents(mmcs); SendMMSOutHolder pOut=new SendMMSOutHolder(); SXTCallResultHolder result=new SXTCallResultHolder(); msgServer.sendMMS(strSystemID, strAccessUserName, strAccessPassWord, pIn,result,pOut);