首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

透过发送soap请求

2013-07-16 
通过发送soap请求URL urlnew URL(webservice地址)URLConnection urlConnectionurl.openConnection()

通过发送soap请求

URL url=new URL("webservice地址");URLConnection urlConnection=url.openConnection();HttpURLConnection httpUrlConnection=(HttpURLConnection)urlConnection;httpUrlConnection.setReadTimeout(100000);httpUrlConnection.setDoOutput(true);httpUrlConnection.setDoInput(true);httpUrlConnection.setRequestMethod("POST");httpUrlConnection.setRequestProperty("SOAPAction", "对应wsdl里SOAPAction");httpUrlConnection.setRequestProperty("Content-Type", "text/xml;charset=utf-8");httpUrlConnection.setUseCaches(true);httpUrlConnection.connect();OutputStream out=httpUrlConnection.getOutputStream();out.write(0);out.flush();InputStream in=httpUrlConnection.getInputStream();in.read();httpUrlConnection.disconnect();

?

热点排行