How to marshal into javax.xml.transform.Source
I am using JAXWS and JAXB to build my web service application. I am struggling to get it work.
When unmarshaling from a file, javax.xml.transform.Source can be created from an input stream. It works fine.
But I have problem marshaling back to source. I can marshal it to System.out but want to reply to a client in form of javax.xml.transform.Source.
StringWriter writer = new StringWriter();
Source source = new StreamSource(writer.toString());
Then I get:
java.net.MalformedURLException: no protocol: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> . . . .
I have to return Source as I am implementing Provider
public class TestService implements Provider