如何在Java中“接受” Web服务?

| 我有一个返回一些XML的Web服务,我想将此XML存储在我的Java应用程序中,但是我不确定如何做到这一点。 我觉得我可能正在搜索错误的术语,因此任何指针/教程都将有所帮助! 谢谢     
已邀请:
        您可以使用spring-ws它将为您处理一切 http://static.springsource.org/spring-ws/sites/2.0/ 然后做这样的事情
public class WebServiceClient {

private static final String MESSAGE =
    \"<message xmlns=\\\"http://tempuri.org\\\">Hello Web Service World</message>\";

private final WebServiceTemplate webServiceTemplate = new WebServiceTemplate();

public void setDefaultUri(String defaultUri) {
    webServiceTemplate.setDefaultUri(defaultUri);
}

// send to the configured default URI
public void simpleSendAndReceive() {
    StreamSource source = new StreamSource(new StringReader(MESSAGE));
    StreamResult result = new StreamResult(System.out);
    webServiceTemplate.sendSourceAndReceiveToResult(source, result);
}

// send to an explicit URI
public void customSendAndReceive() {
    StreamSource source = new StreamSource(new StringReader(MESSAGE));
    StreamResult result = new StreamResult(System.out);
      webServiceTemplate.sendSourceAndReceiveToResult(\"http://localhost:8080/AnotherWebService\",
        source, result);
}
}     

要回复问题请先登录注册