Example #1
0
        public void TestSimpleSoapParsing()
        {
            string soapMessage            = File.ReadAllText(@"./soapMessage1.xml");
            SOAPFunctionDefinition result = SOAPFunctionDefinition.ParseXMLEnvelopeCall(soapMessage);

            Assert.Equal("CheckStatus", result.FunctionName);
            Assert.Equal(1, result.FunctionAttributes.Count());
            Assert.Equal("string", result.FunctionAttributes[0]);
        }
Example #2
0
        public APIGatewayProxyResponse SOAPProxy(APIGatewayProxyRequest Request, ILambdaContext context)
        {
            try{
                SOAPFunctionDefinition functionDefinition = SOAPFunctionDefinition.ParseXMLEnvelopeCall(Request.Body);

                SOAPFunctions soapFunctions = new SOAPFunctions();
                var           result        = soapFunctions.GetType().InvokeMember(functionDefinition.FunctionName, BindingFlags.InvokeMethod, null, soapFunctions, functionDefinition.FunctionAttributes.Cast <Object>().ToArray());
                return(new APIGatewayProxyResponse {
                    StatusCode = 200,
                    Headers = new Dictionary <string, string>()
                    {
                        { "Content-Type", "text/xml" }
                    },
                    Body = SOAPFunctionDefinition.CreateSOAPResponse(functionDefinition.FunctionName, (string)result)
                });
            }catch (Exception e) {
                return(APIGatewayProxyResponses.UnexpectedError(e));
            }
        }