日期:2014-05-17  浏览次数:20664 次

wsdl问题!!!
我得到了很多wsdl类.里面全是get和set方法要怎么去调用他?

------解决方案--------------------
这个是webservices里面的东西,查阅一下百度,去解决
------解决方案--------------------
你要的不就是将wsdl中,生成的java客户端代码放到你项目中,然后实例化wsdl中哪个对象,就可以直接调用你所需要的方法了(具体什么方法忘记了),你可以搜索下java调用websevice客户端代码!
------解决方案--------------------
前端直接调用webservice,跨域访问不了,后台代理访问,然后前端请求代理,搞定 。
------解决方案--------------------
写个webservice客户端就能调用到
------解决方案--------------------
import javax.xml.namespace.QName;

import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;

public class TestAxis2 {

/**
 * @param args
 */
public static void main(String[] args) throws Exception  {
// TODO Auto-generated method stub
        new TestAxis2().test();
}

public void test() throws Exception {
// 服务器端WebService的WSDL连接串
String serviceUrl = "http://localhost:8080/axis2/services/MyWebService?wsdl" ;
RPCServiceClient serviceClient = null;
String resultString = "";
serviceClient = getServiceClient(serviceUrl);
// 服务器端开放的方法名
String wsFunction = "helloWebService";
System.out.println(wsFunction);
// 要传给服务器开放方法的参数.
String jsonString = "你好" ;
//服务器的返回数据
resultString = login(serviceUrl,serviceClient, jsonString, wsFunction);
System.out.println("resultString=" + resultString);
}

public RPCServiceClient getServiceClient(String wsdlUrl) {
RPCServiceClient serviceClient = null;
try {
serviceClient = new RPCServiceClient();
Options options = serviceClient.getOptions();
EndpointReference targetEPR = new EndpointReference(wsdlUrl);
options.setTo(targetEPR);
} catch (AxisFault e) {
e.printStackTrace();
}
return serviceClient;
}

    public String login(String serviceUrl,RPCServiceClient serviceClient, String jsonString, String wsFunction) throws AxisFault {
// 在创建QName对象时,QName类的构造方法的第一个参数表示WSDL文件的命名空间名,也就是<wsdl:definitions>元素的targetNamespace属性值
QName opLogin = new QName("http://ws.apache.org/axis2", wsFunction);
// 参数,如果有多个,继续往后面增加即可,不用指定参数的名称
Object[]&nb