use of jakarta.xml.ws.soap.MTOMFeature in project metro-jax-ws by eclipse-ee4j.
the class MtomApp method main.
public static void main(String[] args) {
try {
MtomSample port = new MtomService().getMtomPort(new MTOMFeature());
if (port == null) {
System.out.println("FAILURE: Couldnt get port!");
System.exit(-1);
}
testUpload(port);
testDownload(port);
} catch (Exception ex) {
System.out.println("SOAP 1.1 MtomApp FAILED!");
ex.printStackTrace();
}
}
use of jakarta.xml.ws.soap.MTOMFeature in project metro-jax-ws by eclipse-ee4j.
the class SOAPBindingCodec method postDecode.
/**
* Should be called after decode().
* Set the state so that such state is used by encode().
*/
private void postDecode(Packet p) {
p.setFastInfosetDisabled(isFastInfosetDisabled);
if (features.isEnabled(MTOMFeature.class))
p.checkMtomAcceptable();
// p.setMtomAcceptable( isMtomAcceptable(p.acceptableMimeTypes) );
MTOMFeature mtomFeature = features.get(MTOMFeature.class);
if (mtomFeature != null) {
p.setMtomFeature(mtomFeature);
}
if (!useFastInfosetForEncoding) {
useFastInfosetForEncoding = p.getFastInfosetAcceptable(fiMimeType);
// useFastInfosetForEncoding = isFastInfosetAcceptable(p.acceptableMimeTypes);
}
}
use of jakarta.xml.ws.soap.MTOMFeature in project metro-jax-ws by eclipse-ee4j.
the class DeploymentDescriptorParser method parseAdapters.
private List<A> parseAdapters(XMLStreamReader reader) throws IOException, XMLStreamException {
if (!reader.getName().equals(QNAME_ENDPOINTS)) {
failWithFullName("runtime.parser.invalidElement", reader);
}
List<A> adapters = new ArrayList<>();
String version = getMandatoryNonEmptyAttribute(reader, ATTR_VERSION);
if (!version.equals(ATTRVALUE_VERSION_1_0)) {
failWithLocalName("sun-jaxws.xml's version attribut runtime.parser.invalidVersionNumber", reader, version);
}
while (nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
if (reader.getName().equals(QNAME_ENDPOINT)) {
String name = getMandatoryNonEmptyAttribute(reader, ATTR_NAME);
if (!names.add(name)) {
logger.log(Level.WARNING, "sun-jaxws.xml contains duplicate endpoint names. " + "The first duplicate name is = {0}", name);
}
String implementationName = getMandatoryNonEmptyAttribute(reader, ATTR_IMPLEMENTATION);
Class<?> implementorClass = getImplementorClass(implementationName, reader);
QName serviceName = getQNameAttribute(reader, ATTR_SERVICE);
QName portName = getQNameAttribute(reader, ATTR_PORT);
ArrayList<WebServiceFeature> features = new ArrayList<>();
// get enable-mtom attribute value
String enable_mtom = getAttribute(reader, ATTR_ENABLE_MTOM);
String mtomThreshold = getAttribute(reader, ATTR_MTOM_THRESHOLD_VALUE);
if (Boolean.valueOf(enable_mtom)) {
if (mtomThreshold != null) {
features.add(new MTOMFeature(true, Integer.parseInt(mtomThreshold)));
} else {
features.add(new MTOMFeature(true));
}
}
String bindingId = getAttribute(reader, ATTR_BINDING);
if (bindingId != null) {
// Convert short-form tokens to API's binding ids
bindingId = getBindingIdForToken(bindingId);
}
String urlPattern = getMandatoryNonEmptyAttribute(reader, ATTR_URL_PATTERN);
// boolean handlersSetInDD = setHandlersAndRoles(binding, reader, serviceName, portName);
nextElementContent(reader);
ensureNoContent(reader);
List<Source> metadata = new ArrayList<>();
for (URL url : docs) {
Source source = new StreamSource(url.openStream(), url.toExternalForm());
metadata.add(source);
}
adapters.add(adapterFactory.createAdapter(name, urlPattern, implementorClass, serviceName, portName, bindingId, metadata, features.toArray(new WebServiceFeature[0])));
} else {
failWithLocalName("runtime.parser.invalidElement", reader);
}
}
return adapters;
}
use of jakarta.xml.ws.soap.MTOMFeature in project metro-jax-ws by eclipse-ee4j.
the class MessageContextFactory method packet.
private Packet packet(Message m) {
final Packet p = new Packet();
// TODO when do we use xmlCodec?
p.codec = soapCodec;
if (m != null)
p.setMessage(m);
MTOMFeature mf = features.get(MTOMFeature.class);
if (mf != null) {
p.setMtomFeature(mf);
}
p.setSAAJFactory(saajFactory);
return p;
}
use of jakarta.xml.ws.soap.MTOMFeature in project metro-jax-ws by eclipse-ee4j.
the class MTOMActionEncodingTest method test.
public void test() throws UnsupportedEncodingException {
Echo echoPort = new EchoService().getEchoPort(new MTOMFeature());
String echoed = echoPort.echo(ALMOST_BINARY_CONTENT.getBytes("UTF-8"));
assertEquals(echoed, ALMOST_BINARY_CONTENT);
}
Aggregations