public static void main(String[] args)
{
try
{
String xml = "TestInfo";
/**设置访问点*/
String endpoint = "http://8.8.8.8:8080/CrmWeb/services/DEPGRPService"; /**创建 call*/
Call call = (Call) new Service().createCall(); /**设置操作名 */
call.setOperationName("queryMessageInfo"); /**设置访问点 */
call.setTargetEndpointAddress(new java.net.URL(endpoint));
/**调用服务,返回值*/
String ret = (String) call.invoke(new Object[]{xml});
System.out.println("返回值是:" + ret); } catch (Exception e){
e.printStackTrace(); }
}
自己写了一段调用webservices接口的方法,但是返回值为空,我本地是客户端,调用服务端的接口,但是没有拿到服务端的WSDL文件,请高手们帮忙看一下是哪里出现的问题。谢谢了~
http://8.8.8.8:8080/CrmWeb/services/DEPGRPService?wsdl
// 定义服务
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(url));
call.setUseSOAPAction(true);
// 第一种设置返回值类型为String的方法
call.setReturnType(XMLType.SOAP_STRING);
call.setOperationName(new QName(nameSpace, method));
call.setSOAPActionURI(nameSpace + method);
try {
retVal = (String) call.invoke(new Object[] {});
} catch (RemoteException e) {
// e.printStackTrace();
logger.info(e.getMessage());
return retVal;
}希望对你有帮助