Giter VIP home page Giter VIP logo

channeladam.soap's Introduction

channeladam.soap's People

Contributors

channeladam avatar mubaarakhassan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

channeladam.soap's Issues

[Suggestion] Allow to customise prefix for SOAP Envelope

Hello,

I have a feature suggestion. Currently we need to create a SOAP envelope with a defined namespace prefix. When building a new SOAP envelope with your library we get the generated output which has the namespace prefix env.

Is it possible to make this customisable. Currently we don't have any control over namespace prefixes or on the soap envelope tag. Looking at the code is there anyway we can insert our own NamespacePrefixConstants.SoapEnvelope? Possibly by adding a custom SoapBuilder feature like AddCustomSoapPrefix?

Also thanks for this library. It makes it easier for building SOAP.

Suggestion for docs

It might be helpful to point out in the docs that since Build() produces an XContainer, you can do all kinds of LINQish things with it. You can also pass in SaveOptions.DisableFormatting to ToString() to get unformatted XML.

(I was going to make unformatted XML a feature request until I examined the chained methods. In certain circumstances, all the carriage returns and spaces can really bloat a payload.)

Guidance

How would I create the following envelope?

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v="http://portal.vidyo.com/user/v1_1">
    <soapenv:Body>
        <v:CreateRoomRequest>
            <v:name>roomOne4</v:name>
            <v:extension>262644233</v:extension>
        </v:CreateRoomRequest>
    </soapenv:Body>
</soapenv:Envelope>

WSDL Spec for a Service

Hello,

There seems to be no way to generate a WSDL from a Nancy SOAP url.
Any suggestion, please?

Thanks for this awesome library!

Refactoring Logic to use ChannelAdam.Soap

I'm looking to use ChannelAdam.Soap for currently implemented server code that is having performance problems. I'm not very familiar with Soap however and this is not my code can you help me to refactor it to use your library.

Initialize Video Conference

    public static async Task<VidyoConference> InitializeVidyoConference( TPICalEntry calEntry)
    {
        VidyoConference conf = null;

        if (!string.IsNullOrEmpty(calEntry?.OtherInfo))
        {
            AppUtils.LogInfo($"==>> InitializeVidyoConference : request for patient: {calEntry.Title} id ={calEntry.Id}");

            //get the appointment obj
            var aptEntity = new EntityRepository<Appointment>(DBUtils.DBService);
            var appt = aptEntity.Retrieve(new Guid(calEntry.TPItemId));
            _httpClient = new HttpClient();
            try
            {
                var tag = calEntry.Id.ToString("N").Substring(2, 6);
                //create room name and extension
                var info = JsonConvert.DeserializeObject<OtherInfo>(calEntry.OtherInfo);
                var items = info.ProviderName.Split(' ');
                var roomname = items[0] + tag;
                var extension = GetRoomExtension();

                //usingthe create room api from the userportal web services binding
                var requestBody = DefineCreateRoomRequest(roomname, extension);
                var userWsdlUrl = VidyoPortalBaseUrl + VidyoPortalUserService;
                var byteArray = Encoding.UTF8.GetBytes(VidyoSysCreds); 
             
                _httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

                var response = await _httpClient.PostAsync(userWsdlUrl, new StringContent(requestBody, Encoding.UTF8, "text/xml"));
                if (response.IsSuccessStatusCode)
                {
                    using (var stream = await response.Content.ReadAsStreamAsync())
                    {
                        var xml = XElement.Load(stream);

                        conf = CreateVidyoConference(xml);
                        if (conf != null)
                        {
                            conf.Title = calEntry.Title;
                            conf.AppointmentId = calEntry.TPItemId;
                            conf.CalEntryId = calEntry.Id.ToString();
                            conf.DateAndTime = calEntry.DateAndTime;
                            conf.StartTime = calEntry.StartTime;
                            conf.EndTime = calEntry.EndTime;
                            conf.Status = calEntry.Status;
                            if (appt != null)
                            {
                                conf.CreatedAt = appt.CreatedAt;
                                conf.CreatedBy = appt.CreatedBy;
                            }
                            conf.EventStatus = AppointmentStatus.Scheduled.Value;

                            var confEntity = new EntityRepository<VidyoConference>(DBUtils.DBService);
                            confEntity.Create(conf);
                            using (var repository = new VidyoRepository())
                            {
                                repository.ConnectVidyoConference(new Guid(calEntry.TPItemId), conf.Id, new Guid(info.PatientId));
                            }
                        }
                        else
                            AppUtils.LogInfo($"== InitializeVidyoConference: CreateVidyoConference returned null : {response.ReasonPhrase}");
                    }
                }
                else
                {
                  AppUtils.LogInfo("== InitializeVidyoConference Error: " + response.ReasonPhrase);
                }
            }
        return conf;
    }

Define Create Request Body

    private static string DefineCreateRoomRequest(string roomName, string extension)
    {
        var soapenv = SoapEnv;
        var v1 = NSUserPortal;

        var roomreqXml = new XDocument(
            new XDeclaration("1.0", "utf-8", string.Empty),
            new XElement(soapenv + "Envelope",
                new XAttribute(XNamespace.Xmlns + "SOAP-ENV", soapenv),
                new XAttribute(XNamespace.Xmlns + "v1", v1),
                new XElement(soapenv + "Header"),
                new XElement(soapenv + "Body",
                    new XElement(v1 + "CreateRoomRequest",
                        new XElement(v1 + "name", roomName),
                        new XElement(v1 + "extension", extension)))));
        var req = roomreqXml.ToString();
        return req;
    }

Overloads for WithHeader.AddBlock()

Very handy little library!

Is there a reason that WithBody.AddEntry() has overloads for raw XML and POCOs, but WithHeader.AddBlock() does not? I'd be happy to work on a PR for this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.