已解决问题
谷歌vxkew2791用户在2015.11.29提交了关于“夜行书生如何打开wsdl文件”的提问,欢迎大家涌跃发表自己的观点。目前共有1个回答,最后更新于2024-03-16T03:03:03。希望大家能够帮助她。详细问题描述及疑问:期待您的答案,感谢你,我会记得你对我的好的 !
详细问题描述及疑问:期待您的答案,感谢你,我会记得你对我的好的 !
webservice的发
注意,以下的代
1,直接AXI
impor
importja
importorg.***
importorg.
importj**ax.***.qname;
importj**ax.***.parametermode;
publicclasscaClient{
public
try{
Strin
//直接引用远程
//
Serviceservice=newService();
Callcall=
***.settarge
***.
***.addparameter("userName",org.
j**ax.***.parametermode.in);//接口的参数
***.setreturntype(org.***.encoding.xmltype.xsd_STRING);//设置返回类型
Stringtemp="测试人员";
Stringresult=(String)***.invoke(newObject[]{temp});
//给方法传递参数,并且调用方法
system.***.println("resultis"+result);
}
catch(Exceptione){
system.***.println(***.tostring());
}
}
}
2,直接SOAP调用远程的webservice,这种模式很少用,但是网络上有人贴出来,也转过来:
importorg.***.soap.util.xml.*;
importorg.***.soap.*;
importorg.***.rpc.*;
import***.io.*;
import***.net.*;
importj**a.***.vector;
publicclasscaService{
publicstaticStringgetService(Stringuser){
URLurl=**ll;
try{
url=newURL("http://192.168.0.100:8080/ca3/services/caSynrochnized");
}catch(MalformedURLExceptionmue){
return***.getmessage();
}
//ThisisthemainSOAPobject
CallsoapCall=newCall();
//UseSOAPencoding
***.setencodingstyleuri(***.ns_URI_SOAP_ENC);
//Thisistheremoteobjectwe'reaskingfortheprice
***.settargetobjecturi("urn:xmethods-caSynrochnized");
//Thisisthenameofthemethodonthe**veobject
***.setmethodname("getUser");
//WeneedtosendtheISBN**mberasaninputparametertothemethod
VectorsoapParams=newVector();
//name,type,value,encodingstyle
ParameterisbnParam=newParameter("userName",***.class,user,**ll);
***.addelement(isbnParam);
***.setparams(soapParams);
try{
//Invoketheremotemethodontheobject
ResponsesoapResponse=***.invoke(url,"");
//Checktoseeifthereisanerror,return"N/A"
if(***.generatedfault()){
Faultfault=***.getfault();
Stringf=***.get***string();
returnf;
}else{
//readresult
ParametersoapResult=***.getreturnvalue();
//getastringfromtheresult
return***.getvalue().toString();
}
}catch(SOAPExceptionse){
return***.getmessage();
}
}
}