1 Reply Latest reply on Oct 22, 2008 12:24 PM by Alessio Soldano

    how to enable both WS Security and MTOM

    Ramachandran Krishnan Newbie

      I am trying to call a web service running in JBoss. The web service is enabled with both ws security and MTOM as per the requirement. When i am trying to call the web method from my java client, i am getting the below exception

      Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Endpoint {http://wsg.hpos.om.hp.com/}HPOSGatewayPort does not contain operation meta data for: {http://www.w3.org/2001/04/xmlenc#}EncryptedData
      at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException(SOAPFaultHelperJAXWS.java:72)
      at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultException(SOAP11BindingJAXWS.java:109)
      at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPBinding.java:579)
      at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:381)
      at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:300)
      at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:166)
      at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:152)
      at $Proxy17.getName(Unknown Source)
      at wsclient.TestHPOSClient.main(TestHPOSClient.java:106)

      my client code is:
      URL endpoint_new = new URL("http://15.70.176.190:9000/HPOSGateway/HPOSGateway?wsdl");
      QName qname = new QName("http://wsg.hpos.om.hp.com/", "HPOSGatewayService");
      HPOSGateway port = new HPOSGatewayService(endpoint_new,qname).getHPOSGatewayPort();
      BindingProvider bp=(BindingProvider)port;
      SOAPBinding binding = (SOAPBinding)bp.getBinding();
      binding.setMTOMEnabled(true);
      Map<String,Object> map = bp.getRequestContext();
      map.put(BindingProvider.USERNAME_PROPERTY,"administrator");
      map.put(BindingProvider.PASSWORD_PROPERTY,"da1sy");
      URL securityURL = new File("c://jboss-wsse-client.xml").toURL();
      ((StubExt)port).setSecurityConfig(securityURL.toExternalForm());
      ((StubExt)port).setConfigName("Standard WSSecurity Client");
      map.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://15.70.176.190:9000/HPOSGateway/HPOSGateway");
      System.setProperty("org.jboss.ws.wsse.keyStore", "c:\\wsse.keystore");
      System.setProperty("org.jboss.ws.wsse.trustStore", "c:\\wsse.truststore");
      System.setProperty("org.jboss.ws.wsse.keyStorePassword", "jbossws");
      System.setProperty("org.jboss.ws.wsse.trustStorePassword", "jbossws");
      System.setProperty("org.jboss.ws.wsse.keyStoreType", "jks");
      System.setProperty("org.jboss.ws.wsse.trustStoreType", "jks");
      System.out.println(port.getName("Welcome to this testing part."));

      ,, my jboss.wsse.client.xml is...

      <?xml version="1.0" encoding="UTF-8" ?>
      <jboss-ws-security xmlns="http://www.jboss.com/ws-security/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">






      </jboss-ws-security>

      and my jboss-wsse-server.xml is ...

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-ws-security xmlns="http://www.jboss.com/ws-security/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
      <key-store-file>WEB-INF/wsse.keystore</key-store-file>
      <key-store-password>jbossws</key-store-password>
      <trust-store-file>WEB-INF/wsse.truststore</trust-store-file>
      <trust-store-password>jbossws</trust-store-password>






      </jboss-ws-security>

      i have my web service annotations like below.

      @WebService(name="HPOSGateway",targetNamespace="http://wsg.hpos.om.hp.com/")
      @EndpointConfig(configName = "Standard WSSecurity Endpoint")
      @BindingType(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING)
      @HandlerChain(name = "HPOSGateway_handlerChain", file = "HPOSGateway_handler.xml")
      public class HPOSGateway{

      Can any one help me what is the problem and where i need to change? Please it is very urgent.

      Regards
      Ramchand