Пример #1
0
        /// <summary>
        /// Builds the query structure for SDMX v20 SOAP requests
        /// </summary>
        /// <param name="endpoint">
        /// The endpoint.
        /// </param>
        /// <param name="principal">
        /// The principal.
        /// </param>
        /// <returns>
        /// The <see cref="IController{XElement,XmlWriter}"/>.
        /// </returns>
        public IController <Message, XmlWriter> BuildQueryStructureV20FromMessage(WebServiceEndpoint endpoint, DataflowPrincipal principal)
        {
            IWriterBuilder <IStructureWriterManager, XmlWriter> structureManagerBuilder = new StructureBuilder(endpoint, _sdmxSchemaV20);
            IResponseGenerator <XmlWriter, ISdmxObjects>        responseGenerator       = new StructureResponseGenerator(structureManagerBuilder, StructureOutputFormatEnumType.SdmxV2RegistryQueryResponseDocument);
            var structureRequestController = new StructureRequestV20Controller <XmlWriter>(
                responseGenerator,
                this._mutableStructureSearchManagerV20,
                this._authMutableStructureSearchManagerV20,
                principal);

            return(structureRequestController);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SdmxStructureXmlFormat" /> class.
        /// </summary>
        /// <param name="sdmxOutputFormat">The SDMX output format.</param>
        /// <param name="endpoint">The endpoint.</param>
        /// <param name="xmlWriter">The XML writer.</param>
        /// <param name="actions">The actions.</param>
        /// <exception cref="System.ArgumentNullException">
        /// sdmxOutputFormat
        /// or
        /// xmlWriter
        /// </exception>
        /// <exception cref="ArgumentNullException"><paramref name="sdmxOutputFormat" /> is <see langword="null" />.</exception>
        public SdmxStructureXmlFormat(StructureOutputFormat sdmxOutputFormat, WebServiceEndpoint endpoint, XmlWriter xmlWriter, Queue<Action> actions)
        {
            if (sdmxOutputFormat == null)
            {
                throw new ArgumentNullException("sdmxOutputFormat");
            }

            if (xmlWriter == null)
            {
                throw new ArgumentNullException("xmlWriter");
            }

            this._sdmxOutputFormat = sdmxOutputFormat;
            this._endpoint = endpoint;
            this._xmlWriter = xmlWriter;
            this._actions = actions;
        }
        static void Main(string[] args)
        {
            string message = "<OrderRequest>" +
                             "<Customer>" +
                             "<CustomerID>4242</CustomerID>" +
                             "</Customer>" +
                             "<Product>" +
                             "<ProductID>123</ProductID>" +
                             "<Quantity>5</Quantity>" +
                             "<Price>40.99</Price>" +
                             "</Product>" +
                             "<CreditCard>" +
                             "<Holder>Klaus Aschenbrenner</Holder>" +
                             "<Number>1234-1234-1234-1234</Number>" +
                             "<ValidThrough>2009-10</ValidThrough>" +
                             "</CreditCard>" +
                             "<Shipping>" +
                             "<Name>Klaus Aschenbrenner</Name>" +
                             "<Address>Wagramer Strasse 4/803</Address>" +
                             "<ZipCode>1220</ZipCode>" +
                             "<City>Vienna</City>" +
                             "<Country>Austria</Country>" +
                             "</Shipping>" +
                             "</OrderRequest>";

            ClientApplication.vista_notebook.WebServiceEndpoint svc = new WebServiceEndpoint();
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(message);

            xml requestMessage = new xml();

            requestMessage.Any = new XmlNode[1] {
                doc.DocumentElement.ParentNode
            };

            svc.UseDefaultCredentials = true;
            svc.SendOrderRequestMessage(requestMessage);

            Console.WriteLine("Done");
            Console.ReadLine();
        }
        /// <summary>
        ///     Handles the structure request SOAP V20.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="endpoint">The endpoint.</param>
        /// <returns>The <see cref="IStreamController{XmlWriter}" />.</returns>
        public IStreamController<XmlWriter> ParseRequest(Message request, WebServiceEndpoint endpoint)
        {
            var structureOutputFormat = StructureOutputFormat.GetFromEnum(StructureOutputFormatEnumType.SdmxV2RegistryQueryResponseDocument);
            var sdmxSchema = structureOutputFormat.OutputVersion;
            var soapOperation = structureOutputFormat.EnumType.GetSoapOperation(SdmxStructureEnumType.Null);

            var rootElement = soapOperation.GetQueryRootElementV20();

            var sdmxObjects = this.GetStructureResponse(request, rootElement, sdmxSchema);

            return this.GetStreamController(endpoint, structureOutputFormat, sdmxObjects);
        }
 /// <summary>
 ///     Gets the stream controller.
 /// </summary>
 /// <param name="endpoint">The endpoint.</param>
 /// <param name="structureOutputFormat">The structure output format.</param>
 /// <param name="sdmxObjects">The SDMX objects.</param>
 /// <returns>The <see cref="IStreamController{XmlWriter}" />.</returns>
 private IStreamController<XmlWriter> GetStreamController(WebServiceEndpoint endpoint, StructureOutputFormat structureOutputFormat, ISdmxObjects sdmxObjects)
 {
     IStreamController<XmlWriter> streamController =
         new StreamController<XmlWriter>(
             (writer, queue) =>
             {
                 IStructureFormat format = new SdmxStructureXmlFormat(structureOutputFormat, endpoint, writer, queue);
                 this._writerManager.WriteStructures(sdmxObjects, format, null);
             });
     return streamController;
 }
        /// <summary>
        ///     Handles the query structure request SOAP V20.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="endpoint">The endpoint.</param>
        /// <returns>The <see cref="IStreamController{XmlWriter}" />.</returns>
        public IStreamController<XmlWriter> ParseRequest(XmlNode request, WebServiceEndpoint endpoint)
        {
            if (request == null)
            {
                throw new SdmxException("Missing message", SdmxErrorCode.GetFromEnum(SdmxErrorCodeEnumType.SyntaxError));
            }

            if (!request.StartsWithElement("RegistryInterface"))
            {
                throw new SdmxException("Expected 'RegistryInterface' but received " + request.Name, SdmxErrorCode.GetFromEnum(SdmxErrorCodeEnumType.SyntaxError));
            }

            var structureOutputFormat = StructureOutputFormat.GetFromEnum(StructureOutputFormatEnumType.SdmxV2RegistryQueryResponseDocument);
            var sdmxSchema = structureOutputFormat.OutputVersion;

            var sdmxObjects = this.GetStructureResponse(request, sdmxSchema);

            return this.GetStreamController(endpoint, structureOutputFormat, sdmxObjects);
        }
Пример #7
0
 /// <summary>
 /// Builds the query structure for SDMX v20 SOAP requests
 /// </summary>
 /// <param name="endpoint">
 /// The endpoint.
 /// </param>
 /// <param name="principal">
 /// The principal.
 /// </param>
 /// <returns>
 /// The <see cref="IController{XElement,XmlWriter}"/>.
 /// </returns>
 public IController<Message, XmlWriter> BuildQueryStructureV20FromMessage(WebServiceEndpoint endpoint, DataflowPrincipal principal)
 {
     IWriterBuilder<IStructureWriterManager, XmlWriter> structureManagerBuilder = new StructureBuilder(endpoint, _sdmxSchemaV20);
     IResponseGenerator<XmlWriter, ISdmxObjects> responseGenerator = new StructureResponseGenerator(structureManagerBuilder, StructureOutputFormatEnumType.SdmxV2RegistryQueryResponseDocument);
     var structureRequestController = new StructureRequestV20Controller<XmlWriter>(
         responseGenerator, 
         this._mutableStructureSearchManagerV20, 
         this._authMutableStructureSearchManagerV20, 
         principal);
     return structureRequestController;
 }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StructureBuilder"/> class.
 /// </summary>
 /// <param name="endpoint">
 /// The endpoint.
 /// </param>
 /// <param name="schema">
 /// The schema.
 /// </param>
 public StructureBuilder(WebServiceEndpoint endpoint, SdmxSchema schema)
 {
     this._endpoint = endpoint;
     this._schema   = schema;
 }