Reputation: 7370
I want to make a web service client and need a free reader/writer which can read/write soap messages and I easily just set/get message parameters.
I have my own network infrastructures and I want to work with them, and I just need something that can read/write from/to a byte array, or ByteBuffer, or somthing...
Is there any good hint?
Upvotes: 1
Views: 434
Reputation: 23268
SAAJ should do the job, and it comes standard with Java as of Java 6.
Reading from input stream:
ByteArrayInputStream in = ...;
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage message = mf.createMessage(new MimeHeaders(), in);
System.out.println(message.getSOAPBody().getElementsByTagNameNS("http://tempuri.org", "MyOperation"));
Writing:
SOAPMessage message = ...;
ByteArrayOutputStream out = new ByteArrayOutputStream();
message.writeTo(out);
System.out.println(out);
Upvotes: 1