Thanks for your respone Michael,
Yes, for RPC style message, the soap header's element namespace is an
autogenerated encoding namespace, which derived from the service's
namespace but do not utilize the XML Element's namespace... So those XML
Serizliation attribute can not control that.
Regards,
Steven Cheng
Microsoft Online Support

Signature
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Michael Peters - 10 Feb 2006 18:14 GMT
OK...here's a WSDL for a test webservice. It appears to be
Document/Literal. I also have the following line of code and it does not
appear to modify the WSDL. Can you tell me why?
[WebService(Namespace="http://Com.SouthernCompany.SecurityTest/webservices/")]
public class Service1 : System.Web.Services.WebService
{
[XmlElement(Namespace="https://ws.southernco.com/CoolSecurity")]
public Com.SouthernCompany.Cool.Security.ScCredentials
authenticationCredentials;
<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://Com.SouthernCompany.SecurityTest/webservices/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://Com.SouthernCompany.SecurityTest/webservices/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
+ <s:schema elementFormDefault="qualified"
targetNamespace="http://Com.SouthernCompany.SecurityTest/webservices/">
- <s:element name="HelloWorld">
<s:complexType />
</s:element>
- <s:element name="HelloWorldResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="ScCredentials" type="tns:ScCredentials" />
- <s:complexType name="ScCredentials">
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="DirectUserNameToken"
type="tns:ScUserNameToken" />
<s:element minOccurs="0" maxOccurs="1" name="OriginatingUserNameToken"
type="tns:ScUserNameToken" />
<s:element minOccurs="0" maxOccurs="1" name="Created" type="s:string" />
</s:sequence>
</s:complexType>
- <s:complexType name="ScUserNameToken">
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Type" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Nonce" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="BinarySecurityToken"
type="tns:ScBinarySecurityToken" />
</s:sequence>
</s:complexType>
- <s:complexType name="ScBinarySecurityToken">
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="ValueType" type="s:string" />
</s:sequence>
</s:complexType>
</s:schema>
</wsdl:types>
- <wsdl:message name="HelloWorldSoapIn">
<wsdl:part name="parameters" element="tns:HelloWorld" />
</wsdl:message>
- <wsdl:message name="HelloWorldSoapOut">
<wsdl:part name="parameters" element="tns:HelloWorldResponse" />
</wsdl:message>
- <wsdl:message name="HelloWorldScCredentials">
<wsdl:part name="ScCredentials" element="tns:ScCredentials" />
</wsdl:message>
- <wsdl:portType name="Service1Soap">
- <wsdl:operation name="HelloWorld">
<wsdl:input message="tns:HelloWorldSoapIn" />
<wsdl:output message="tns:HelloWorldSoapOut" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="Service1Soap" type="tns:Service1Soap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
- <wsdl:operation name="HelloWorld">
<soap:operation
soapAction="http://Com.SouthernCompany.SecurityTest/webservices/HelloWorld"
style="document" />
- <wsdl:input>
<soap:body use="literal" />
<soap:header message="tns:HelloWorldScCredentials" part="ScCredentials"
use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
<soap:header message="tns:HelloWorldScCredentials" part="ScCredentials"
use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="Service1">
- <wsdl:port name="Service1Soap" binding="tns:Service1Soap">
<soap:address
location="http://localhost/WebServiceSecurityTest2/Service1.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
> Thanks for your respone Michael,
>
[quoted text clipped - 11 lines]
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
Steven Cheng[MSFT] - 15 Feb 2006 09:33 GMT
Hi Michael,
Have you tried directly apply namespace on the custom SoapHeader class
itself. like:
[XmlRoot("MySoapHeader",Namespace="http://mytest.dotnet.org")]
public class MyHeader : SoapHeader
{
...................
It works on my side.
Hope this helps.
Regards,
Steven Cheng
Microsoft Online Support

Signature
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Michael Peters - 10 Feb 2006 18:37 GMT
I simply wish to override the namespace for the ScCredentials structure
Thank you,
MP
> Thanks for your respone Michael,
>
[quoted text clipped - 11 lines]
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
Michael Peters - 10 Feb 2006 18:59 GMT
And just incase you need it....here's the declaration for the method using
the SoapHeader..
[WebMethod]
[System.Web.Services.Protocols.SoapHeader("authenticationCredentials",
Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
public string HelloWorld( string test)