473,657 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RE: Removing Timestamp from a SOAP message with WSE 3.0

I had this exact problem using a vb.net client accessing a Java web service.
The solution takes 3 steps:

1.) Create custom ClientOutputFil ter
2.) Create a custom Assertion that uses filter from step 1
3.) Bind service to custom Assertion

Step 1
Custom Filter(Called by Custom Assertion)
Class ClientOutputFil ter
Inherits SendSecurityFil ter
Private parentAssertion As UsernameClientA ssertion
Private filterContext As FilterCreationC ontext

Public Sub New(ByVal parentAssertion As UsernameClientA ssertion, ByVal
filterContext As FilterCreationC ontext)
MyBase.New(pare ntAssertion.Ser viceActor, False,
parentAssertion .ClientActor)
Me.parentAssert ion = parentAssertion
Me.filterContex t = filterContext
End Sub
Public Overrides Function ProcessMessage( ByVal envelope As
Microsoft.Web.S ervices3.SoapEn velope) As
Microsoft.Web.S ervices3.SoapFi lterResult
Dim securityElement As XmlElement = envelope.Create Element("wsse",
"Security", "http://schemas.xmlsoap .org/ws/2002/07/secext")
Dim mustUnderstandA ttribute As XmlAttribute =
envelope.Create Attribute(envel ope.DocumentEle ment.Prefix, "mustUnderstand ",
envelope.Docume ntElement.Names paceURI)
Dim userToken As New UsernameToken(p arentAssertion. username,
parentAssertion .password, PasswordOption. SendPlainText)

mustUnderstandA ttribute.Value = "true"
securityElement .AppendChild(us erToken.GetXml( envelope))
envelope.Create Header.AppendCh ild(securityEle ment)
Return SoapFilterResul t.Continue
End Function
End Class

Step 2 Custom Assertion
Public Class UsernameClientA ssertion
Inherits SecurityPolicyA ssertion
Public username As String
Public password As String

Public Sub New(ByVal username As String, ByVal password As String)
Me.username = username
Me.password = password
End Sub

Public Overloads Overrides Function CreateClientOut putFilter(ByVal context
As FilterCreationC ontext) As SoapFilter
Return New ClientOutputFil ter(Me, context)
End Function

Public Overrides Function CreateClientInp utFilter(ByVal context As
FilterCreationC ontext) As SoapFilter
' we don't provide ClientInputFilt er
Return Nothing
End Function

Public Overrides Function CreateServiceIn putFilter(ByVal context As
FilterCreationC ontext) As SoapFilter
' we don't provide any processing for web service side
Return Nothing
End Function

Public Overrides Function CreateServiceOu tputFilter(ByVa l context As
FilterCreationC ontext) As SoapFilter
' we don't provide any processing for web service side
Return Nothing
End Function
End Class

Step 3: Bind proxy to custom assertion

Private WS As New Service.Service nameWSE
Private token As UsernameToken = New UsernameToken(U SERNAME, PASSWORD,
PasswordOption. SendPlainText)
ProvideUsername Token.Assertion s.Add(New UsernameClientA ssertion(USERNA ME,
PASSWORD))
WS.SetClientCre dential(token)
WS.SetPolicy(Pr ovideUsernameTo ken)

Good luck, if anyone has a better way to do this I'm all ears

- Ed

"Sònia" wrote:
Hi,
I'm developping an WSE client application that calls a webservice with
WS-Security.
I'm sending a SOAP message like

************
<soap:Envelop e xmlns:soap="htt p://schemas.xmlsoap .org/soap/envelope/"
xmlns:soapenc=" http://schemas.xmlsoap .org/soap/encoding/"
xmlns:tns="http ://www.meteocatser veis.com/axis/services/ConsultaEstacio ns"
xmlns:types="ht tp://www.meteocatser veis.com/axis/services/ConsultaEstacio ns/encodedTypes"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:wsa="http ://schemas.xmlsoap .org/ws/2004/08/addressing"
xmlns:wsse="htt p://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http ://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soap:Header>
<wsa:Action>
</wsa:Action>

<wsa:MessageID> urn:uuid:65f4b3 95-f208-4286-9656-6239f096e26c</wsa:MessageID>
<wsa:ReplyTo>

<wsa:Address>ht tp://schemas.xmlsoap .org/ws/2004/08/addressing/role/anonymous</wsa:Address>
</wsa:ReplyTo>

<wsa:To>http://www.meteocatser veis.com/axis/services/ConsultaEstacio ns</wsa:To>
<wsse:Securit y>
<wsu:Timestam p
wsu:Id="Timesta mp-36736541-67a9-44fb-9779-9a422bc94c50">
<wsu:Created>20 08-03-13T16:07:12Z</wsu:Created>
<wsu:Expires>20 08-03-13T16:12:12Z</wsu:Expires>
</wsu:Timestamp>
<wsse:UsernameT oken
xmlns:wsu="http ://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Securit yToken-364b2ace-9b69-41cf-be74-a814910008fe">
<wsse:Username> tvc</wsse:Username>
<wsse:Passwor d
Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDig est">cTPEB2dduq v9xOiuhOAAoKVfV tI=</wsse:Password>
<wsse:Nonce>cWk O9B6G3wY/AND1BRSUAg==</wsse:Nonce>
<wsu:Created>20 08-03-13T16:07:12Z</wsu:Created>
</wsse:UsernameTo ken>
</wsse:Security>
</soap:Header>
<soap:Body
soap:encodingSt yle="http://schemas.xmlsoap .org/soap/encoding/">
<q1:dades_ultim es xmlns:q1="http://consultaEstacio ns" />
</soap:Body>
</soap:Envelope>

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

But the webservice receiving that message don't undersand the "Timestamp" tag.
How can I remove it?
Jun 27 '08 #1
0 2439

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3323
by: Cantor | last post by:
Hello everyone :) I am writing some dotNET code to "consume" a web service written in PHP. So far I have been getting some error messages and PHP seems to place HTML text in front of the XML message. dotNET doesn't expect the XML and then it chokes. This is what I get. The <br> tag from namespace is not expected. Line 1, position 2. I was able to capture the data going through the network and I've got
3
4717
by: kevin | last post by:
Is that even possible? I am creating a web service in .NET to expose some already created .NET programs to other groups. One group is writing the client in PERL, and thus wishes the wsdl schema to not be sequenced. (PERL hashes do not retain order information) First, the w3 specs don't mention the sequence in any detail - its just there in the examples, which makes me wonder if removing the sequence tag is even supportable. Second,...
31
2827
by: Bryan Dickerson | last post by:
Ok, simple question: from a VB.Net web service (as I've said before, I'm a newbie to SOAP), how would I get the SOAP body into a string? My boss and I concur that it, at least from our perspective, should be as simple as defining an object and viewing a parameter on that object. My boss has worked with it and I'm still tryin'... TIA! -- TFWBWY...A
0
4829
by: Jigar.Patel | last post by:
I have simple remoting server exposing following simple method. When I try to add webreference to this server in another project, it gives me following error: Custom tool error: Unable to import WebService/Schema. Unable to import binding 'MyRemoteObjectBinding' from namespace 'http://schemas.microsoft.com/clr/nsassem/RemoteServer/RemoteServer%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull'. Unable to import...
7
6108
by: JJ | last post by:
How do I set one field to have the updated timestamp, and another to have the created timestamp? I want to do this directly from code generated from DB Designer if possible?! JJ
7
5873
by: beachdog | last post by:
I'm using Visual Studio 2005/C# to build a web client. The web server is something I've written in a different framework, which does not support generating wsdl, so I have hand-built a wsdl file, then created my proxy class by running wsdl.exe. The problem is that the SOAP message that the client generates contains an empty namespace for the parameters in my message, instead of the namespace I intended it to have. I am guessing it is...
0
2109
by: nappingcub | last post by:
This is my first time coding a web service in .NET and ran into a slight snag that I was hoping that anyone could help me out on. I'm using the generic Hello World web service that is stubbed out on a new web service project since it can convey what I would like to do in the smallest amount of code. I've figured out how to change the <HelloWorldResponse> to a different element name by using the SoapDocumentMethod parameters, but I can't find...
0
1838
by: walshieau | last post by:
I have an issue with Lotus Domino 7 not supporting SOAP 1.2 so i have to use 1.1 which i dont have an issue with. Now ive disabled 1.2 via the web.config file <webServices> <protocols> <remove name ="HttpSoap12"/> </protocols> </webServices> but the Soap1.2 definition is still in the namespace and the Domino Server is picking it up and crapping out. see below
0
2692
by: Philluminati | last post by:
I have a Perl SOAP Server which returns this SOAP Message when invoked: <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http:// www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http:// schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/ XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/...
0
8316
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8509
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8610
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6174
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2735
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.