public
SOAPMessage createMessage(String target, String... values) {
try
{
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage msg = mf.createMessage();
SOAPPart sp = msg.getSOAPPart();
SOAPEnvelope envelope = sp.getEnvelope();
SOAPBody body = envelope.getBody();
SOAPElement node2 = body
.addChildElement(
new
QName(
"http://www.w3.org/2001/XMLSchema-instance"
,
target,
"ns1"
));
for
(
int
i =
0
; i < values.length; i++) {
String value = values[i];
node2.addChildElement(
"param"
+ i).addTextNode(value);
}
msg.writeTo(System.err);
msg.saveChanges();
return
msg;
}
catch
(Exception e) {
e.printStackTrace();
return
null
;
// 一般要进行错误处理,这里省略
}
}
首先要确定xfire是兼容的,,,,,,然后可以使用xfire客户端工具生成客户端接口、代码等。。。。。。最后就可以调用了