我找到了解决办法。请参阅下面。
JaxWsPortProxyFactoryBean jaxWsPortProxyFactoryBean = new JaxWsPortProxyFactoryBean();
String URI = "http://localhost:8080/service";
try {
jaxWsPortProxyFactoryBean.setWsdlDocumentUrl(new URL(URI+"?wsdl"));
jaxWsPortProxyFactoryBean.setServiceInterface(myIService.class);
jaxWsPortProxyFactoryBean.setPortName(PORT);
jaxWsPortProxyFactoryBean.setNamespaceUri(URI);
jaxWsPortProxyFactoryBean.setServiceName(SERVICE_NAME);
logger.debug("WSDL - "+jaxWsPortProxyFactoryBean.getWsdlDocumentUrl());
jaxWsPortProxyFactoryBean.afterPropertiesSet();
} catch (Exception e) {
logger.error("Error occured while connecting to the TW web service -",e);
}
请参考Accessing web services using JAX-WS以获取有关端口和URI的更多信息。
服务接口 -
public interface testService {
@WebMethod(operationName = "myOperations", action = "")
@WebResult(name = "errorCode",targetNamespace = "")
public String testWebService(
@WebParam(name = "studentId", targetNamespace = "", mode = Mode.IN) Integer studentId,
@WebParam(name = "studenName", targetNamespace = "", mode = Mode.IN) String studenName);
}
myOperations - 就是你需要在web服务访问操作
的errorCode - 从web服务的返回值
studentId,studentName - 是的您需要发送到Web服务的参数。
我被卡住了如何找出将多个属性映射为webResults。我发布了this的问题,仍然没有任何运气。
来源
2011-05-05 14:34:41
Sam