2013-02-19 2 views
0

위해 나는 닷넷 웹 서비스보안 헤더 오류가 ksoap2

SOAPFault에 연결하는 동안 다음과 같은 오류가 무엇입니까 - faultCode를을 'Q0 : 보안'으로, faultString을 '보안 요구 사항이 있기 때문에 만족하지 보안 헤더가 수신 메시지에 이 아닙니다. ' 여기

내가 위의 코드를 기반으로 ksoap2에 대한 보안 헤더를 만드는 방법을

 public override XmlElement GetXml(XmlDocument document) { 
     if (null == document) throw new ArgumentException("document"); 

     XmlElement root = document.CreateElement("abc", "TokenName", "http://testurl.com"); 

     if (!string.IsNullOrEmpty(Id)) { 
      root.SetAttribute(WSUtility.Prefix, WSUtility.NamespaceURI); 
      root.SetAttribute(WSUtility.AttributeNames.Id, WSUtility.NamespaceURI, Id); 
     } 

     XmlElement machineIdElement = document.CreateElement("abc", "machineId", "http://testurl.com"); 

     machineIdElement.InnerText = "060a5270-7ae7-11e2-b92a-0800200c9a66"; 

     root.AppendChild(machineIdElement); 

     XmlElement inspectorIdElement = document.CreateElement("dac", "insId", "http://testurl.com"); 

     inspectorIdElement.InnerText = "dc0a5270-7ae7-11e2-b92a-0800200c9a66"; 

     root.AppendChild(inspectorIdElement); 

     return root; 
    } 

은 어떤 하나 말해 줄 수있는 보안 헤더를 만들어 서버 측의 코드입니다. ..... 이것 봐 스티브에게 사전 에 도움을

답변

0

감사합니다 감사합니다

// create header 
     Element[] header = new Element[1]; 
     header[0] = new Element().createElement("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","Security"); 
     header[0].setAttribute(null, "mustUnderstand","1"); 

     Element usernametoken = new Element().createElement("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "UsernameToken"); 
     usernametoken.setAttribute(null, "Id", "UsernameToken-1"); 
     header[0].addChild(Node.ELEMENT,usernametoken); 

     Element username = new Element().createElement(null, "n0:Username"); 
     username.addChild(Node.IGNORABLE_WHITESPACE,"AJAY"); 
     usernametoken.addChild(Node.ELEMENT,username); 

     Element pass = new Element().createElement(null,"n0:Password"); 
     pass.setAttribute(null, "Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"); 
     pass.addChild(Node.TEXT, "hello"); 
     usernametoken.addChild(Node.ELEMENT, pass);