use of jakarta.xml.ws.BindingProvider 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.BindingProvider 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));
}
use of jakarta.xml.ws.BindingProvider in project metro-jax-ws by eclipse-ee4j.
the class HostIgnoreCaseTest method test3.
/*
* With maintain property set to true, session
* should be maintained.
*/
public void test3() throws Exception {
Hello proxy = new HelloService().getHelloPort();
// Set the adress with upper case hostname
Map<String, Object> requestContext = ((BindingProvider) proxy).getRequestContext();
requestContext.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
// proxy.introduce(); Doing this below as setting endpoint address
// resets the cookie store. Will be handled in future revisions
String addr = (String) requestContext.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
URL url = new URL(addr);
String host = url.getHost();
addr = addr.replace(host, host.toUpperCase());
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, addr);
proxy.introduce();
assertTrue("client session should be maintained", proxy.rememberMe());
}
use of jakarta.xml.ws.BindingProvider in project metro-jax-ws by eclipse-ee4j.
the class HostIgnoreCaseTest method test3.
/*
* With maintain property set to true, session
* should be maintained.
*/
public void test3() throws Exception {
Hello proxy = new HelloService().getHelloPort();
// Set the adress with upper case hostname
Map<String, Object> requestContext = ((BindingProvider) proxy).getRequestContext();
requestContext.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
proxy.introduce();
String addr = (String) requestContext.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
URL url = new URL(addr);
String host = url.getHost();
addr = addr.replace(host, host.toUpperCase());
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, addr);
assertTrue("client session should be maintained", proxy.rememberMe());
}
use of jakarta.xml.ws.BindingProvider in project metro-jax-ws by eclipse-ee4j.
the class SOAPActionTest method testUnquotedSOAPAction2.
public void testUnquotedSOAPAction2() throws Exception {
TestEndpoint port = new TestEndpointService().getTestEndpointPort1();
String address = (String) ((BindingProvider) port).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
HTTPResponseInfo rInfo = ClientServerTestUtil.sendPOSTRequest(address, s11_request, "text/xml", "http://example.com/action/echo1");
String resp = rInfo.getResponseBody();
SOAPMessage respMesg = getSOAPMessage(makeStreamSource(resp));
SOAPBody body = respMesg.getSOAPPart().getEnvelope().getBody();
Element e = (Element) body.getElementsByTagName("return").item(0);
// make sure it is dispatched to echo1() using SoapAction
assertEquals("Hello1 Duke", e.getTextContent());
}
Aggregations