AnsweredAssumed Answered

Problems with timestamp in JAX-WS client

Question asked by gressho on Sep 4, 2008
Hi,

I'm trying to develop a webservice client with JAX-WS and implemented a Handler to add the WS-Security header. This works perfectly when I change the
WS-Security configuration to not need a timestamp. If I don't do this (and the timestamp is generated and valid and added as I can see in my client and server
protocols) WSS4J produces an StringIndexOutOfBoundsException:

10:12:33,566 User:admin DEBUG [axis.security.WSDoAllReceiver] Received SOAP request:
10:12:33,571 User:admin DEBUG [axis.security.WSDoAllReceiver] <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header>
  <wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
   <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsu:Created>
2008-08-29T10:12:33.164+02:00    </wsu:Created>
    <wsu:Expired>
2008-08-29T10:12:33.164+02:00    </wsu:Expired>
   </wsu:Timestamp>
   <wsse:UsernameToken>
    <wsse:Username>
admin    </wsse:Username>
    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">
TICKET_14448e7887355aca67e7afa0d1ca062a42f37ac3    </wsse:Password>
   </wsse:UsernameToken>
  </wsse:Security>
</S:Header>
<S:Body>
  <queryUsers xmlns="http://www.alfresco.org/ws/service/administration/1.0" xmlns:ns2="http://www.alfresco.org/ws/model/content/1.0">
   <filter/>
  </queryUsers>
</S:Body>
</S:Envelope>

10:12:33,571 User:admin DEBUG [ws.security.WSSecurityEngine] enter processSecurityHeader()
10:12:33,581 User:admin DEBUG [ws.security.WSSecurityEngine] Processing WS-Security header for '' actor.
10:12:33,582 User:admin DEBUG [ws.security.WSSecurityEngine] Found Timestamp list element
10:12:33,595 User:admin DEBUG [axis.i18n.ProjectResourceBundle] org.apache.axis.i18n.resource::handleGetObject(addBody00)
10:12:33,596 User:admin DEBUG [axis.message.SOAPBody] Adding body element to message…
10:12:33,596 User:admin DEBUG [apache.axis.SOAPPart] Enter: SOAPPart ctor(FORM_SOAPENVELOPE)
10:12:33,596 User:admin DEBUG [axis.i18n.ProjectResourceBundle] org.apache.axis.i18n.resource::handleGetObject(setMsgForm)
10:12:33,596 User:admin DEBUG [apache.axis.SOAPPart] Setting current message form to: FORM_SOAPENVELOPE (currentMessage is now org.apache.axis.message.SOAPEnvelope)
10:12:33,596 User:admin DEBUG [apache.axis.SOAPPart] Exit: SOAPPart ctor()
10:12:33,600 User:admin DEBUG [axis.i18n.ProjectResourceBundle] org.apache.axis.i18n.resource::handleGetObject(axisFault00)
10:12:33,600 User:admin DEBUG [apache.axis.EXCEPTIONS] AxisFault:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
faultActor:
faultNode:
faultDetail:
   {http://xml.apache.org/axis/}stackTrace:java.lang.StringIndexOutOfBoundsException: String index out of range: 0
   at java.lang.String.charAt(String.java:687)
   at org.apache.ws.security.util.XmlSchemaDateFormat.parse(XmlSchemaDateFormat.java:79)
   at java.text.DateFormat.parse(DateFormat.java:335)
        …

I imagine there is a formatting problem with my JAX-WS engine?
Has somebody allready tried a JAX-WS client and got rid of this problem?

Thanks and best regards

Werner

Outcomes