WCF를 사용하여 WSE 보안 웹 서비스를 시도하고 있습니다. 이 작업을 수행하기 위해 생성해야하는 SOAP 헤더에는 사용자 이름, 비밀번호, 넌스 및 생성 날짜가 포함되어야합니다 ... 여기에 동일한 서비스를 사용하는 비누 UI 헤더의 예가 있습니다 ...실수로 SOAP Body 내부에 WCF 클라이언트와 함께 WSE 서비스에 액세스하려고 시도하는 SOAP Body를 고집했습니다.
<soap:Header>
<wsse:Security soap:mustUnderstand="true" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-2" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>----------</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">----------</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">Hozef94FFwOhuiF5QixaMQ==</wsse:Nonce>
<wsu:Created>2012-08-21T13:26:03.642Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soap:Header>
이제는 매우 유용한 튜토리얼을 발견했습니다. usefull tutorial
나는 그것을 성공적으로 구현했다 ...하지만 SOAP 몸체를 비누 헤더에 집어 넣고 있으며, 생성 된 nonce는 없다.
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Header>
<VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">uIDPo9VZylDHg5JMgjsNnWLhATkAAAAA+YtOxHdh0Uqd4a64raX/nIzYz20mPHlBv4Wk5S8d5PsACQAA</VsDebuggerCausalityData>
<wsse:Security s:mustUnderstand="0" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<UsernameToken xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<Username>------------</Username>
<Password>************</Password>
</UsernameToken>
</wsse:Security>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetOrganizations xmlns="http://------------------------/businessobjects/messaging/">
<personId xmlns="">0</personId>
<typeId xmlns="">
<int>1</int>
<int>2</int>
<int>3</int>
<int>4</int>
</typeId>
</GetOrganizations>
</s:Body>
</s:Header>
</s:Envelope>
이유를 모릅니다. 나는 그 편지에 대한 지침서를 따라 갔다. 내 저장소 받고 모든 것을 ...
using (DistListServiceReference.DistributionListClient dlc = new DistListServiceReference.DistributionListClient())
{
try
{
PasswordDigestBehavior behavior = new PasswordDigestBehavior("********", "********");
dlc.Endpoint.Behaviors.Add(behavior);
GetDistributionLists gdl = new GetDistributionLists();
gdl.PersonID = 0;
GetDistributionListsResponse gdlr = new GetDistributionListsResponse();
gdlr = dlc.GetDistributionLists(gdl);
return gdlr;
}
catch (Exception e)
{
dlc.Abort();
return null;
}
}
내 PasswordDigentInspector 내가
public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
{
clientRuntime.MessageInspectors.Add(new PasswordDigestMessageInspector(this.Username, this.Password));
}
모든 꽤 많이있다 클라이언트 동작을 적용하는 방법
public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
{
// Use the WSE 3.0 security token class
UsernameToken token = new UsernameToken(this.Username, this.Password, PasswordOption.SendPlainText);
WseHeader header = new WseHeader(this.Username, this.Password);
// Serialize the token to XML
XmlElement securityToken = token.GetXml(new XmlDocument());
MessageHeader securityHeader = MessageHeader.CreateHeader("Security", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken", securityToken, false);
request.Headers.Add(header);
// complete
return Convert.DBNull;
}
. 나는 시체가 헤더에 주입되는 곳을 보지 않을 것이다. 어떤 시체라도 아이디어가 있습니까?
UPDATE : 디버깅 나는 비누 메시지로 주입이 내가 무엇을보고있는 실제 헤더를 찾고 있어요 ...
{<wsse:Security s:mustUnderstand="0" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<UsernameToken xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<Username>**********</Username>
<Password>************</Password>
</UsernameToken>} System.ServiceModel.Channels.MessageHeaderInfo {TestDistListApplication.Repository.WseHeader}
그냥보고, 더 비표가 없다
, 프로그래밍 방식으로 빌드 할 수 있지만 좋은 생각인지 확실하지 않습니다. 거기 넌스 이미 그들이 비록 헤더에 표시되지 않는 이유
<wsse:Username xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">MedTrak_Dev</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">uncJUN132012</wsse:Password>
<wsse:Nonce xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">mvy9nUfF+rnT3oTasDBqxg==</wsse:Nonce>
<wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2012-08-28T13:30:42Z</wsu:Created>
... 확실하지 ... securityToken 날짜를 만들 특히 이후 디버거를 중지하고 난 두 사람을 지켜보고 있어요 변수. 헤더는 그러한 것들을 가지지 않을 수 있으며 WSEHeader는 헤더를 가질 수 있습니까? 그걸 디버깅해야 할 것 같습니다.
사실 이제는 (XML 내부의 XML을 보았습니다.) 넌스와 생성 된 날짜를 봅니다. 왜 내 몸이 헤더에 주입되는지 궁금합니다. – SoftwareSavant
또한 헤더가 다르다는 것에 대해, 내가 왜 생각을 바꾸 었는지 모르겠습니다. 나는 내가 추측하는 다른 것들을 경험하고 있었다. – SoftwareSavant
나는이 일을하는 이유를 알지 못한다 ... 나는 네가 나에게 말하는 곳에서 멈추지 만, 그곳에는 시체를 헤더에 주입하는 곳이 보이지 않는다. 나는 뭔가를 놓쳐 야한다. – SoftwareSavant