Board index » delphi » Namespace prefix problem

Namespace prefix problem


2005-10-20 10:30:07 AM
delphi182
I am currently making a webservice that among other functions will
return a SAML authentication segment in the header of the soap
response.
SAML is a standardized (oasis.org) way of sending authentication data
and naturally I'd like to conform to the standard. However I seem
unable to get Delphi 7 to generate the correct prefix for the header
segment. I have tried every combination of RegisterHeaderClass and
RegisterXSClass/RegisterXSInfo I can come up with and I still get the
NS1 prefix as can be seen below.
The correct header would look like this :
<S:Envelope xmlns:S="...">&
<wsse:Security xmlns:wsse="...">
<saml:Assertion
MajorVersion="1"
MinorVersion="0"
AssertionID="SecurityToken-ef375268"
Issuer="elliotw1"
IssueInstant="2002-07-23T11:32:05.6228146-07:00"
xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion">
...
</saml:Assertion>
</wsse:Security>
</S:Header>
For example will the following
initialization
InvRegistry.RegisterInterface(TypeInfo(ICriminalSDK),'www.cotere.com/');
InvRegistry.RegisterHeaderClass(TypeInfo(ICriminalSDK), Security);
RemClassRegistry.RegisterXSClass(Security,'schemas.xmlsoap.org/ws/2003/06/secext','Security','wsse');
Return this :
<?xml version="1.0"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="www.w3.org/2001/XMLSchema"
xmlns:xsi="www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header
SOAP-ENV:encodingStyle="schemas.xmlsoap.org/soap/encoding/"
xmlns:NS1="schemas.xmlsoap.org/ws/2003/06/secext"
xmlns:NS2="urn:wsse-CriminalSDKIntf">
<NS1:Security xsi:type="NS1:wsse" SOAP-ENV:mustUnderstand="1">
<NS2:Assertion xsi:type="NS2:AssertionClass">
<MajorVersion xsi:type="xsd:int">1</MajorVersion>
<MinorVersion xsi:type="xsd:int">0</MinorVersion>
<Issuer xsi:type="xsd:string"/>
<IssueInstant
xsi:type="xsd:dateTime">2005-10-19T14:17:51.972-07:00</IssueInstant>
<NS2:Conditions xsi:type="NS2:ConditionClass">
<NotBefore
xsi:type="xsd:dateTime">2005-10-19T14:17:51.972-07:00</NotBefore>
<NotAfter
xsi:type="xsd:dateTime">2005-10-19T14:17:51.972-07:00</NotAfter>
</NS2:Conditions>
<NS2:AuthenticationStatement
xsi:type="NS2:AuthenticationStatementClass">
<AuthenticationMethod
xsi:type="xsd:string">Password</AuthenticationMethod>
<AuthenticationInstant
xsi:type="xsd:dateTime">2005-10-19T14:17:51.972-07:00</AuthenticationInstant>
<NS2:Subject xsi:type="NS2:SubjectClass">
<NS2:NameIdentifier xsi:type="NS2:NameIdentifierClass">
<SecurityDomain
xsi:type="xsd:string">cotere.com</SecurityDomain>
<Name xsi:type="xsd:string">bob</Name>
</NS2:NameIdentifier>
</NS2:Subject>
</NS2:AuthenticationStatement>
</NS2:Assertion>
</NS1:Security>
</SOAP-ENV:Header>
<SOAP-ENV:Body
SOAP-ENC:encodingStyle="schemas.xmlsoap.org/soap/envelope/">
<NS3:AssertUserResponse xmlns:NS3="www.cotere.com/">
<return
xsi:type="xsd:string">schemas.xmlsoap.org/ws/2003/06/secext</return>
</NS3:AssertUserResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I noticed that InvokeRegistry.pas has a AppNameSpacePrefix variable
however that is only used if the namespace is not given in the function
call so it has no effect.
I hope someone out there knows if this can be done in Delphi 7 or if I
have to find an alternative language to make my webservice in
Thanks
Mogens
 
 

Re:Namespace prefix problem

As I didn't get any responses to my question I went ahead and created
a new webservice but this time in C#. It turned out to be much better
as it didn't add random prefixes. That said I ran into the same
problem in that I can not create the wsse prefix I need.
So I assume that prefixes are a forbidden land for the developer. I am
very surprised that ANY attribute or element in a soap message can't
be easily accessed at any time.
Mogens