use of javax.xml.ws.soap.SOAPBinding in project jbossws-cxf by jbossws.
the class ClientServlet3 method doGet.
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
boolean result = false;
try {
log.info("service = " + service);
Hello hello = service.getHelloPort();
SOAPBinding binding = (SOAPBinding) ((BindingProvider) hello).getBinding();
if ("true".equals(req.getParameter("mtom"))) {
log.info("mtom enabled = " + binding.isMTOMEnabled());
if (!binding.isMTOMEnabled()) {
throw new Exception("Expected mtom enabled because of @MTOM annotation");
}
}
result = hello.getMessageContextTest();
log.info("result = " + result);
} catch (Exception e) {
log.error("Error while invoking service!", e);
throw new ServletException(e);
}
resp.getWriter().print(result);
}
use of javax.xml.ws.soap.SOAPBinding in project jbossws-cxf by jbossws.
the class MTOMFeatureTestCase method addMTOMCheckHandler.
private static void addMTOMCheckHandler(MTOMEndpoint port) {
SOAPBinding binding = (SOAPBinding) ((BindingProvider) port).getBinding();
@SuppressWarnings("rawtypes") List<Handler> handlerChain = new ArrayList<Handler>();
handlerChain.addAll(binding.getHandlerChain());
handlerChain.add(new MTOMCheckClientHandler());
binding.setHandlerChain(handlerChain);
}
use of javax.xml.ws.soap.SOAPBinding in project jbossws-cxf by jbossws.
the class EJBClient method echo.
public String echo(String inStr) throws RemoteException {
log.info("echo: " + inStr);
List<Endpoint> ports = new ArrayList<Endpoint>(2);
try {
InitialContext iniCtx = new InitialContext();
ports.add(((Service) iniCtx.lookup("java:comp/env/service1")).getPort(Endpoint.class));
ports.add(((EndpointService) iniCtx.lookup("java:comp/env/service2")).getEndpointPort());
} catch (Exception ex) {
throw new WebServiceException(ex);
}
for (int i = 0; i < ports.size(); i++) {
Endpoint port = ports.get(i);
BindingProvider bp = (BindingProvider) port;
@SuppressWarnings("unused") boolean mtomEnabled = ((SOAPBinding) bp.getBinding()).isMTOMEnabled();
// boolean expectedSetting = (i==0) ? false : true;
// if(mtomEnabled != expectedSetting)
// throw new WebServiceException("MTOM settings (enabled="+expectedSetting+") not overridden through service-ref" );
String outStr = port.echo(inStr);
if (inStr.equals(outStr) == false)
throw new WebServiceException("Invalid echo return: " + inStr);
}
return inStr;
}
use of javax.xml.ws.soap.SOAPBinding in project jbossws-cxf by jbossws.
the class JBWS2419TestCase method testSOAP11ClientAccess.
@Test
@RunAsClient
public void testSOAP11ClientAccess() throws Exception {
URL wsdlURL = new URL(baseURL + "/soap11?wsdl");
QName qname = new QName("http://org.jboss.ws/jaxws/jbws2419", "SOAP11EndpointBeanService");
Service service = Service.create(wsdlURL, qname);
SOAP11Endpoint port = service.getPort(SOAP11Endpoint.class);
BindingProvider provider = (BindingProvider) port;
@SuppressWarnings("rawtypes") List<Handler> handlerChain = new ArrayList<Handler>();
handlerChain.addAll(provider.getBinding().getHandlerChain());
handlerChain.add(new SOAP11ClientHandler());
provider.getBinding().setHandlerChain(handlerChain);
((SOAPBinding) provider.getBinding()).setMTOMEnabled(true);
DataHandler response = port.namespace(new DataHandler("Jimbo", "text/plain"));
Object messg = getContent(response);
assertEquals("Hello Jimbo", messg);
}
use of javax.xml.ws.soap.SOAPBinding in project jbossws-cxf by jbossws.
the class JBWS2419TestCase method testSOAP12ClientAccess.
@Test
@RunAsClient
public void testSOAP12ClientAccess() throws Exception {
URL wsdlURL = new URL(baseURL + "/soap12?wsdl");
QName qname = new QName("http://org.jboss.ws/jaxws/jbws2419", "SOAP12EndpointBeanService");
Service service = Service.create(wsdlURL, qname);
SOAP12Endpoint port = service.getPort(SOAP12Endpoint.class);
BindingProvider provider = (BindingProvider) port;
@SuppressWarnings("rawtypes") List<Handler> handlerChain = new ArrayList<Handler>();
handlerChain.addAll(provider.getBinding().getHandlerChain());
handlerChain.add(new SOAP12ClientHandler());
provider.getBinding().setHandlerChain(handlerChain);
((SOAPBinding) provider.getBinding()).setMTOMEnabled(true);
DataHandler response = port.namespace(new DataHandler("Jimbo", "text/plain"));
Object messg = getContent(response);
assertEquals("Hello Jimbo", messg);
}
Aggregations