(我正在使用eclipse)
我是Axis动态webservice客户端调用的新手。我编码如下
cEAServiceAvailRequestModel = getCEAServiceAvailRequestModel();
org.apache.axis.client.Call call = (org.apache.axis.client.Call)
getWSDLCallObject(wsConfig.getProperty("WsdlUrl"),
wsConfig.getProperty("MethodName"),
wsConfig.getProperty("PortName"),
wsConfig.getProperty("PortLocation"),
wsConfig.getProperty("ServiceName"),
wsConfig.getProperty("TargetNameSpace"),
wsConfig.getProperty("HandlerInfo"));
call = returnCAMEOCall(call);
Object[] objectList = new Object[1];
objectList[0] = cEAServiceAvailRequestModel;
CEAServiceAvailResponseModel responseModel = (CEAServiceAvailResponseModel) call
.invoke(objectList);
CEATypeAvailModel[] availabilityList = responseModel
.getAvailabilityList();
System.out.println("Final Response : " + availabilityList.toString());
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
public static Call getWSDLCallObject(String wsdlurl, String methodname,
String portname, String portLocation, String servicename,
String targetNameSpace, String handler) {
Call call = null;
try {
QName vnposvcName = new QName(targetNameSpace, servicename);
QName portName = new QName(portLocation, portname);
QName methodName = new QName(portLocation, methodname);
QName wponame = new QName("http://wpo.verizon.com", "wpo");
QName[] qnames = new QName[] { wponame };
ServiceFactory factory = ServiceFactory.newInstance();
javax.xml.rpc.Service service = factory.createService(new URL(
wsdlurl), vnposvcName);
if (handler != null) {
java.util.List list = service.getHandlerRegistry()
.getHandlerChain(portName);
HandlerInfo handlerInfo = new HandlerInfo(
Class.forName(handler), null, null);
list.add(handlerInfo);
}
call = service.createCall(portName, methodName);
} catch (Exception e) {
e.printStackTrace();
return null;
}
return call;
}
//我得到如下的异常
java.lang.ClassCastException:weblogic.webservice.core.rpc.CallImpl 在com.verizon.cameo.CameoWebServiceClient.CameoAddressValidation(CameoWebServiceClient.java:63) 在com.verizon.cameo.CameoWebServiceClient.main(CameoWebServiceClient.java:21)
答案 0 :(得分:0)
最后,我得到了解决方案,我们必须为类型转换设置VM参数,如下所示
-Djavax.xml.rpc.ServiceFactory=org.apache.axis.client.ServiceFactory
-Djavax.xml.soap.MessageFactory=org.apache.axis.soap.MessageFactoryImpl
-Dweblogic.webservice.client.ssl.trustedcertfile=C:\bea\bea1035\wlserver_10.3 \server\lib\trusted.crt
-Dweblogic.security.SSL.verbose=true
-Dweblogic.webservice.verbose=true
-Dweblogic.webservice.client.verbose=true
-Dssl.debug=true
-Dweblogic.webservice.client.ssl.strictcertchecking=false
现在,我可以拨打网络服务了。
谢谢