users@glassfish.java.net

Re: Problem in SecureWebServiceClient(UsernameAuthenticationwithSymmetric key)

From: <glassfish_at_javadesktop.org>
Date: Mon, 07 Sep 2009 08:55:25 PDT

Hello!!

These are my files:

wsit-client.xml
############

<?xml version="1.0" encoding="UTF-8"?>
 <definitions
 xmlns="http://schemas.xmlsoap.org/wsdl/"
 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="mainclientconfig"
>
    <import location="PruebaWSService.xml" namespace="http://prueba/"/>
</definitions>

PruebaWSService.xml
###################
<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3.2-hudson-754-SNAPSHOT. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3.2-hudson-754-SNAPSHOT. --><definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://prueba/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://prueba/" name="PruebaWSService" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:sc="http://schemas.sun.com/2006/03/wss/client" xmlns:wspp="http://java.sun.com/xml/ns/wsit/policy" xmlns:tc="http://schemas.sun.com/ws/2006/05/trust/client">
<types>
<xsd:schema>
<xsd:import namespace="http://prueba/" schemaLocation="http://localhost:8080/ServicioApp/PruebaWSService?xsd=1"></xsd:import>
</xsd:schema>
</types>
<message name="saludar">
<part name="parameters" element="tns:saludar"></part>
</message>
<message name="saludarResponse">
<part name="parameters" element="tns:saludarResponse"></part>
</message>
<portType name="PruebaWS">
<operation name="saludar">
<input message="tns:saludar"></input>
<output message="tns:saludarResponse"></output>
</operation>
</portType>
<binding name="PruebaWSPortBinding" type="tns:PruebaWS">
    <wsp:PolicyReference URI="#PruebaWSPortBindingPolicy"/>
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding>
<operation name="saludar">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal"></soap:body>
</input>
<output>
<soap:body use="literal"></soap:body>
</output>
</operation>
</binding>
<service name="PruebaWSService">
<port name="PruebaWSPort" binding="tns:PruebaWSPortBinding">
<soap:address location="http://localhost:8080/ServicioApp/PruebaWSService"></soap:address>
</port>
</service>
    <wsp:Policy wsu:Id="PruebaWSPortBindingPolicy">
        <wsp:ExactlyOne>
            <wsp:All>
                <sc:KeyStore wspp:visibility="private" alias="xws-security-client" keypass="chnageit" storepass="changeit" type="JKS" location="C:\Software\glassfish\domains\domain1\config\keystore.jks"/>
                <sc:TrustStore wspp:visibility="private" storepass="changeit" type="JKS" location="C:\Software\glassfish\domains\domain1\config\cacerts.jks" peeralias="wssip"/>
                <tc:PreconfiguredSTS wspp:visibility="private" wstVersion="http://docs.oasis-open.org/ws-sx/ws-trust/200512" wsdlLocation="http://localhost:8080/PruebaSTS/PruebaSTSService?wsdl" endpoint="http://localhost:8080/PruebaSTS/PruebaSTSService" serviceName="PruebaSTSService" portName="IPruebaSTSService_Port" namespace="http://tempuri.org/" metadata="http://localhost:8080/PruebaSTS/PruebaSTSService/mex"/>
                <sc:CallbackHandlerConfiguration wspp:visibility="private">
                    <sc:CallbackHandler name="usernameHandler" classname="prueba.UsernameCallbackHandler"/>
                    <sc:CallbackHandler name="passwordHandler" classname="prueba.UsernameCallbackHandler"/>
                </sc:CallbackHandlerConfiguration>
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>
</definitions>


I have configured it using netbeans 6.7.1. I have created a callback handler class to get the user and password, but this callback hander is never called.

I am running it at glassfish 2.1 with metro 1.5 installed.

Why the callbacks are not called? If I use the user and default password happens the same:

[#|2009-09-07T17:54:15.043+0200|SEVERE|sun-appserver2.1|javax.enterprise.system.core.security|_ThreadID=19;_ThreadName=httpSSLWorkerThread-8080-1;_RequestID=2f0d8f79-3cf8-4fc2-a99a-fe9afeb14e78;|SEC2004: Container-auth: wss: Error securing request
javax.xml.ws.WebServiceException: WSITPVD0029: Error in Securing Outbound Message.
        at com.sun.xml.wss.provider.wsit.WSITClientAuthContext.secureOutboundMessage(WSITClientAuthContext.java:493)
        at com.sun.xml.wss.provider.wsit.WSITClientAuthContext.secureRequest(WSITClientAuthContext.java:315)
        at com.sun.xml.wss.provider.wsit.WSITClientAuthContext.secureRequest(WSITClientAuthContext.java:265)
        at com.sun.enterprise.webservice.ClientSecurityPipe.process(ClientSecurityPipe.java:160)
        at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
        at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
        at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
        at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
        at com.sun.xml.ws.client.Stub.process(Stub.java:222)
        at com.sun.xml.ws.client.dispatch.DispatchImpl.doInvoke(DispatchImpl.java:180)
        at com.sun.xml.ws.client.dispatch.DispatchImpl.invoke(DispatchImpl.java:206)
        at com.sun.xml.ws.security.trust.impl.TrustPluginImpl.invokeRST(TrustPluginImpl.java:572)
        at com.sun.xml.ws.security.trust.impl.TrustPluginImpl.process(TrustPluginImpl.java:166)
        at com.sun.xml.ws.security.trust.impl.client.STSIssuedTokenProviderImpl.issue(STSIssuedTokenProviderImpl.java:53)
        at com.sun.xml.ws.api.security.trust.client.IssuedTokenManager.getIssuedToken(IssuedTokenManager.java:79)
        at com.sun.xml.wss.provider.wsit.WSITClientAuthContext.invokeTrustPlugin(WSITClientAuthContext.java:775)
        at com.sun.xml.wss.provider.wsit.WSITClientAuthContext.secureRequest(WSITClientAuthContext.java:286)
        at com.sun.xml.wss.provider.wsit.WSITClientAuthContext.secureRequest(WSITClientAuthContext.java:265)
        at com.sun.enterprise.webservice.ClientSecurityPipe.process(ClientSecurityPipe.java:160)
        at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)
        at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
        at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
        at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
        at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
        at com.sun.xml.ws.client.Stub.process(Stub.java:222)
        at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:135)
        at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)
        at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
        at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)
        at $Proxy81.saludar(Unknown Source)
        at prueba.servlet1.processRequest(servlet1.java:53)
        at prueba.servlet1.doGet(servlet1.java:77)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:315)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:666)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:597)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:871)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
[b]Caused by: javax.xml.ws.soap.SOAPFaultException: Username has not been set[/b]
        at com.sun.xml.wss.provider.wsit.WSITAuthContextBase.getSOAPFaultException(WSITAuthContextBase.java:1546)
        ... 63 more

Regards!!
Ranob
[Message sent by forum member 'agranob' (agranob_at_gmail.com)]

http://forums.java.net/jive/thread.jspa?messageID=363156