What are certchanin, signature in SOAP request? How to add? RRS feed

All replies

  • Here is my code

    Imports System
    Imports System.Security.Cryptography
    Imports System.Security.Cryptography.X509Certificates
    Imports System.Security.Cryptography.Xml
    Imports System.Text
    Imports System.Xml
    Imports System.IO
    Imports System.Collections.Generic
    Imports Microsoft.Web.Services3
    Imports Microsoft.Web.Services3.Design
    Imports Microsoft.Web.Services3.Security
    Imports Microsoft.Web.Services3.Security.Tokens
    Imports Microsoft.Web.Services3.Addressing
    Imports Microsoft.Web.Services3.Messaging
    Public Class Form1
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
                Dim DITWSAuthInfo1 As New ITRV1.DITWSAuthInfo
                Dim aa As New ITRV1.ITRVByAckNoRequest
                Dim sigEle As String = ""
                Dim certchain1 As String = ""
                DITWSAuthInfo1.userID = "*****"
                DITWSAuthInfo1.password = "*****"
                Dim sigEle2 As String = ""
                Dim certchain12 As String = ""
                DITWSAuthInfo1.signature = sigEle2
                DITWSAuthInfo1.certChain = certchain12
                aa.authInfo = DITWSAuthInfo1
                aa.acknowledgementNo = "123"
                Dim d1 As ITRV1.DITWSResponse
                Dim aaa As New ITRV1.TRVServicePortTypeClient
                d1 = aaa.getITRVByAckNo(aa)
            Catch ex As Exception
                MsgBox(Err.Description & vbNewLine & ex.ToString)
            End Try
        End Sub
        Public Function FileBytes(ByVal FileName As String) As Byte()
            FileBytes = Nothing
                Dim fs As New FileStream(FileName, FileMode.Open, FileAccess.Read)
                Dim ImageData(fs.Length) As Byte
                fs.Read(ImageData, 0, System.Convert.ToInt32(fs.Length))
                Return ImageData
            Catch ex As Exception
                FileBytes = Nothing
                MsgBox(ex.StackTrace & Err.Description)
            End Try
        End Function
        Function VerifyXmlFile(ByVal Name As String, Optional ByRef sigEle As String = "", Optional ByRef certchain1 As String = "") As [Boolean]
                If Name Is Nothing Then
                    Throw New ArgumentNullException("Name")
                End If
                Dim xmlDocument As New XmlDocument()
                xmlDocument.PreserveWhitespace = True
                Dim signedXml As New SignedXml(xmlDocument)
                Dim nodeList As XmlNodeList = xmlDocument.GetElementsByTagName("Signature")
                signedXml.LoadXml(CType(nodeList(0), XmlElement))
                If signedXml.CheckSignature = True Then
                    sigEle = nodeList(0).OuterXml
                        Dim xmlele As XmlElement = signedXml.Signature.KeyInfo.GetXml
                        certchain1 = xmlele.GetElementsByTagName("X509Certificate").ItemOf(0).InnerText
                    Catch ex As Exception
                    End Try
                    Return True
                End If
                Return signedXml.CheckSignature()
            Catch ex As Exception
                Return False
            End Try
        End Function   
    End Class

    Monday, July 21, 2014 12:22 PM
  • Anyone know what are certchanin, signature parameters actually? what values to be passed?

    Please help

    Tuesday, July 22, 2014 8:11 AM
  • Yes, we can use the certificate to help us. But we can also use the others, the following article has told us about that, please try to check it:
    Digitally Signing a SOAP Message: .
    Wednesday, July 23, 2014 10:24 AM