Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8668675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:16:21+00:00 2026-06-12T18:16:21+00:00

I have a sample soap request and I want to modify the timestamp in

  • 0

I have a sample soap request and I want to modify the timestamp in the security header of the SOAP request received. Here is my sample SOAP request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:dat="http://schemas.datacontract.org/2004/07/DataContracts">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsu:Timestamp wsu:Id="Timestamp-78496158-6fa4-41da-8887-b8116829f1d8" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Created>2012-10-12T10:08:42Z</wsu:Created>
<wsu:Expires>2012-10-12T11:13:42Z</wsu:Expires>
</wsu:Timestamp>
<wsse:BinarySecurityToken wsu:Id="SecurityToken-db63adf4-d7c7-4827-8c36-56f672e6c397" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
xyz</wsse:BinarySecurityToken>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
xyz</Signature>
</wsse:Security>
</soapenv:Header>

I want to modify the contents of following elements using xslt

<wsu:Created>2012-10-12T10:08:42Z</wsu:Created>
<wsu:Expires>2012-10-12T11:13:42Z</wsu:Expires>

to

<wsu:Created>2012-10-12T10:08:42.000Z</wsu:Created>
<wsu:Expires>2012-10-12T11:13:42.000Z</wsu:Expires>

Can someone help please.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T18:16:23+00:00Added an answer on June 12, 2026 at 6:16 pm

    Here is a simple, concise XSLT 1.0 solution.

    When this XSLT:

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
      version="1.0">
      <xsl:output omit-xml-declaration="no" indent="yes" />
      <xsl:strip-space elements="*" />
    
      <xsl:template match="@*|node()">
        <xsl:copy>
          <xsl:apply-templates select="@*|node()" />
        </xsl:copy>
      </xsl:template>
    
      <xsl:template match="wsu:Created|wsu:Expires">
        <xsl:copy>
          <xsl:value-of select="concat(substring-before(., 'Z'), '.000Z')" />
        </xsl:copy>
      </xsl:template>
    
    </xsl:stylesheet>
    

    …is applied to the originally provided XML:

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:dat="http://schemas.datacontract.org/2004/07/DataContracts" xmlns:tem="http://tempuri.org/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Header>
        <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
          <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-78496158-6fa4-41da-8887-b8116829f1d8">
            <wsu:Created>2012-10-12T10:08:42Z</wsu:Created>
            <wsu:Expires>2012-10-12T11:13:42Z</wsu:Expires>
          </wsu:Timestamp>
          <wsse:BinarySecurityToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="SecurityToken-db63adf4-d7c7-4827-8c36-56f672e6c397" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3">xyz</wsse:BinarySecurityToken>
          <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">xyz</Signature>
        </wsse:Security>
      </soapenv:Header>
    </soapenv:Envelope>
    

    …the wanted result is produced:

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:dat="http://schemas.datacontract.org/2004/07/DataContracts" xmlns:tem="http://tempuri.org/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Header>
        <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
          <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-78496158-6fa4-41da-8887-b8116829f1d8">
            <wsu:Created>2012-10-12T10:08:42.000Z</wsu:Created>
            <wsu:Expires>2012-10-12T11:13:42.000Z</wsu:Expires>
          </wsu:Timestamp>
          <wsse:BinarySecurityToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="SecurityToken-db63adf4-d7c7-4827-8c36-56f672e6c397" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3">xyz</wsse:BinarySecurityToken>
          <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">xyz</Signature>
        </wsse:Security>
      </soapenv:Header>
    </soapenv:Envelope>
    

    Explanation:

    • Template #1 is the Identity Template. It’s purpose is to copy all nodes and attributes from the source template to the result template as-is.
    • Template #2 matches both <wsu:Created> and <wsu:Expires> elements. Upon finding these elements, the XSLT copies them to the result document and alters their values to be the desired values.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In sample soap XML request message, I noticed that there are soap envelope tag
I have a wsdl and xsd files and want to create SOAP request to
I have a RPC encoded PHP webservice that returns a simple soap envelope with
I have a sample project here on github where I created a c++ wrapper
My question is quite simple. I'm adding a header to a SOAP request that
I have been tasked with obtaining a response from a SOAP request, using classic
I have sample site: /index.html /appcache.manifest /style.css /test.js index.html: <!DOCTYPE HTML> <html manifest=appcache.manifest> <head>
Does anyone have sample code, or a tutorial which demonstrates how to use Grappa
I've started working on a little ruby project that will have sample implementations of
I have developed sample api as jar file. This jar file contains the code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.