use of jakarta.xml.ws.soap.MTOMFeature in project metro-jax-ws by eclipse-ee4j.
the class MtomTest method testMtomOptionality.
// test for WSIT 1062
public void testMtomOptionality() throws Exception {
MtomSample proxy = new MtomSampleService().getMtomSamplePort(new MTOMFeature(false));
Source output = proxy.echo(getSource("sample_doc.xml"));
Map<String, List<String>> response_headers = (Map<String, List<String>>) ((BindingProvider) proxy).getResponseContext().get(MessageContext.HTTP_RESPONSE_HEADERS);
String s = response_headers.get("Content-Type").get(0);
System.out.println(s);
assertTrue(s.startsWith("application/soap+xml"));
assertTrue(!s.contains("type=\"application/xop+xml\""));
}
use of jakarta.xml.ws.soap.MTOMFeature in project metro-jax-ws by eclipse-ee4j.
the class MtomTest method testMtomPolicyOptionality.
// test for WSIT 1062, testing wsp:Optional="true" in the wsdl
public void testMtomPolicyOptionality() throws Exception {
MtomSample proxy = new MtomSampleService().getMtomSamplePort(new MTOMFeature(false));
String address = (String) ((BindingProvider) proxy).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
Document wsdl = db.parse(address + "?wsdl");
Element el = (Element) wsdl.getElementsByTagNameNS("http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization", "OptimizedMimeSerialization").item(0);
String optional = el.getAttributeNS("http://www.w3.org/ns/ws-policy", "Optional");
assertTrue(Boolean.valueOf(optional));
}
Aggregations