use of com.sun.xml.stream.buffer.XMLStreamBufferResult in project metro-jax-ws by eclipse-ee4j.
the class WSDLGenResolver method getAbstractWSDL.
/**
* Updates filename if the suggested filename need to be changed in
* wsdl:import. If the metadata already contains abstract wsdl(i.e. a WSDL
* which has the porttype), then the abstract wsdl shouldn't be generated
*
* return null if abstract WSDL need not be generated
* Result the abstract WSDL
*/
public Result getAbstractWSDL(Holder<String> filename) {
if (abstractWsdl != null) {
filename.value = abstractWsdl.getURL().toString();
// Don't generate abstract WSDL
return null;
}
URL url = createURL(filename.value);
MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
xsb.setSystemId(url.toExternalForm());
SDDocumentSource abstractWsdlSource = SDDocumentSource.create(url, xsb);
newDocs.add(abstractWsdlSource);
XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
r.setSystemId(filename.value);
return r;
}
use of com.sun.xml.stream.buffer.XMLStreamBufferResult in project metro-jax-ws by eclipse-ee4j.
the class EndpointImpl method buildDocList.
/**
* Convert metadata sources using identity transform. So that we can
* reuse the Source object multiple times.
*/
private List<SDDocumentSource> buildDocList() {
List<SDDocumentSource> r = new ArrayList<>();
if (metadata != null) {
for (Source source : metadata) {
try {
XMLStreamBufferResult xsbr = XmlUtil.identityTransform(source, new XMLStreamBufferResult());
String systemId = source.getSystemId();
r.add(SDDocumentSource.create(new URL(systemId), xsbr.getXMLStreamBuffer()));
} catch (TransformerException | IOException | SAXException | ParserConfigurationException te) {
throw new ServerRtException("server.rt.err", te);
}
}
}
return r;
}
use of com.sun.xml.stream.buffer.XMLStreamBufferResult in project metro-jax-ws by eclipse-ee4j.
the class JAXBTest method testJAXBElementMarshalling.
public void testJAXBElementMarshalling() throws Exception {
JAXBRIContext jc = (JAXBRIContext) JAXBContext.newInstance(whitebox.jaxb.client.DetailType.class);
DetailType dt = new DetailType();
SOAPFault sf = createFault();
dt.getDetails().add(sf.getDetail());
Marshaller m = jc.createMarshaller();
m.marshal(dt, System.out);
XMLStreamBufferResult sbr = new XMLStreamBufferResult();
m.setProperty(Marshaller.JAXB_FRAGMENT, true);
m.marshal(dt, sbr);
XMLStreamBuffer infoset = sbr.getXMLStreamBuffer();
XMLStreamReader reader = infoset.readAsXMLStreamReader();
if (reader.getEventType() == START_DOCUMENT)
XMLStreamReaderUtil.nextElementContent(reader);
verifyDetail(reader);
}
use of com.sun.xml.stream.buffer.XMLStreamBufferResult in project metro-jax-ws by eclipse-ee4j.
the class WSDLGenResolver method getWSDL.
/**
* Generates the concrete WSDL that contains service element.
*
* @return Result the generated concrete WSDL
*/
public Result getWSDL(String filename) {
URL url = createURL(filename);
MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
xsb.setSystemId(url.toExternalForm());
concreteWsdlSource = SDDocumentSource.create(url, xsb);
newDocs.add(concreteWsdlSource);
XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
r.setSystemId(filename);
return r;
}
use of com.sun.xml.stream.buffer.XMLStreamBufferResult in project metro-jax-ws by eclipse-ee4j.
the class WSDLGenResolver method getSchemaOutput.
/**
* Updates filename if the suggested filename need to be changed in
* xsd:import. If there is already a schema document for the namespace
* in the metadata, then it is not generated.
*
* return null if schema need not be generated
* Result the generated schema document
*/
public Result getSchemaOutput(String namespace, Holder<String> filename) {
List<SDDocumentImpl> schemas = nsMapping.get(namespace);
if (schemas != null) {
if (schemas.size() > 1) {
throw new ServerRtException("server.rt.err", "More than one schema for the target namespace " + namespace);
}
filename.value = schemas.get(0).getURL().toExternalForm();
// Don't generate schema
return null;
}
URL url = createURL(filename.value);
MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
xsb.setSystemId(url.toExternalForm());
SDDocumentSource sd = SDDocumentSource.create(url, xsb);
newDocs.add(sd);
XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
r.setSystemId(filename.value);
return r;
}
Aggregations