6 Replies Latest reply on Nov 29, 2012 11:43 AM by noe_bartino1984

    missing <wsse:Security> tag in WS-Security

    t.himaja

      Hi,

       

      I made ejb module as web service. And i want to encrypt SOAP message based on WS-Security for that web service.

       

      I followed Jboss in Action to configure WS-Security in Jboss server.

       

      At Server side:

       

      Server.java

      import javax.jws.WebService;
      import javax.ejb.Stateless;
      import org.jboss.ws.annotation.EndpointConfig;
      
      @WebService()
      @EndpointConfig(configName="Standard WSSecurity Endpoint")
      @Stateless()
      public class Server {
          public String message(){
              return "hello";
          }
      }
      

       

      I added jboss-wsse-server.xml, wsse.keystore, wsse.truststore in META-INF folder.

       

      jboss-wsse-server.xml

       

       

      <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>META-INF/wsse.keystore</key-store-file>
       <key-store-type>jks</key-store-type>
       <key-store-password>wsseServer</key-store-password>
       <trust-store-file>META-INF/wsse.truststore</trust-store-file>
       <trust-store-type>jks</trust-store-type>
       <trust-store-password>wsseServer</trust-store-password>
       <config>
         <encrypt type="x509v3" alias="wsseClient"/>
         <requires>
          <encryption />
         </requires>
       </config>
      </jboss-ws-security>
      

       

      wsse.keystore

       

      Your keystore contains 2 entries
      
      Alias name: wsseserver
      Creation date: 5 Jan, 2011
      Entry type: PrivateKeyEntry
      Certificate chain length: 1
      Certificate[1]:
      Owner: CN=wsseServer, OU=esm, O=mq, L=hyd, ST=ap, C=in
      Issuer: CN=wsseServer, OU=esm, O=mq, L=hyd, ST=ap, C=in
      Serial number: 4d23ffdf
      Valid from: Wed Jan 05 10:51:35 IST 2011 until: Tue Apr 05 10:51:35 IST 2011
      Certificate fingerprints:
           MD5:  8D:6A:3E:C2:5C:B4:70:E1:18:E6:FB:97:4A:9B:74:A1
           SHA1: FE:7A:8A:EF:29:18:C4:42:75:E4:1E:18:C5:94:92:FE:D3:FC:41:3F
           Signature algorithm name: SHA1withRSA
           Version: 3
      
      
      Alias name: wsseclient
      Creation date: 5 Jan, 2011
      Entry type: trustedCertEntry
      
      Owner: CN=wsseClient, OU=esm, O=mq, L=hyd, ST=ap, C=in
      Issuer: CN=wsseClient, OU=esm, O=mq, L=hyd, ST=ap, C=in
      Serial number: 4d2403fc
      Valid from: Wed Jan 05 11:09:08 IST 2011 until: Tue Apr 05 11:09:08 IST 2011
      Certificate fingerprints:
           MD5:  82:09:26:68:DC:AE:FC:47:1E:C8:C5:A8:61:5A:EA:87
           SHA1: 0C:02:AE:FA:66:64:38:8F:39:6F:B9:C6:F4:E4:12:7F:AF:78:EF:EE
           Signature algorithm name: SHA1withRSA
           Version: 3
      

       

      in wsse.truststore

       

       

      Your keystore contains 1 entry
      
      Alias name: wsseserver
      Creation date: 5 Jan, 2011
      Entry type: trustedCertEntry
      
      Owner: CN=wsseServer, OU=esm, O=mq, L=hyd, ST=ap, C=in
      Issuer: CN=wsseServer, OU=esm, O=mq, L=hyd, ST=ap, C=in
      Serial number: 4d23ffdf
      Valid from: Wed Jan 05 10:51:35 IST 2011 until: Tue Apr 05 10:51:35 IST 2011
      Certificate fingerprints:
           MD5:  8D:6A:3E:C2:5C:B4:70:E1:18:E6:FB:97:4A:9B:74:A1
           SHA1: FE:7A:8A:EF:29:18:C4:42:75:E4:1E:18:C5:94:92:FE:D3:FC:41:3F
           Signature algorithm name: SHA1withRSA
           Version: 3
      

       

      i added jbossws-core.jar

       

      At Client side:

      My client is a stand-alone application and i didnot include any jars at this side

       

      public class Main {
          public static void main(String[] args) {
              try { // Call Web Service Operation
                  com.ServerService service = new com.ServerService();
                  com.Server port = service.getServerPort();
                  java.lang.String result = port.message();
                  System.out.println("Result = "+result);
              } catch (Exception ex) {
                  ex.printStackTrace();
              }
          }
      }
      

       

      jboss-wsse-client.xml

       

       

      <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>
       META-INF/wsseClient.keystore</key-store-file>
        <key-store-type>jks</key-store-type>
        <key-store-password>wsseClient</key-store-password>
        <trust-store-file>
        META-INF/wsseClient.truststore</trust-store-file>
        <trust-store-type>jks</trust-store-type>
        <trust-store-password>wsseClient</trust-store-password>
        <config>
         <encrypt type="x509v3" alias="wsseServer"/>
         <requires>
           <encryption/>
         </requires>
        </config>
      </jboss-ws-security>
      

       

      standard-jaxws-client-config.xml(copied this file from jboss server deployers/jbossws.deployer/META-INF/standard-jaxws-client-config.xml

       

      <jaxws-config xmlns="urn:jboss:jaxws-config:2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:javaee="http://java.sun.com/xml/ns/javaee"
        xsi:schemaLocation="urn:jboss:jaxws-config:2.0 jaxws-config_2_0.xsd">
      <client-config>
          <config-name>Standard WSSecurity Client</config-name>
          <post-handler-chains>
            <javaee:handler-chain>
              <javaee:protocol-bindings>##SOAP11_HTTP ##SOAP11_HTTP_MTOM</javaee:protocol-bindings>
              <javaee:handler>
                <javaee:handler-name>WSSecurityHandlerOutbound</javaee:handler-name>
                <javaee:handler-class>org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerClient</javaee:handler-class>
              </javaee:handler>
            </javaee:handler-chain>
          </post-handler-chains>
        </client-config>
      </jaxws-config>
      

       

      wsseClient.keystore

       

       

      Keystore type: JKS
      Keystore provider: SUN
      
      Your keystore contains 2 entries
      
      Alias name: wsseserver
      Creation date: 5 Jan, 2011
      Entry type: trustedCertEntry
      
      Owner: CN=wsseServer, OU=esm, O=mq, L=hyd, ST=ap, C=in
      Issuer: CN=wsseServer, OU=esm, O=mq, L=hyd, ST=ap, C=in
      Serial number: 4d23ffdf
      Valid from: Wed Jan 05 10:51:35 IST 2011 until: Tue Apr 05 10:51:35 IST 2011
      Certificate fingerprints:
           MD5:  8D:6A:3E:C2:5C:B4:70:E1:18:E6:FB:97:4A:9B:74:A1
           SHA1: FE:7A:8A:EF:29:18:C4:42:75:E4:1E:18:C5:94:92:FE:D3:FC:41:3F
           Signature algorithm name: SHA1withRSA
           Version: 3
      
      Alias name: wsseclient
      Creation date: 5 Jan, 2011
      Entry type: PrivateKeyEntry
      Certificate chain length: 1
      Certificate[1]:
      Owner: CN=wsseClient, OU=esm, O=mq, L=hyd, ST=ap, C=in
      Issuer: CN=wsseClient, OU=esm, O=mq, L=hyd, ST=ap, C=in
      Serial number: 4d2403fc
      Valid from: Wed Jan 05 11:09:08 IST 2011 until: Tue Apr 05 11:09:08 IST 2011
      Certificate fingerprints:
           MD5:  82:09:26:68:DC:AE:FC:47:1E:C8:C5:A8:61:5A:EA:87
           SHA1: 0C:02:AE:FA:66:64:38:8F:39:6F:B9:C6:F4:E4:12:7F:AF:78:EF:EE
           Signature algorithm name: SHA1withRSA
           Version: 3
      

       

      wsseClient.truststore

       

       

      Keystore type: JKS
      Keystore provider: SUN
      
      Your keystore contains 1 entry
      
      Alias name: wsseclient
      Creation date: 5 Jan, 2011
      Entry type: trustedCertEntry
      
      Owner: CN=wsseClient, OU=esm, O=mq, L=hyd, ST=ap, C=in
      Issuer: CN=wsseClient, OU=esm, O=mq, L=hyd, ST=ap, C=in
      Serial number: 4d2403fc
      Valid from: Wed Jan 05 11:09:08 IST 2011 until: Tue Apr 05 11:09:08 IST 2011
      Certificate fingerprints:
           MD5:  82:09:26:68:DC:AE:FC:47:1E:C8:C5:A8:61:5A:EA:87
           SHA1: 0C:02:AE:FA:66:64:38:8F:39:6F:B9:C6:F4:E4:12:7F:AF:78:EF:EE
           Signature algorithm name: SHA1withRSA
           Version: 3
      

       

      i included all these configuration files in META-INF folder.

       

      but i am getting error as

       

      at client-side

      javax.xml.ws.soap.SOAPFaultException: This service requires <wsse:Security>, which is missing.
              at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
              at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:111)
              at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
              at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
      

       

      at server-side

       

      Exception during handler processing
      org.jboss.ws.core.CommonSOAPFaultException: This service requires <wsse:Security>, which is missing.
          at org.jboss.ws.extensions.security.WSSecurityDispatcher.convertToFault(WSSecurityDispatcher.java:264)
          at org.jboss.ws.extensions.security.WSSecurityDispatcher.decodeMessage(WSSecurityDispatcher.java:94)
          at org.jboss.ws.extensions.security.jaxws.WSSecurityHandler.handleInboundSecurity(WSSecurityHandler.java:81)
      

       

      when i checked server.log, either incoming soap message or outgoing soap message not encrypted.

       

      Do i need to add any more files or do any modifications?

      please help me in solving out this issue.

      I need to solve it as soon as possible.

       

      U can also specify any references, so that i can follow

       

      Thanks in advance.

        • 1. Re: missing <wsse:Security> tag in WS-Security
          t.himaja

          Hi,

          Later i added few jars like jbossws-client.jar, jboss-common.jar, log4j.jar then i got some debug log at client side as follows:

          DEBUG [main] (JAXWSClientMetaDataBuilder.java:77) - START buildMetaData: [service={http://com/}ServerService]
          DEBUG [main] (WSDLDefinitionsFactory.java:102) - parse: http://127.0.0.1:9898/JbossWS/Server?wsdl
          DEBUG [main] (JavaToXSD.java:175) - Load schema: http://com/=file:/tmp/JBossWS_com_5071302848578309750.xsd
          DEBUG [main] (JBossWSEntityResolver.java:64) - resolveEntity: [pub=null,sysid=file:/tmp/JBossWS_com_5071302848578309750.xsd]
          DEBUG [main] (JBossWSEntityResolver.java:64) - resolveEntity: [pub=http://schemas.xmlsoap.org/soap/encoding/,sysid=null]
          DEBUG [main] (EndpointMetaData.java:311) - Using default parameter style: WRAPPED
          DEBUG [main] (JAXWSClientMetaDataBuilder.java:102) - END buildMetaData: 
          UnifiedMetaData: 
           implementation: jbossws-3.0.1-native-2.0.4.GA (build=200803312044)
           deploymentName: null
           securityDomain: null
          
          ServiceMetaData:
           qname={http://com/}ServerService
           refName=null
           wsdName=null
           wsdlFile=null
           wsdlLocation=http://127.0.0.1:9898/JbossWS/Server?wsdl
           jaxrpcMapping=null
           publishLocation=null
           securityConfig=null
           properties=null
          
          TypesMetaData: 
          <schema targetNamespace='http://com/' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://com/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
           <complexType name='message'/>
           <complexType name='messageResponse'>
            <sequence>
             <element maxOccurs='1' minOccurs='0' name='return' type='string'/>
            </sequence>
           </complexType>
           <element name='message' type='tns:message'/>
           <element name='messageResponse' type='tns:messageResponse'/>
          </schema>
          
          
          ClientEndpointMetaData:
           type=JAXWS
           qname={http://com/}ServerPort
           address=http://127.0.0.1:9898/JbossWS/Server
           binding=http://schemas.xmlsoap.org/wsdl/soap/http
           seiName=null
           configFile=META-INF/standard-jaxws-client-config.xml
           configName=Standard Client(Doubt At This Point)
           authMethod=null
           properties={}
          
          OperationMetaData:
           qname={http://com/}message
           javaName={http://com/}message
           style=document/literal/WRAPPED
           oneWay=false
           soapAction=
          DEBUG [main] (JAXWSClientMetaDataBuilder.java:276) - START: rebuildMetaData
          DEBUG [main] (EndpointMetaData.java:321) - setParameterStyle: null
          DEBUG [main] (EndpointMetaData.java:812) - Create new config [name=Standard Client,file=META-INF/standard-jaxws-client-config.xml]
          DEBUG [main] (JBossWSConfigFactory.java:125) - getConfig: [name=Standard Client,url=META-INF/standard-jaxws-client-config.xml]
          DEBUG [main] (JBossWSConfigFactory.java:71) - parse: jar:file:/home/himaja/NetBeansProjects/JbossWSClient/lib/jbossws-client.jar!/META-INF/standard-jaxws-client-config.xml
          DEBUG [main] (SaxJBossXBParser.java:241) - Created parser: org.apache.xerces.jaxp.SAXParserImpl@15aed57, isNamespaceAware: true, isValidating: true, isXIncludeAware: true
          DEBUG [main] (SaxJBossXBParser.java:157) - http://xml.org/sax/features/validation set to: true
          DEBUG [main] (SaxJBossXBParser.java:157) - http://xml.org/sax/features/namespaces set to: true
          DEBUG [main] (SaxJBossXBParser.java:157) - http://apache.org/xml/features/validation/dynamic set to: true
          DEBUG [main] (SaxJBossXBParser.java:157) - http://xml.org/sax/features/validation set to: true
          DEBUG [main] (SaxJBossXBParser.java:157) - http://apache.org/xml/features/validation/schema set to: true
          DEBUG [main] (SaxJBossXBParser.java:241) - Created parser: org.apache.xerces.jaxp.SAXParserImpl@15aed57, isNamespaceAware: true, isValidating: true, isXIncludeAware: true
          DEBUG [main] (EndpointMetaData.java:867) - Configure EndpointMetaData
          DEBUG [main] (EndpointMetaData.java:879) - Added 0 PRE handlers
          DEBUG [main] (EndpointMetaData.java:880) - Added 0 ENDPOINT handlers
          DEBUG [main] (EndpointMetaData.java:881) - Added 0 POST handlers
          DEBUG [main] (EndpointMetaData.java:321) - setParameterStyle: WRAPPED
          DEBUG [main] (JAXWSMetaDataBuilder.java:938) - JAXBContext [types=[class com.Message, class com.MessageResponse],tns=http://com/]
          DEBUG [main] (OperationMetaData.java:208) - Found best matching java method: public abstract java.lang.String com.Server.message()
          DEBUG [main] (JAXWSClientMetaDataBuilder.java:322) - END: rebuildMetaData
          
          ServiceMetaData:
           qname={http://com/}ServerService
           refName=null
           wsdName=null
           wsdlFile=null
           wsdlLocation=http://127.0.0.1:9898/JbossWS/Server?wsdl
           jaxrpcMapping=null
           publishLocation=null
           securityConfig=null
           properties=null
          
          TypesMetaData: 
            [complexType={http://com/}message,javaType=com.Message]
            [complexType={http://com/}messageResponse,javaType=com.MessageResponse]
          <schema targetNamespace='http://com/' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://com/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
           <complexType name='message'/>
           <complexType name='messageResponse'>
            <sequence>
             <element maxOccurs='1' minOccurs='0' name='return' type='string'/>
            </sequence>
           </complexType>
           <element name='message' type='tns:message'/>
           <element name='messageResponse' type='tns:messageResponse'/>
          </schema>
          
          
          ClientEndpointMetaData:
           type=JAXWS
           qname={http://com/}ServerPort
           address=http://127.0.0.1:9898/JbossWS/Server
           binding=http://schemas.xmlsoap.org/wsdl/soap/http
           seiName=com.Server
           configFile=META-INF/standard-jaxws-client-config.xml
           configName=Standard Client
           authMethod=null
           properties={}
          
          OperationMetaData:
           qname={http://com/}message
           javaName=message
           style=document/literal/WRAPPED
           oneWay=false
           soapAction=
          ParameterMetaData:
           xmlName={http://com/}message
           partName=message
           xmlType={http://com/}message
           javaType=com.Message
           mode=IN
           inHeader=false
           index=0
           wrappedParameters=[]
          ReturnMetaData:
           xmlName={http://com/}messageResponse
           partName=messageResponse
           xmlType={http://com/}messageResponse
           javaType=com.MessageResponse
           mode=OUT
           inHeader=false
           index=-1
           wrappedParameters=[[name = return, type = java.lang.String, typeArgs = null, variable = return, index = -1]]
          DEBUG [main] (EndpointMetaData.java:732) - Configure SOAPBinding
          DEBUG [main] (HandlerResolverImpl.java:125) - initHandlerChain: PRE
          DEBUG [main] (HandlerResolverImpl.java:125) - initHandlerChain: ENDPOINT
          DEBUG [main] (HandlerResolverImpl.java:125) - initHandlerChain: POST
          DEBUG [main] (HandlerResolverImpl.java:99) - getHandlerChain: [type=PRE,info=[service={http://com/}ServerService,port={http://com/}ServerPort,binding=http://schemas.xmlsoap.org/wsdl/soap/http]]
          DEBUG [main] (HandlerResolverImpl.java:99) - getHandlerChain: [type=POST,info=[service={http://com/}ServerService,port={http://com/}ServerPort,binding=http://schemas.xmlsoap.org/wsdl/soap/http]]
          DEBUG [main] (HandlerResolverImpl.java:99) - getHandlerChain: [type=ENDPOINT,info=[service={http://com/}ServerService,port={http://com/}ServerPort,binding=http://schemas.xmlsoap.org/wsdl/soap/http]]
          DEBUG [main] (BindingImpl.java:94) - setHandlerChain: []
          DEBUG [main] (ServiceDelegateImpl.java:434) - No port configuration for: {http://com/}ServerPort
          DEBUG [main] (MessageContextAssociation.java:46) - pushMessageContext: org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS@afae4a (Thread main)
          DEBUG [main] (ParameterWrapping.java:109) - wrapRequestParameters: com.Message
          DEBUG [main] (EndpointInvocation.java:103) - setRequestParamValue: [name={http://com/}message,value=com.Message]
          DEBUG [main] (CommonSOAPBinding.java:144) - bindRequestMessage: {http://com/}message
          DEBUG [main] (EndpointInvocation.java:110) - getRequestParamValue: {http://com/}message
          DEBUG [main] (EndpointInvocation.java:268) - transformPayloadValue: com.Message -> com.Message
          DEBUG [main] (HandlerChainExecutor.java:84) - Create a handler executor: []
          DEBUG [main] (HandlerChainExecutor.java:84) - Create a handler executor: []
          DEBUG [main] (HandlerChainExecutor.java:84) - Create a handler executor: []
          DEBUG [main] (HTTPRemotingConnection.java:176) - Get locator for: [addr=http://127.0.0.1:9898/JbossWS/Server,props={javax.xml.ws.service.endpoint.address=http://127.0.0.1:9898/JbossWS/Server}]
          DEBUG [main] (MicroRemoteClientInvoker.java:298) - org.jboss.remoting.transport.http.HTTPClientInvoker@15b0e2c connecting
          DEBUG [main] (MicroRemoteClientInvoker.java:312) - org.jboss.remoting.transport.http.HTTPClientInvoker@15b0e2c connected
          DEBUG [main] (HTTPRemotingConnection.java:220) - Remoting metadata: {NoThrowOnError=true, HEADER={SOAPAction="", Content-Type=text/xml; charset=UTF-8}}
          DEBUG [main] (HTTPClientInvoker.java:313) - Setting request header with SOAPAction : ""
          DEBUG [main] (HTTPClientInvoker.java:313) - Setting request header with Content-Type : text/xml; charset=UTF-8
          DEBUG [main] (SOAPContentElement.java:137) - -----------------------------------
          DEBUG [main] (SOAPContentElement.java:138) - Transitioning from OBJECT_VALID to XML_VALID
          DEBUG [main] (ObjectContent.java:135) - getXMLFragment from Object [xmlType={http://com/}message,javaType=class com.Message]
          DEBUG [main] (JAXBSerializer.java:61) - serialize: [xmlName={http://com/}message,xmlType={http://com/}message]
          DEBUG [main] (JAXBSerializer.java:83) - serialized: <ns1:message xmlns:ns1="http://com/"/>
          DEBUG [main] (ObjectContent.java:162) - xmlFragment: [source=<ns1:message xmlns:ns1="http://com/"/>]
          DEBUG [main] (SOAPContentElement.java:144) - -----------------------------------
          DEBUG [main] (SOAPMessageUnMarshallerHTTP.java:123) - getMimeHeaders from: {Date=[Thu, 13 Jan 2011 05:18:34 GMT], Transfer-Encoding=[chunked], NoThrowOnError=true, HEADER={SOAPAction="", Content-Type=text/xml; charset=UTF-8}, ResponseCode=500, ResponseCodeMessage=Internal Server Error, ResponseHeaders={null=[HTTP/1.1 500 Internal Server Error], Transfer-Encoding=[chunked], Date=[Thu, 13 Jan 2011 05:18:34 GMT], Content-Type=[text/xml;charset=UTF-8], Connection=[close], Server=[Apache-Coyote/1.1], X-Powered-By=[Servlet 2.5; JBoss-5.0/JBossWeb-2.1]}, Connection=[close], Content-Type=[text/xml;charset=UTF-8], X-Powered-By=[Servlet 2.5; JBoss-5.0/JBossWeb-2.1], Server=[Apache-Coyote/1.1]}
          DEBUG [main] (MessageFactoryImpl.java:215) - createMessage: [contentType=text/xml; charset=UTF-8]
          DEBUG [main] (InvokerRegistry.java:631) - removed org.jboss.remoting.transport.http.HTTPClientInvoker@15b0e2c from registry
          DEBUG [main] (MessageContextJAXWS.java:105) - Begin response processing
          DEBUG [main] (MessageContextAssociation.java:75) - popMessageContext: org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS@afae4a (Thread main)
          DEBUG [main] (MessageContextAssociation.java:46) - pushMessageContext: org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS@61cd2 (Thread main)
          DEBUG [main] (CommonSOAPBinding.java:542) - unbindResponseMessage: {http://com/}message
          DEBUG [main] (SOAPContentElement.java:137) - -----------------------------------
          DEBUG [main] (SOAPContentElement.java:138) - Transitioning from XML_VALID to DOM_VALID
          DEBUG [main] (SOAPContentElement.java:144) - -----------------------------------
          DEBUG [main] (HandlerChainExecutor.java:96) - close
          DEBUG [main] (HandlerChainExecutor.java:96) - close
          DEBUG [main] (HandlerChainExecutor.java:96) - close
          DEBUG [main] (MessageContextAssociation.java:75) - popMessageContext: org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS@61cd2 (Thread main)
          javax.xml.ws.soap.SOAPFaultException: This service requires <wsse:Security>, which is missing.
                  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:380)
                  at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:302)
                  at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:172)
                  at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:152)
                  at $Proxy15.message(Unknown Source)
                  at jbosswsclient.Main.main(Main.java:16)
          BUILD SUCCESSFUL (total time: 2 seconds)
          
          • 2. Re: missing <wsse:Security> tag in WS-Security
            t.himaja

            Hi All,

             

            Finally made it work. Here are few modifications need to be done in the client

            public class Main {
                public static void main(String[] args) {
                    try { // Call Web Service Operation
                        com.ServerService service = new com.ServerService();
                        com.Server port = service.getServerPort();
                        ((StubExt) port).setConfigName("Standard WSSecurity Client");// add this line
                        java.lang.String result = port.message();
                        System.out.println("Result = "+result);
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                }
            }
            
            

             

            Also u need to move few jars from /jboss-5.1.0GA/common/lib to /jboss-5.1.0GA/lib/endorsed

            jbossws-native-jaxrpc.jar

            jbossws-native-jaxws.jar

            jbossws-native-jaxws-ext.jar

            jbossws-native-saaj.jar

            jaxb-api.jar

             

            Also use a VM options or command line configurations as

             

            -Djava.endorsed.dirs=/opt/jboss-5.1.0.GA/lib/endorsed

             

            Add applicable jars relating to Jboss server.

            We used some as

            jbossws-client.jar , jboss-common.jar , log4j.jar , javassist.jar , jboss-remoting.jar , jboss-xml-binding.jar , jbossws-spi.jar ,  wsdl4j.jar , mail.jar , concurrent.jar , policy.jar ,  jaxb-impl.jar  and xmlsec.jar.

             

            It depends which are the jars your application ask for.

            • 3. missing <wsse:Security> tag in WS-Security
              gauravag

              Hi,

               

              It was of great help checking out all this thanks a ton.

               

              Regards,

              • 4. Re: missing <wsse:Security> tag in WS-Security
                t.himaja

                Hi All,

                 

                xmlsec.jar wont work, then u can get error as

                "An internal error occured in WS Security: See logs for details."

                 

                this is because it not able to configure the keyinfo and that remains "null"

                  <ds:KeyInfo xmlns:ds='null'>
                     <wsse:SecurityTokenReference wsu:Id='reference-4-1295325268127-18122243'>
                      <wsse:Reference URI='#token-3-1295325268076-22845412' ValueType='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3'/>
                     </wsse:SecurityTokenReference>
                    </ds:KeyInfo>
                

                 

                So use jar xmlsec1.4.1.jar

                 

                Regards,

                • 5. Re: missing <wsse:Security> tag in WS-Security
                  noe_bartino1984

                  Hi Himaja, Could You Help me?

                  I have moved few jars from /jboss-5.1.0GA/common/lib to /jboss-5.1.0GA/lib/endorsed

                   

                  I'm using this VM options  -Djava.endorsed.dirs=/opt/jboss-5.1.0.GA/lib/endorsed

                   

                  and added this jars to my classpath

                  jbossws-client.jar , jboss-common.jar , log4j.jar , javassist.jar , jboss-remoting.jar , jboss-xml-binding.jar , jbossws-spi.jar ,  wsdl4j.jar , mail.jar , concurrent.jar , policy.jar ,  jaxb-impl.jar  and xmlsec.jar.

                   

                  when I executed my client shows this:

                  ***********************

                  Create Web Service Client...

                  Create Web Service...

                  Call Web Service Operation...

                  Exception in thread "main" java.lang.ExceptionInInitializerError

                            at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)

                            at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)

                            at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)

                            at $Proxy25.multiplica(Unknown Source)

                            at misservicios.insys.ws.clientsample.ClientSample.main(ClientSample.java:14)

                  Caused by: java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to com.sun.xml.internal.bind.api.JAXBRIContext

                            at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.<clinit>(Unknown Source)

                   

                   

                  please I'm going crazy jaja

                   

                  Regards

                  • 6. Re: missing <wsse:Security> tag in WS-Security
                    noe_bartino1984

                    Hi:

                    I have found the solution to this mistake missing <wsse:Security> tag in WS-Security

                     

                    the configuration client

                     

                    jdk6 an jboss 5.1.0

                    I used this VM options  -Dsun.lang.ClassLoader.allowArraySyntax=true "-Djava.endorsed.dirs=D:\jboss-5.1.0.GA\lib\endorsed"


                     

                    and added this jars to my classpath

                     

                    • jaxb-impl.jar
                    • xmlsec-1.4.1.jar
                    • jboss-logging-spi.jar
                    • jbossws-spi.jar
                    • jbossws-spi.jar
                    • jbossws-native-jarxrpc.jar
                    • mail.jar
                    • jbossws-client.jar
                    • jboss-common-core.jar
                    • jbossws-common.jar
                    • wsdl4j.jar
                    • jboss-xml-binding.jar
                    • jaxb-xjc.jar
                    • xercesImpl.jar
                    • policy.jar
                    • commos-logging.jar
                    • javassist.jar
                    • concurrent.jar
                    • jboss-remoting.jar

                     

                     

                    my main Class Client

                     

                    import org.jboss.logging.Logger;

                    import org.jboss.ws.core.StubExt;

                     

                     

                    import misservicios.insys.ws.*;

                     

                     

                    public class ClientSample {

                              private static Logger log = Logger.getLogger(ClientSample.class);

                     

                     

                              public static void main(String[] args) {

                                      System.out.println("***********************");

                                      System.out.println("Create Web Service Client...");

                     

                                      try {

                               log.info("Create Web Service Client...");

                                                                      log.info("***********************");

                                                                      OperacionService service1 = new OperacionService();

                                                                      log.info("El Servicio consumido "+service1.getServiceName().getNamespaceURI());

                                                                      log.info("El host:"+service1.getWSDLDocumentLocation().getHost());

                                                                      log.info("El path:"+service1.getWSDLDocumentLocation().getPath());

                                                                      log.info("El Protocolo:"+service1.getWSDLDocumentLocation().getProtocol());

                     

                                                     Operacion port1 = service1.getOperacionPort();

                     

                     

                     

                                                ((StubExt) port1).setConfigName("Standard WSSecurity Client");// add this line

                                                System.setProperty("org.jboss.ws.wsse.keyStore", "D:\\MY_WEBSERVICES\\WEB_SERVICE_CLIENT\\src\\META-INF\\client-keystore.jks");

                                                System.setProperty("org.jboss.ws.wsse.keyStorePassword", "changeit");

                                                System.setProperty("org.jboss.ws.wsse.keyStoreType", "jks");

                     

                                                System.setProperty("org.jboss.ws.wsse.trustStore", "D:\\MY_WEBSERVICES\\WEB_SERVICE_CLIENT\\src\\META-INF\\client-truststore.jks");

                                                System.setProperty("org.jboss.ws.wsse.trustStorePassword", "changeit");

                                                System.setProperty("org.jboss.ws.wsse.trustStoreType", "jks");

                     

                     

                     

                     

                     

                     

                     

                                                log.info("Call Web Service Operation...");

                                                log.info("Server said: " + port1.multiplica(Integer.parseInt(args[0]),Integer.parseInt(args[1])));

                                                log.info("***********************");

                                                log.info("Call Over!");

                                                  } catch (Exception e) {

                     

                                                            log.error("ocurrio un Error ",e);

                                                  }

                     

                     

                     

                              }

                    }

                     

                    in the folder META-INF

                    client-keystore.jks

                    client-truststore.jks

                    jboss-wsse-client.xml

                    standard-jaxws-client-config.xml

                     

                     

                    and you can review this page  http://www.manning.com/jamae/chapter_9.pdf