我有这个示例代码:
private static final String endpoint = "https://www.***.**:443/WSEndUser?wsdl";
public static void main(String[] args) throws SOAPException {
SOAPMessage message = MessageFactory.newInstance().createMessage();
SOAPHeader header = message.getSOAPHeader();
header.detachNode();
/*
SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
envelope.setAttribute("namespace","namespaceUrl");
*/
SOAPBody body = message.getSOAPBody();
QName bodyName = new QName("getVServers");
SOAPBodyElement bodyElement = body.addBodyElement(bodyName);
SOAPElement symbol = bodyElement.addChildElement("loginName");
symbol.addTextNode("my login name");
symbol = bodyElement.addChildElement("password");
symbol.addTextNode("my password");
SOAPConnection connection = SOAPConnectionFactory.newInstance().createConnection();
SOAPMessage response = connection.call(message, endpoint);
connection.close();
SOAPBody responseBody = response.getSOAPBody();
SOAPBodyElement responseElement = (SOAPBodyElement)responseBody.getChildElements().next();
SOAPElement returnElement = (SOAPElement)responseElement.getChildElements().next();
if(responseBody.getFault()!=null){
System.out.println("1) " + returnElement.getValue()+" "+responseBody.getFault().getFaultString());
} else {
System.out.println("2) " + returnElement.getValue());
}
}
我得到了这个错误:
1) S:Client 找不到 {}getVServers 的调度方法
但我知道该方法存在......有什么问题?