Exemplo n.º 1
0
    private static string SoapMessageBuilder(SoapMessages message, SoapParameters param)
    {
        string retVal = "";

        switch (message)
        {
        case SoapMessages.AuthenticationToken:

            retVal  = "<?xml version=\"1.0\" encoding=\"utf-8\" ?> ";
            retVal += "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\>";
            retVal += " <soap:Header> ";
            retVal += "<context xmlns=\"urn:zimbra\"> ";
            retVal += "<format type=\"xml\"/> ";
            retVal += "</context> ";
            retVal += "</soap:Header> ";
            retVal += "<soap:Body> ";
            retVal += "<AuthRequest xmlns=\"urn:zimbraAdmin\"> ";
            retVal += "<account by=\"name\">cuenta@</account> ";
            retVal += "<password>Clave segura</password> ";
            retVal += "</AuthRequest> ";
            retVal += "</soap:Body> ";
            retVal += "</soap:Envelope>";
            break;
            return(retVal);
        }
    }
Exemplo n.º 2
0
 private static void LogSoapMessages(SoapMessages soapMessages)
 {
     if (Log.IsEnabled(LogEventLevel.Verbose))
     {
         Log.Verbose("SOAP request: {soapRequest}", soapMessages.SoapRequest);
         Log.Verbose("SOAP response: {soapResponse}", soapMessages.SoapResponse);
         Log.Verbose("SOAP signature status {signatureStatus}", soapMessages.SoapResponseSignatureStatus.ToString());
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Specify the endpoint on which the signing and inspector behavior is to be applied.
        /// </summary>
        /// <param name="endpoint">The service endpoint to process.</param>
        /// <param name="messageID">A UniqueId instance which specifies the ID of the request message.</param>
        /// <param name="signingCertificate">The X509Certificate2 instance which will be used to sign the request message.</param>
        /// <param name="soapMessages">A SoapMessages instance which will contain the soap request and response messages on the endpoint.</param>
        public static void ProcessEndpoint(
            ServiceEndpoint endpoint,
            X509Certificate2 signingCertificate,
            SoapMessages soapMessages)
        {
            // Add a behavior to remove reply-to and set the message id, to, from ws-address details
            InspectorBehavior newBehavior = new InspectorBehavior(soapMessages, signingCertificate);

            // Add the behavior
            endpoint.Behaviors.Add(newBehavior);
        }
Exemplo n.º 4
0
    private static XmlDocument GetResponseDoc(SoapParameters param, SoapMessages message)
    {
        string      soapMessage = SoapMessageBuilder(message, param);
        XmlDocument requestDoc  = new XmlDocument();

        requestDoc.LoadXml(soapMessage);
        HttpWebRequest request = HttpWebRequestBuilder(param.serviceAdminSoapUri);
        Stream         stm     = request.GetRequestStream();

        requestDoc.Save(stm);
        stm.Close();
        WebResponse resp = request.GetResponse(); // here occurs error ---// Unable to //establish a relationship of trust secure channel for SSL / TLS, .

        stm = resp.GetResponseStream();
        StreamReader r           = new StreamReader(stm);
        XmlDocument  responseDoc = new XmlDocument();

        responseDoc.LoadXml(r.ReadToEnd());
        return(responseDoc);
    }
Exemplo n.º 5
0
 public MessageInspector(SoapMessages soapMessages, X509Certificate2 signingCertificate)
 {
     this.soapMessages       = soapMessages;
     this.signingCertificate = signingCertificate;
 }
Exemplo n.º 6
0
 public MessageInspector(SoapMessages soapMessages)
 {
     this.soapMessages = soapMessages;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Specifies the endpoint to be inspected.
        /// </summary>
        /// <param name="endpoint">The service endpoint on which soap messages is to be inspected.</param>
        /// <param name="soapMessages">A SoapMessages instance which will contain the soap request and response messages on the endpoint.</param>
        public static void InspectEndpoint(ServiceEndpoint endpoint, SoapMessages soapMessages)
        {
            InspectorBehavior newBehavior = new InspectorBehavior(soapMessages);

            endpoint.Behaviors.Add(newBehavior);
        }
Exemplo n.º 8
0
 public InspectorBehavior(SoapMessages soapMessages)
 {
     this.soapMessages = soapMessages;
 }