use of jakarta.xml.ws.BindingProvider in project metro-jax-ws by eclipse-ee4j.
the class AddNumbersTest method testSuccess.
@Test
public void testSuccess() throws AddNumbersException_Exception {
AddNumbers port = new AddNumbersImplService().getAddNumbersImplPort();
Map<String, Object> ctxt = ((BindingProvider) port).getRequestContext();
int number1 = 10;
int number2 = 20;
System.out.printf("Invoking addNumbers(%d, %d)\n", number1, number2);
int result = port.add(number1, number2);
System.out.printf("The result of adding %d and %d is %d.\n\n", number1, number2, result);
Assertions.assertEquals(30, result);
}
use of jakarta.xml.ws.BindingProvider in project metro-jax-ws by eclipse-ee4j.
the class MtomTest method testMtom.
// test for WSIT 1069, makes sure Mtom is enabled and this happens when the WSDL has the necessary policy assertion.
public void testMtom() throws Exception {
MtomSample proxy = new MtomSampleService().getMtomSamplePort();
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);
assertTrue(s.startsWith("multipart/related"));
assertTrue(s.contains("type=\"application/xop+xml\""));
}
use of jakarta.xml.ws.BindingProvider in project metro-jax-ws by eclipse-ee4j.
the class OnewayTest method getHttpStatus.
private int getHttpStatus(String address) throws Exception {
QName portName = new QName(NS, "OnewayEndpointPort");
QName serviceName = new QName(NS, "OnewayEndpointService");
Service service = Service.create(new URL(address + "?wsdl"), serviceName);
Dispatch<Source> d = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
String body = "<ns0:echoInteger xmlns:ns0='" + NS + "'><arg0>12345</arg0></ns0:echoInteger>";
d.invokeOneWay(new StreamSource(new StringReader(body)));
Map<String, Object> rc = ((BindingProvider) d).getResponseContext();
return (Integer) rc.get(MessageContext.HTTP_RESPONSE_CODE);
}
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();
Map<String, Object> requestContext = ((BindingProvider) proxy).getRequestContext();
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);
requestContext.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
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 SOAPActionTest method testUnquotedSOAPAction1.
public void testUnquotedSOAPAction1() 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/echo");
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 echo() using SoapAction
assertEquals("Hello Duke", e.getTextContent());
}
Aggregations