java call webservice Weather

2011-07-18  来源:本站原创  分类:Internet  人气:105 

public static void WeatherTest () {

try {

String endpoint = "http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl";
Service service = new Service ();
Call call = (Call) service.createCall ();// call object created by the service

/ / Set the URL where the service

call.setTargetEndpointAddress (new java.net.URL (endpoint));

call.setOperationName (new QName ("http://WebXml.com.cn/", "getWeatherbyCityName"));
call.addParameter (new QName ("http://WebXml.com.cn/", "theCityName"), org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);

call.setUseSOAPAction (true);

call.setReturnType (org.apache.axis.encoding.XMLType.SOAP_VECTOR); / / return parameters of type (can not use Array, or error)

call.setSOAPActionURI ("http://WebXml.com.cn/getWeatherbyCityName");

Vector ret = (Vector) call.invoke (new Object [] {"Daqing"});

System.out.println ("--------"+ ret);

} Catch (Exception e) {
/ / TODO Auto-generated catch block
e.printStackTrace ();
}
}

相关文章
  • java call webservice Weather 2011-07-18

    public static void WeatherTest () { try { String endpoint = "http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl"; Service service = new Service (); Call call = (Call) service.createCall ();// call object created by the service / /

  • SAP and Java systems Webservice Example 2011-08-22

    SAP and Java systems Webservice Example http://blog.csdn.net/yin_chuan_lang/article/details/6706693 Very detailed description of the initial entry of the tutorial

  • Java调用WebService接口的方法 2013-10-04

    这篇文章主要介绍了Java调用WebService接口的方法,实例分析了有参方法Add的使用技巧,需要的朋友可以参考下 本文实例讲述了Java调用WebService接口的方法.分享给大家供大家参考.具体如下: 这里讲述有参方法Add,代码如下: public static void addTest() { try ...{ Integer i = 1; Integer j = 2; //WebService URL String service_url = "http://localhost:

  • python调用java的Webservice示例 2013-11-08

    这篇文章主要介绍了python调用java的Webservice具体方法,包含java端和python实现代码,需要的朋友可以参考下 一.java端 首先我使用的是java自带的对webservice的支持包来编写的服务端和发布程序,代码如下. webservice的接口代码: package com.xxx.test.ws; import javax.jws.WebMethod; import javax.jws.WebService; /** * Created with IntelliJ

  • PHP调用JAVA的WebService简单实例 2014-11-17

    本篇文章主要是对PHP调用JAVA的WebService简单实例进行了介绍,需要的朋友可以过来参考下,希望对大家有所帮助 使用PHP调用JAVA语言开发的WebService. 客户端提交两个String类型的参数,服务端返回一个对象类型. 服务端使用AXIS-1.4作为SOAP引擎.客户端为PHP5.2.9,使用NuSOAP作为SOAP引擎. 服务端 对象类 import java.io.Serializable; public class Person implements Serializ

  • java 调用 webservice 接口的简单实现 2013-02-28

    今天在写java调用webservice 接口的时候整了半天没出来,网上资料一大片,都一个眸子....郁闷死 了.最后终于在一个地方找到了一个适合我项目中调用的方法,方法如下: Client client = new Client(new URL("http://193.1.3.11:8080/NS/services/NSService?wsdl"));//new 一个客户端 client.invoke("getTest",new Object[]{msg,user

  • java access to weather forecast 2009-01-24

    Recent projects use the weather forecast, I had always heard that the network is provided webservice applications, so you can call interface is very simple to get the data. But the fact that I do it, but it is very depressed. At the beginning of time

  • java access to weather forecasts 2010-07-24

    Recent projects use to weather, I had been provided had heard webservice applications on the network, so you can call interface is very simple to get data. But in fact when I do, but very depressing. In the beginning, I have not found time since the

  • Using simple examples of Java development WebService Axis 2010-04-29

    Prior to the development, first look at AXIS, axis present, there are 2 versions of its flexibility, rapid development tools integrated Gao Yu xfire and the user home on it. With the Eclipse development, beginning think of xfire, it is integrated wit

  • java axis webservice 开发实例 2013-01-28

    今天无事看了看webservice,通过网上自己也总结了一下,大概需要以下jar包 activation.jar axis-ant.jar axis.jar commons-discovery-0.2.jar commons-logging-1.0.4.jar jaxrpc.jar log4j-1.2.8.jar mail-1.4.jar saaj.jar wsdl4j-1.5.1.jar 首先写deploy.wsdd代码如下: <deployment xmlns="http://xml.

  • java开发webservice的几种方式 2015-04-30

    webservice的应用已经越来越广泛了,下面介绍几种在Java体系中开发webservice的方式,相当于做个记录. 1.Axis2 Axis是apache下一个开源的webservice开发组件,出现的算是比较早了,也比较成熟.这里主要介绍Axis+eclipse开发webservice,当然不用eclipse也可以开发和发布webservice,只是用eclipse会比较方便. (1)下载eclipse的Java EE版本 http://www.eclipse.org/downloads

  • java development webservice (rpm) 2010-11-29

    java web service development approach in October 2007 2007-10-09 19:52:54 Read 162 Comments 0 Font Size: medium and small subscription. java web service methods developed are seeing, there are three simple ways: 1 Use the static stub By wsdl2java too

  • WebService development example (java code) 2010-03-19

    WebService is an advanced application, with the previous learning Struts, Spring, Hibernate and other frameworks different. WebService is a service-oriented architecture (SOA), looks like a larger framework than SSH. In the end it is what for? What i

  • flex and java how communication with the public session webService 2010-12-26

    flex and java how communication with the public session webService This is very troublesome, because you have to be very understanding of what session which in the end (as to flex there, not so strict over there in java) The correct approach is, java

  • 最简单的java WebService服务器端搭建 2012-08-28

    最简单的Webservice服务器在控制台下就可以完成,不需要web服务器. 现在D盘建立一个目录WS,在WS下建立service 和 kangzye 两目录.kangzye将作为包,里面保存java源文件. 在kangzye目录下建立java文件: package kangzye; import javax.jws.WebService; import javax.jws.WebMethod; import javax.xml.ws.Endpoint; @WebService public c

  • java调用php的webService 2012-10-08

    1.首先先下载php的webservice包:NuSOAP,自己到官网去下载,链接就不给出来了,自己去google吧 基于NoSOAP我们写了一个php的webservice的服务端,例子如下: <?php header("Content-Type:text/html;charset=UTF-8"); require('../lib/nusoap.php'); $server = new soap_server(); $server->configureWSDL('hell

  • java 调用 wsdl形式的webservice 示例 2013-07-31

    正在开发的中间件要用到第三方提供的webservice,网上的资料稂莠不齐,java调用webservice折腾了我两天,不就是调用URL上对应的方法嘛,尼玛怎么这么难调用?(还是RESTFUL好用)方法太多看到头晕眼花,我喜欢简单明了,拿来就用的,不要搞一堆的方法,萝莉啰嗦,写得不清不楚,漏这漏那的,用起来不是这错就那错,一气之下,小弟自己整理一个简单步骤,与大家分享,欢迎大家狂喷! 步骤如下: 1.下载AXIS2类库,AXIS2是目前java调用webservice的一个主要方法(由于更新较

  • JAVA webservice之CXF 2015-04-15

    昨天我们一起学习了一下xfire,今天我们来看一下CXF,为什么学完那个接着学这个呢.因为CXF是在xfire的基础上实现 的,所以我们学习它会比较简单点,毕竟我们昨天刚看过了xfire的实现方法.废话少说,直接来例子. 1)首先呢,还是包的问题,在http://cxf.apache.org/download.html这里可以下到最新版的CXF,当然,我用的是最新版的.接下来还是那句废话,建WEB项目,放入JAR包.而JAR包我们就不选择了,一堆全部放入. 我们会看到它包含了spring的JAR

  • Axis1 stub configured webService 2010-03-29

    Write a script deploy.bat, when released do not have to use the command line, and would not have added so many variables to the classpath, its convenience. set AXIS_LIB = D: \ axis \ axis-1_4 \ webapps \ axis \ WEB-INF \ lib set AXISCLASSPATH =% AXIS

  • Xfire Spring Hibernate release WebService 2010-04-01

    Xfire Spring Hibernate release WebService Xfire Spring 1.2 Hibernate 3 release WebService First, preparatory work 1, download and install Eclipse Version: 3.3.1.1 and MyEclipse6.0.1 2, download and install MySQL Server 5.1 3, download MySQL driver my