> Ok - thanks - that worked like a charm..
>
[quoted text clipped - 3 lines]
> {
> if ( envelope.Header.ChildNodes[i].NamespaceURI ==
OK, this one has me. I cannot seem to locate it using xpath. Would you
have a sample of how to do it?
Would you also have a sample of how to change a namespace within an xml
element?
w.r.t. the comments about baltimore - unfortunately the webservice provider
(the irish tax authorities) have said they have no plans to u/g their
webservices - they are sticking with what is published at present - so we
are stuck with them...
Thanks,
> What do you mean with wsu stuff? You mean the timestamp header? Yes that's 1
> level down under the Security node. Better to use XPath (SelectSingleNode)
[quoted text clipped - 12 lines]
> > {
> > if ( envelope.Header.ChildNodes[i].NamespaceURI ==
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-
> > 1.0.xsd" )
> > {
[quoted text clipped - 13 lines]
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
> > ty-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
> > y-utility-1.0.xsd">
> >
[quoted text clipped - 8 lines]
> to
> > be changed...
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
> > y-utility-1.0.xsd">
> >
[quoted text clipped - 80 lines]
> > > > > >
> > > > > > 1. The wsse namespace is now:
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
> > > > > > ty-secext-1.0.xsd"
> > > > > >
[quoted text clipped - 9 lines]
> > > > > >
> > > > > > 3. In wse1 I did the following:
outputFilters.Remove(typeof(Microsoft.Web.Services2.Routing.RoutingOutputFil
> > > > > > ter));
outputFilters.Remove(typeof(Microsoft.Web.Services2.Timestamp.TimestampOutpu
> > > > > > tFilter));
> > > > > >
[quoted text clipped - 35 lines]
> > > > > > > SoapEnvelope env = new SoapEnvelope();
> > > > > > > env.Body.InnerXml = "<StockQuoteRequest
xmlns=\"http://stockservice.contoso.com/wse/samples/2003/06\"><symbols><Symb
ol>FABRIKAM</Symbol><Symbol>CONTOSO</Symbol></symbols></StockQuoteRequest>";
> > > > > > > // sign
> > > > > > > X509SecurityToken token = GetEncryptionToken();
[quoted text clipped - 21 lines]
> > > > > > > // Send response
> > > > > > > SoapEnvelope response =
mySoapClient.GenericRequestResponse("http://stockservice.contoso.com/wse/sam
> > > > > > > ples/2003/06/StockQuoteRequest",env);
> > > > > > >
[quoted text clipped - 87 lines]
> > > > > > > > > > >
> > > > > > > > > > > The namespace changed for wsu to
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1
> > > > > > > > .0.xsd
> > > > > > > > > > > (not for the CanonicalizationMethod).
[quoted text clipped - 140 lines]
> > > > > > > > > > in
> > > > > > > > > > > > > > message
news:uKXJadZZEHA.2840@TK2MSFTNGP11.phx.gbl...
> > > > > > > > > > > > > > > > > wse 1.01, vs.net 2003 c#
> > > > > > > > > > > > > > > > >
[quoted text clipped - 62 lines]
> > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > Stewart Bourke
Lucien - 06 Aug 2004 18:58 GMT
Something like this (to verify as I didn't test this but there's doc on MSN
and VS help for SelectSingleNode/XPath):
XmlNamespaceManager nsm = new
XmlNamespaceManager(requestContext.Envelope.NameTable);
// add your prefixes here for your xpath expression
nsm.AddNamespace("wsse", WSSecurity.NamespaceURI);
nsm.AddNamespace("wsu", WSUtility.NamespaceURI);
node = envelope.Header.SelectSingleNode("//wsse:Security/wsu:Timestamp",
nsm);
Although I actually think you probably need to select just the Security
header and then loop through the children. So you might want to remove the
wsu:Timestamp from the expression depending how you will delete the node.
Another example and not so recommended way since it ignores namespace:
node =
envelope.SelectSingleNode("//*[local-name()='Envelope']/*[local-name()='Head
er']/*[local-name()='Security']");
There are also tools on the web for XPath evaluation to test this first.
> OK, this one has me. I cannot seem to locate it using xpath. Would you
> have a sample of how to do it?
[quoted text clipped - 27 lines]
> > > {
> > > if ( envelope.Header.ChildNodes[i].NamespaceURI ==
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-
> > > 1.0.xsd" )
> > > {
[quoted text clipped - 14 lines]
> > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > > xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
> > > ty-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
> > > y-utility-1.0.xsd">
> > >
[quoted text clipped - 8 lines]
> > to
> > > be changed...
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
> > > y-utility-1.0.xsd">
> > >
[quoted text clipped - 87 lines]
> > > > > > >
> > > > > > > 1. The wsse namespace is now:
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
> > > > > > > ty-secext-1.0.xsd"
> > > > > > >
[quoted text clipped - 9 lines]
> > > > > > >
> > > > > > > 3. In wse1 I did the following:
outputFilters.Remove(typeof(Microsoft.Web.Services2.Routing.RoutingOutputFil
> > > > > > > ter));
outputFilters.Remove(typeof(Microsoft.Web.Services2.Timestamp.TimestampOutpu
> > > > > > > tFilter));
> > > > > > >
[quoted text clipped - 38 lines]
> > > > > > > > SoapEnvelope env = new SoapEnvelope();
> > > > > > > > env.Body.InnerXml = "<StockQuoteRequest
xmlns=\"http://stockservice.contoso.com/wse/samples/2003/06\"><symbols><Symb
ol>FABRIKAM</Symbol><Symbol>CONTOSO</Symbol></symbols></StockQuoteRequest>";
> > > > > > > > // sign
> > > > > > > > X509SecurityToken token = GetEncryptionToken();
[quoted text clipped - 14 lines]
> > > > > > > > // add second Id for WSE with same value
> > > > > > > > XmlAttribute attr2 =
env.Body.OwnerDocument.CreateAttribute(WSUtility.Prefix,"Id",
> > > > > > > > WSUtility.NamespaceURI);
> > > > > > > > attr2.Value = "myIdValue";
> > > > > > > > env.Body.Attributes.Append(attr2);
> > > > > > > >
> > > > > > > > // Send response
> > > > > > > > SoapEnvelope response =
mySoapClient.GenericRequestResponse("http://stockservice.contoso.com/wse/sam
> > > > > > > > ples/2003/06/StockQuoteRequest",env);
> > > > > > > >
[quoted text clipped - 94 lines]
> > > > > > > > > > > >
> > > > > > > > > > > > The namespace changed for wsu to
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1
> > > > > > > > > .0.xsd
> > > > > > > > > > > > (not for the CanonicalizationMethod).
[quoted text clipped - 70 lines]
> > > > > > > > > > > > > > serviceProxy.OrderTimeHeaderValue = header;
> > > > > > > > > > > > > > SignatureReference soapRef = new
SignatureReference("#Id:05d2518d-d6db-481f-846d-2e8872b6e56d");
> > > > > > > > > > > > > > soapRef.AddTransform(new
> > > XmlDsigExcC14NTransform());
[quoted text clipped - 58 lines]
> > > > > > > > > > in
> > > > > > > > > > > > > > message
news:ueNAc9CaEHA.3596@tk2msftngp13.phx.gbl...
> > > > > > > > > > > > > > > > > I take it that this is not possible with
> > wse...
[quoted text clipped - 47 lines]
> > > > > > > > > > > > > > > > > >
> > > > > > > > xmlns:d3p1="http://schemas.xmlsoap.org/ws/2002/07/utility"
xmlns="http://www.ros.ie/schemas/service/">Inbox/List</Operation>
> > > > > > > > > > > > > > > > > > </soap:Header>
> > > > > > > > > > > > > > > > > > <soap:Body wsu:Id="MsgBody"
[quoted text clipped - 9 lines]
> > > > > > > > > > > > > > > > > > <soap:Header>
> > > > > > > > > > > > > > > > > > <Operation Id="MsgOperation"
xmlns="http://www.ros.ie/schemas/service/">Inbox/List</Operation>"
> > > > > > > > > > > > > > > > > > </soap:Header>
> > > > > > > > > > > > > > > > > > <soap:Body Id="MsgBody" >
[quoted text clipped - 6 lines]
> > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > Stewart Bourke