title: Java Glassfish - How to consume SSL web service?
body: <p>I used netbeans to create and deploy an SSL ejb hello world web service on Glassfish server and then tried (unsuccessfully) to consume that service from a java application.</p>
  
  <p>Any help would be highly appreciated. Below is more detail about what I did.</p>
  
  <hr>
  
  <ol>
  <li>I created a hello world (ejb) web service.</li>
  <li>I set the Secure Service option of the hello world web service to Transport Security (SSL)</li>
  <li>I deployed the web service on glassfish 3.1</li>
  <li>I created a java application, added a web service client that consumes the hello world web service using the wsdl: "https://localhost:8181/OanhWebService/OanhWebService?wsdl"</li>
  <li>When I tried to call the web service I got the following error:
  Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: WSS1601: Security Requirements not met - Transport binding configured in policy but incoming message was not SSL enabled
  When I try open the "Edit Web Service Attributes" dialog of the web service reference, in the tab "Quality Of Service" there is only one option Transport, the option Security is missing.
  Please help! This is a very basic task but it surprisingly cost me a lots of time.
  Many Thanks,
  Tuc</li>
  </ol>
  
  <hr>
  
  <p>Below is more details:</p>
  
  <p>-------------------Tools versions---------------------------------</p>
  
  <p>Glassfish version: 3.1
   Netbeans version 7.0 RC1 (tried 6.9.1 and 7 Beta, 7 Beta2 but experience same problem!)
   Metro 2.0</p>
  
  <p>------------------Published WSDL---------------------------------------</p>
  
  <p>WSDL viewed from a web browser:</p>
  
  <p>
   @namespace html url(http://www.w3.org/1999/xhtml); :root { font:small Verdana; font-weight: bold; padding: 2em; padding-left:4em; } * { display: block; padding-left: 2em; } html|style { display: none; } html|span, html|a { display: inline; padding: 0; font-weight: normal; text-decoration: none; } html|span.block { display: block; } *[html|hidden], span.block[html|hidden] { display: none; } .expand { display: block; } .expand:before { content: '+'; color: red; position: absolute; left: -1em; } .collapse { display: block; } .collapse:before { content: '-'; color: red; position: absolute; left:-1em; }
   http://jax-ws.dev.java.net. RI's version is Metro/2.1 (branches/2.1-6728; 2011-02-03T14:14:58+0000) JAXWS-RI/2.2.3 JAXWS/2.2. -->
   http://jax-ws.dev.java.net. RI's version is Metro/2.1 (branches/2.1-6728; 2011-02-03T14:14:58+0000) JAXWS-RI/2.2.3 JAXWS/2.2. -->
    </p>
  
  <p>----------------Traces at client site------------------------------------</p>
  
  <p>Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: WSS1601: Security Requirements not met - Transport binding configured in policy but incoming message was not SSL enabled
   at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
   at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:119)
   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 com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
   at $Proxy30.hello(Unknown Source)
   at oanhejbwebserviceclient.OanhEJBWebServiceClient.hello(OanhEJBWebServiceClient.java:47)
   at oanhejbwebserviceclient.OanhEJBWebServiceClient.main(OanhEJBWebServiceClient.java:39)
   Caused by: javax.xml.ws.soap.SOAPFaultException: WSS1601: Security Requirements not met - Transport binding configured in policy but incoming message was not SSL enabled
   at com.sun.xml.ws.security.opt.impl.util.SOAPUtil.createSOAPFault(SOAPUtil.java:223)
   at com.sun.xml.ws.security.opt.impl.util.SOAPUtil.getSOAPFaultException(SOAPUtil.java:215)
   at com.sun.xml.wss.provider.wsit.WSITServerAuthContext.validateRequest(WSITServerAuthContext.java:379)
   at com.sun.xml.wss.provider.wsit.WSITServerAuthContext.validateRequest(WSITServerAuthContext.java:263)
   at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:173)
   at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:144)
   at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:119)
   at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:641)
   at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:600)
   at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:585)
   at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:482)
   at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:314)
   at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:608)
   at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:259)
   at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:162)
   at org.glassfish.webservices.Ejb3MessageDispatcher.handlePost(Ejb3MessageDispatcher.java:120)
   at org.glassfish.webservices.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:91)
   at org.glassfish.webservices.EjbWebServiceServlet.dispatchToEjbEndpoint(EjbWebServiceServlet.java:200)
   at org.glassfish.webservices.EjbWebServiceServlet.service(EjbWebServiceServlet.java:131)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
   at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.doFilter(ServletAdapter.java:1002)
   at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.invokeFilterChain(ServletAdapter.java:942)
   at com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:404)
   at com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:354)
   at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
   at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
   at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234)
   at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
   at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
   at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
   at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
   at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
   at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
   at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
   at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
   at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
   at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
   at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
   at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
   at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
   at java.lang.Thread.run(Thread.java:662)
   Caused by: com.sun.xml.wss.impl.XWSSecurityRuntimeException: WSS1601: Security Requirements not met - Transport binding configured in policy but incoming message was not SSL enabled
   at com.sun.xml.wss.impl.policy.verifier.MessagePolicyVerifier.verifyPolicy(MessagePolicyVerifier.java:125)
   at com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.createMessage(SecurityRecipient.java:983)
   at com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.validateMessage(SecurityRecipient.java:232)
   at com.sun.xml.wss.provider.wsit.WSITServerAuthContext.verifyInboundMessage(WSITServerAuthContext.java:586)
   at com.sun.xml.wss.provider.wsit.WSITServerAuthContext.validateRequest(WSITServerAuthContext.java:360)</p>
  
  <p>-----------------------Trace at Server site--------------------------------------</p>
  
  <p>SEVERE: WSS1601: Security Requirements not met - Transport binding configured in policy but incoming message was not SSL enabled
   SEVERE: WSITPVD0035: Error in Verifying Security in Inbound Message.
   com.sun.xml.wss.impl.XWSSecurityRuntimeException: WSS1601: Security Requirements not met - Transport binding configured in policy but incoming message was not SSL enabled
   at com.sun.xml.wss.impl.policy.verifier.MessagePolicyVerifier.verifyPolicy(MessagePolicyVerifier.java:125)
   at com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.createMessage(SecurityRecipient.java:983)
   at com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.validateMessage(SecurityRecipient.java:232)
   at com.sun.xml.wss.provider.wsit.WSITServerAuthContext.verifyInboundMessage(WSITServerAuthContext.java:586)
   at com.sun.xml.wss.provider.wsit.WSITServerAuthContext.validateRequest(WSITServerAuthContext.java:360)
   at com.sun.xml.wss.provider.wsit.WSITServerAuthContext.validateRequest(WSITServerAuthContext.java:263)
   at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:173)
   at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:144)
   at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:119)
   at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:641)
   at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:600)
   at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:585)
   at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:482)
   at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:314)
   at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:608)
   at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:259)
   at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:162)
   at org.glassfish.webservices.Ejb3MessageDispatcher.handlePost(Ejb3MessageDispatcher.java:120)
   at org.glassfish.webservices.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:91)
   at org.glassfish.webservices.EjbWebServiceServlet.dispatchToEjbEndpoint(EjbWebServiceServlet.java:200)
   at org.glassfish.webservices.EjbWebServiceServlet.service(EjbWebServiceServlet.java:131)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
   at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.doFilter(ServletAdapter.java:1002)
   at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.invokeFilterChain(ServletAdapter.java:942)
   at com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:404)
   at com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:354)
   at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
   at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
   at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234)
   at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
   at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
   at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
   at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
   at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
   at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
   at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
   at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
   at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
   at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
   at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
   at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
   at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
   at java.lang.Thread.run(Thread.java:662)</p>