JAXBContextFactory jaxbContextFactory = new JAXBContextFactory.Builder()
.withMarshallerSchemaLocation("http://apihost http://apihost/schema.xsd")
.build();
JAXBModule jaxbModule = new JAXBModule(jaxbContextFactory);
Encoder encoder = jaxbModule.encoder(new JAXBEncoder(jaxbContextFactory));
MockObject mock = new MockObject();
mock.setValue("Test");
RequestTemplate template = new RequestTemplate();
encoder.encode(mock, template);
assertEquals(new String(template.body(), UTF_8), "<?xml version=\"1.0\" encoding=\"UTF-8\" " +
"standalone=\"yes\"?><mockObject xsi:schemaLocation=\"http://apihost " +
"http://apihost/schema.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" +
"<value>Test</value></mockObject>");