Exemple #1
0
        /// <summary>
        /// Encapsulate the given XML within a XML SOAP frame.
        /// </summary>
        /// <param name="SOAPBody">The internal XML for the SOAP body.</param>
        /// <param name="XMLNamespaces">An optional delegate to process the XML namespaces.</param>
        public static XElement Encapsulation(XElement SOAPBody,
                                             SOAPNS.XMLNamespacesDelegate XMLNamespaces = null)
        {
            #region Initial checks

            if (SOAPBody == null)
            {
                throw new ArgumentNullException(nameof(SOAPBody), "The given XML must not be null!");
            }

            if (XMLNamespaces == null)
            {
                XMLNamespaces = xml => xml;
            }

            #endregion

            return(XMLNamespaces(
                       new XElement(SOAPNS.v1_2.NS.SOAPEnvelope + "Envelope",
                                    new XAttribute(XNamespace.Xmlns + "SOAP", SOAPNS.v1_2.NS.SOAPEnvelope.NamespaceName),
                                    new XAttribute(XNamespace.Xmlns + "eMIP", eMIPNS.Default.NamespaceName),
                                    new XAttribute(XNamespace.Xmlns + "dyn", eMIPNS.EVCIDynamic.NamespaceName),
                                    new XAttribute(XNamespace.Xmlns + "auth", eMIPNS.Authorisation.NamespaceName),

                                    new XElement(SOAPNS.v1_2.NS.SOAPEnvelope + "Header"),
                                    new XElement(SOAPNS.v1_2.NS.SOAPEnvelope + "Body", SOAPBody)
                                    )
                       ));
        }
Exemple #2
0
        /// <summary>
        /// Encapsulate the given XML within a XML SOAP frame.
        /// </summary>
        /// <param name="SOAPHeaders">The internal XML for the SOAP header.</param>
        /// <param name="SOAPBody">The internal XML for the SOAP body.</param>
        /// <param name="XMLNamespaces">An optional delegate to process the XML namespaces.</param>
        public static XElement Encapsulation(XElement[]                    SOAPHeaders,
                                             XElement SOAPBody,
                                             SOAPNS.XMLNamespacesDelegate XMLNamespaces = null)
        {
            #region Initial checks

            if (SOAPBody == null)
            {
                throw new ArgumentNullException(nameof(SOAPBody), "The given XML must not be null!");
            }

            if (XMLNamespaces == null)
            {
                XMLNamespaces = xml => xml;
            }

            #endregion

            return(XMLNamespaces(

                       new XElement(SOAPNS.v1_2.NS.SOAPEnvelope + "Envelope",
                                    new XAttribute(XNamespace.Xmlns + "SOAP", SOAPNS.v1_2.NS.SOAPEnvelope.NamespaceName),
                                    new XAttribute(XNamespace.Xmlns + "CS", OCPPNS.OCPPv1_5_CS.NamespaceName),
                                    new XAttribute(XNamespace.Xmlns + "CP", OCPPNS.OCPPv1_5_CP.NamespaceName),

                                    // <soap:Header>
                                    //   <ns:chargeBoxIdentity>Belectric_Ready</ns:chargeBoxIdentity>
                                    //   <wsrm:Sequence>
                                    //     <wsrm:Identifier>soapenv:Sender
                                    //               wsa:ActionNotSupported</wsrm:Identifier>
                                    //     <wsrm:MessageNumber>1</wsrm:MessageNumber>
                                    //   </wsrm:Sequence>
                                    //   <wsa:Action>/BootNotification</wsa:Action>
                                    //   <wsa:MessageID>uuid:3b047fc6-8da0-4856-95c8-0e8cdad5bed6</wsa:MessageID>
                                    //   <wsa:To>https://emobilityqs.regioit-aachen.de/SmartWheelsAccessServiceWs2/services/CentralSystemService_1_5</wsa:To>
                                    //   <wsa:RelatesTo>uuid:10db04d5-9b4a-4498-b7ee-3a37d571ce65</wsa:RelatesTo>
                                    // </soap:Header>
                                    new XElement(SOAPNS.v1_2.NS.SOAPEnvelope + "Header", SOAPHeaders),

                                    new XElement(SOAPNS.v1_2.NS.SOAPEnvelope + "Body", SOAPBody)

                                    )

                       ));
        }
Exemple #3
0
        /// <summary>
        /// Encapsulate the given XML within a XML SOAP frame.
        /// </summary>
        /// <param name="SOAPBody">The internal XML for the SOAP body.</param>
        /// <param name="XMLNamespaces">An optional delegate to process the XML namespaces.</param>
        public static XElement Encapsulation(XElement SOAPBody,
                                             SOAPNS.XMLNamespacesDelegate XMLNamespaces = null)
        {
            #region Initial checks

            if (SOAPBody == null)
            {
                throw new ArgumentNullException(nameof(SOAPBody), "The given XML must not be null!");
            }

            if (XMLNamespaces == null)
            {
                XMLNamespaces = xml => xml;
            }

            #endregion

            return(XMLNamespaces(
                       new XElement(SOAPNS.v1_1.NS.SOAPEnvelope + "Envelope",
                                    new XAttribute(XNamespace.Xmlns + "SOAP", SOAPNS.v1_1.NS.SOAPEnvelope.NamespaceName),
                                    new XAttribute(XNamespace.Xmlns + "CommonTypes", OICPNS.CommonTypes.NamespaceName),
                                    new XAttribute(XNamespace.Xmlns + "EVSEData", OICPNS.EVSEData.NamespaceName),
                                    new XAttribute(XNamespace.Xmlns + "EVSEStatus", OICPNS.EVSEStatus.NamespaceName),
                                    new XAttribute(XNamespace.Xmlns + "MobileAuthorization", OICPNS.MobileAuthorization.NamespaceName),
                                    new XAttribute(XNamespace.Xmlns + "Authorization", OICPNS.Authorization.NamespaceName),
                                    new XAttribute(XNamespace.Xmlns + "AuthenticationData", OICPNS.AuthenticationData.NamespaceName),

#if OICPv2_2
                                    new XAttribute(XNamespace.Xmlns + "B2B2CFeedback", OICPNS.B2B2CFeedback.NamespaceName),
#endif

                                    new XElement(SOAPNS.v1_1.NS.SOAPEnvelope + "Header"),
                                    new XElement(SOAPNS.v1_1.NS.SOAPEnvelope + "Body", SOAPBody)
                                    )
                       ));
        }