I've got a WCF client connecting to an STS server, which I don't have any control over (it's a 3rd party PHP service).
After days of research I managed to talk to the server in a way it accepts using purely WCF. Of course, it would have been easy to just put some characters onto the network, ignoring all the SOAP stuff. But in the end I managed to guess every configuration parameter right, so the STS service answers my request like this
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<RequestSecurityTokenResponse xmlns="http://schemas.xmlsoap.org/ws/2005/02/trust">
<TokenType>http://schemas.xmlsoap.org/ws/2005/02/sc/sct</TokenType>
<RequestedSecurityToken>
<SecurityContextToken xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<Identifier>bipro:D5J9M0...</Identifier>
</SecurityContextToken>
</RequestedSecurityToken>
</RequestSecurityTokenResponse>
</Body>
</Envelope>
But now I have trouble to extract the identifier value. For my proxy class (SecurityTokenServicePortTypeClient : ClientBase<SecurityTokenServicePortType>, SecurityTokenServicePortType
) I tried every imaginable combination of ServiceContract
, DataContract
and XmlSerialization
on all the types. But all I get is null
.
The (heavily modified) interface for the service contract looks like this
[ServiceContract(Namespace = "http://schemas.xmlsoap.org/ws/2005/02/trust")]
public interface SecurityTokenServicePortType {
[OperationContract(Action = "urn:RequestSecurityToken", ReplyAction = "*")]
object RequestSecurityToken();
}
The (heavily modified) implementing class has a method like this
object SecurityTokenServicePortType.RequestSecurityToken() {
var x = base.Channel.RequestSecurityToken();
return x;
}
x is always null
.
Instead of a return type of object
it was originally RequestSecurityTokenResponse
and so on.
I had the same problem with WSE years ago and I was able to solve that by just using the right combination of for example XmlElementAttribute
to control the deserialization process. But this time it doesn't seem to help.
Thanks for any advice!
Björn