私はこのサンプルコードを持っています:
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のディスパッチメソッドを見つけることができません
しかし、私はその方法が存在することを知っています...何が問題なのですか?