A .NET library that provides a fluent API for building SOAP 1.1 and SOAP 1.2 messages.
Targets:
- .NET 6.0
- .NET 5.0
- .NET Standard 2.0
Please see https://devzone.channeladam.com/library/channeladam-soap/
A .NET library that provides a fluent API for building SOAP 1.1 and SOAP 1.2 messages.
License: Apache License 2.0
A .NET library that provides a fluent API for building SOAP 1.1 and SOAP 1.2 messages.
Targets:
Please see https://devzone.channeladam.com/library/channeladam-soap/
How can I set a Header for Basic Auth
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.
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.)
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>
It'd be useful to be able to provide a prefix (and the associated namespace uri) when calling AddBlock
and AddEntry
.
Would it be possible to add a sample project ?
Hello,
There seems to be no way to generate a WSDL from a Nancy SOAP url.
Any suggestion, please?
Thanks for this awesome library!
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.
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;
}
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;
}
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.