示例#1
0
        public IActionResult Get([FromQuery] string license)
        {
            string serviceName = "GetCarAssets";
            string inXmlString = $@"<?xml version=""1.0"" encoding=""UTF-16""?><FEMIGetContactCarAssetsIn><License>{license}</License></FEMIGetContactCarAssetsIn>";
            string inXml       = HttpUtility.HtmlEncode(inXmlString);
            string soap        = $@"<?xml version=""1.0"" encoding=""utf-8""?>
          <soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:cus=""http://siebel.com/CustomUI"">
                <soapenv:Header/>
                <soapenv:Body>
                    <cus:_sblesc_spcRunWSDLInboundInt_Input>
                        <cus:MethodName></cus:MethodName>
                        <cus:ServiceName>{serviceName}</cus:ServiceName>
                        <cus:inXML>{inXml}</cus:inXML>
                    </cus:_sblesc_spcRunWSDLInboundInt_Input>
                </soapenv:Body>
           </soapenv:Envelope>";

            string      xml = Soap.Execute(soap, "_sblesc_spcRunWSDLInboundInt");
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);

            string jsonText = JsonConvert.SerializeXmlNode(doc);

            return(Ok(JObject.Parse(jsonText)));
        }
示例#2
0
        public IActionResult Get(string areaName, string contactID)
        {
            if (contactID.Length < 9)
            {
                return(BadRequest());
            }

            string soap = $@"<?xml version=""1.0"" encoding=""utf-8""?>
          <soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:cus=""http://siebel.com/CustomUI"">
                <soapenv:Header/>
                <soapenv:Body>
                    <cus:GetContactAssets_Input>
                    <cus:SSN>{contactID}</cus:SSN>
                    <cus:Area>{areaName}</cus:Area>
                    </cus:GetContactAssets_Input>
                </soapenv:Body>
           </soapenv:Envelope>";

            string xml        = Soap.Execute(soap, "GetContactAssets");
            int    startIndex = xml.IndexOf("<Contact>");
            int    endIndex   = xml.IndexOf("</ListOfFemiContactIntIo>");

            xml = xml.Substring(startIndex, endIndex - startIndex);
            xml = "<Contacts>" + xml + "</Contacts>";

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);
            XmlSerializer ser = new XmlSerializer(typeof(Contacts));
            Contacts      contact;

            using (StringReader sr = new StringReader(xml))
            {
                contact = (Contacts)ser.Deserialize(sr);
            }

            string jsonText = JsonConvert.SerializeObject(contact);

            return(Ok(JObject.Parse(jsonText)));
        }