How to make webservice in JSON in ASP.NET C# - c#

Please find the below code for webservice. It is the post method webservice but when I am trying to parse it from iPhone. It is throwing error.
function TestMe(strURI) {
//alert(strURI);
$.ajax({
url: strURI,
type: 'POST',
//contentType: 'application/json',
data: JSON.stringify({
"Input": [
{
"MeetingId":"2",
"FromUserId":"1",
"DBMessage": "Test Message by index page"
}]
}),
success: function (result) {
alert('success');
console.log(result);
},
error: function (data) {
console.log(data);
alert('error');
},
complete: function () {
//alert('complete');
}
});
}
In other class I have defined this method
public string SaveDiscussionBoardMsg(Stream input)
{
string body = new StreamReader(input).ReadToEnd();
string strJSONResult = "";
objDAMeeting = new DA.Meeting();
BO.BMO.DiscussionBoard objBODiscussionBoard = new BO.BMO.DiscussionBoard();
//Method-2
//string JsonInsertSQL = #" {""Input"":[{""MeetingId"":1,""DBMessage"":""My Msg"",""FromUserId"":1},{""MeetingId"":1,""DBMessage"":""My Msg"",""FromUserId"":1}]}";
//string JsonInsertSQL = #" {""Input"":[{""MeetingId"":1,""DBMessage"":""My Msg"",""FromUserId"":1}]}";
dynamic dynObj = Newtonsoft.Json.JsonConvert.DeserializeObject(body);
foreach (var item in dynObj.Input)
{
objBODiscussionBoard.MeetingId = Convert.ToInt32(item.MeetingId.ToString());
objBODiscussionBoard.DBMessage = item.DBMessage.ToString();
objBODiscussionBoard.FromUserId = Convert.ToInt32(item.FromUserId.ToString());
strJSONResult = objDAMeeting.SaveDiscussionBoardMsg(objBODiscussionBoard);
}
strJSONResult = string.Format("{0}{1}{2}", strPrefix, "\"" + strJSONResult + "\"", strPostfix);
//HttpContext.Current.Response.ContentType = "application/json; charset=utf-8";
//HttpContext.Current.Response.Write(strJSONResult);
objDAMeeting = null;
return strJSONResult;
}
We are using WCF
[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "/SaveDiscussionBoardMsg")]
string SaveDiscussionBoardMsg(Stream input);
I am getting this error. Please find below error.
{
html = {
body = {
div = {
"div##Attributes##" = {
id = content;
};
p = (
"Request Error",
{
a = "service help page";
"p##Attributes##" = {
xmlns = "";
};
}
);
};
};
head = {
style = "BODY { color: #000000; background-color: white; font-family: Verdana; margin-left: 0px; margin-top: 0px; } #content { margin-left: 30px; font-size: .70em; padding-bottom: 2em; } A:link { color: #336699; font-weight: bold; text-decoration: underline; } A:visited { color: #6699cc; font-weight: bold; text-decoration: underline; } A:active { color: #336699; font-weight: bold; text-decoration: underline; } .heading1 { background-color: #003366; border-bottom: #336699 6px solid; color: #ffffff; font-family: Tahoma; font-size: 26px; font-weight: normal;margin: 0em 0em 10px -20px; padding-bottom: 8px; padding-left: 30px;padding-top: 16px;} pre { font-size:small; background-color: #e5e5cc; padding: 5px; font-family: Courier New; margin-top: 0px; border: 1px #f0f0e0 solid; white-space: pre-wrap; white-space: -pre-wrap; word-wrap: break-word; } table { border-collapse: collapse; border-spacing: 0px; font-family: Verdana;} table th { border-right: 2px white solid; border-bottom: 2px white solid; font-weight: bold; background-color: #cecf9c;} table td { border-right: 2px white solid; border-bottom: 2px white solid; background-color: #e5e5cc;}";
title = "Request Error";
};
"html##Attributes##" = {
xmlns = "http://www.w3.org/1999/xhtml";
};
};
}

Try after adding dataType: 'json' as
$.ajax({
url: strURI,
type: 'POST',
dataType: 'json',
//contentType: 'application/json',
data: JSON.stringify({
"Input": [
{
"MeetingId":"2",
"FromUserId":"1",
"DBMessage": "Test Message by index page"
}]
}),
success: function (result) {
alert('success');
console.log(result);
},
error: function (data) {
console.log(data);
alert('error');
},
complete: function () {
//alert('complete');
}
});

Related

Gembox Document HTML to PDF doesn't show the text vertically

While converting from HTML to PDF, I noticed that Gembox Document doesn't recognize the "REPRINT" strings as a vertical.
The following is the HTML code:
<html>
<head>
<style>
.main-container {
text-align: center;
}
.code {
font-size: 25px;
font-weight: bold;
letter-spacing: 1px;
}
.mrg-btm {
margin-bottom: 8px;
}
.name-and-code {
font-size: 24px;
font-weight: bold;
letter-spacing: 3px;
}
.font-bold {
font-weight: bold;
}
.table-class {
width: 100%;
font-size: 14px;
}
td {
width: 50%;
}
.line-left {
text-align: left;
}
.line-right {
text-align: right;
}
.scadenza {
font-size: 24px;
font-weight: bold;
letter-spacing: 3px;
}
.data-scadenza {
font-size: 24px;
font-weight: bold;
letter-spacing: 2px;
}
.materiali {
font-size: 24px;
font-weight: bold;
text-align: left;
letter-spacing: 5px;
}
.last-codes {
font-size: 10px;
text-align: left;
}
.mrg-btm-two {
margin-bottom: 64px;
}
.mrg-btm-three {
margin-bottom: 16px;
}
.mrg-btm-four {
margin-bottom: 20px;
}
.mrg-side-left {
margin-left: 2px;
}
.main-table {
width: 100%;
}
.reprint-td {
width: 5%;
writing-mode: vertical-lr;
text-align: center;
letter-spacing: 4px;
font-size: 18px;
font-weight: bold;
}
.main-td {
width: 90%;
}
.reprint-div {
display: inline-block;
height: 100%;
}
</style>
</head>
<body>
<table class="main-table">
<tr>
<td class="reprint-td">
<div class="reprint-div">REPRINT</div>
</td>
<td class="main-td">
<div class="main-container">
<div class="code mrg-btm">
<label>__LABEL1__</label>
</div>
<div class="name-and-code mrg-btm-four">
<label>__LABEL2__ __LABEL3__</label>
</div>
<div class="mrg-btm-four">
<img alt='Barcode Generator TEC-IT' src='https://barcode.tec-it.com/barcode.ashx?data=BARCODE_NUMBER&code=Code39'/>
</div>
<div class="mrg-btm-three">
<table class="table-class">
<tr>
<td class="line-left">SQA_TEXT</td>
<td class="font-bold line-right">METER</td>
</tr>
<tr>
<td class="line-left">GOMSET</td>
<td class="line-right">FIRST_DATA</td>
</tr>
</table>
</div>
<div class="scadenza mrg-btm">
<label>EXPIRE_TEXT</label>
</div>
<div class="data-scadenza mrg-btm">
<label>EXPIRE_DATA</label>
</div>
<div class="materiali mrg-btm">
<label>MATERIALS_TEXT</label>
</div>
<div class="last-codes mrg-btm-two">
<label class="mrg-side-left">RC_NUMBER AFTER_RC</label>
</div>
<div class="last-codes mrg-btm">
<label class="mrg-side-left">SB_CODE STR_CODE SECOND_DATA</label>
</div>
<div class="last-codes">
<label class="mrg-side-left">C_CODE_NUMBER RC_NUMBER AFTER_RC</label>
</div>
</div>
</td>
<td class="reprint-td">
<div class="reprint-div">REPRINT</div>
</td>
</tr>
</table>
</body>
</html>
The following is the result of the HTML code (it is ok):
enter image description here
The following are the C# methods of our interest:
private void convertHtmlToPdf(string filenameHtml)
{
showMessage("Operation in progress...");
string realHtml = replaceIntoTemplate(File.ReadAllText(filenameHtml));
File.WriteAllText(path + htmlFilenameReplaced, realHtml);
GemBox.Document.ComponentInfo.SetLicense(licenseGemboxDocument);
DocumentModel document = DocumentModel.Load(path + htmlFilenameReplaced);
document.DefaultCharacterFormat.FontName = "Verdana";
GemBox.Document.Section section = document.Sections[0];
PageSetup pageSetup = section.PageSetup;
pageSetup.PageWidth = 383.62;
pageSetup.PageHeight = 576.95;
PageMargins pageMargins = pageSetup.PageMargins;
pageMargins.Top = pageMargins.Bottom = 96;
pageMargins.Left = pageMargins.Right = 48;
document.Save(path + pdfFilename);
showMessage("Successfully conversion HTML to PDF");
}
private string replaceIntoTemplate(string templateHtml)
{
string newTemplateHtml = templateHtml;
newTemplateHtml = newTemplateHtml.Replace("__LABEL1__", label1.Replace(" ", " "));
newTemplateHtml = newTemplateHtml.Replace("__LABEL2__", label2.Replace(" ", " "));
newTemplateHtml = newTemplateHtml.Replace("__LABEL3__", label3.Replace(" ", " "));
newTemplateHtml = newTemplateHtml.Replace("BARCODE_NUMBER", barcode.Replace(" ", " "));
newTemplateHtml = newTemplateHtml.Replace("SQA_TEXT", sqa.Replace(" ", " "));
newTemplateHtml = newTemplateHtml.Replace("METER", meter.Replace(" ", " "));
newTemplateHtml = newTemplateHtml.Replace("GOMSET", gomset.Replace(" ", " "));
newTemplateHtml = newTemplateHtml.Replace("FIRST_DATA", firstData.Replace(" ", " "));
newTemplateHtml = newTemplateHtml.Replace("EXPIRE_TEXT", expireText.Replace(" ", " "));
newTemplateHtml = newTemplateHtml.Replace("EXPIRE_DATA", expireData.Replace(" ", " "));
newTemplateHtml = newTemplateHtml.Replace("MATERIALS_TEXT", materials.Replace(" ", " "));
newTemplateHtml = newTemplateHtml.Replace("RC_NUMBER", rcNumber.Replace(" ", " "));
newTemplateHtml = newTemplateHtml.Replace("AFTER_RC", numberAfterRc.Replace(" ", " "));
newTemplateHtml = newTemplateHtml.Replace("SB_CODE", sbCode.Replace(" ", " "));
newTemplateHtml = newTemplateHtml.Replace("STR_CODE", strCode.Replace(" ", " "));
newTemplateHtml = newTemplateHtml.Replace("SECOND_DATA", secondData.Replace(" ", " "));
newTemplateHtml = newTemplateHtml.Replace("C_CODE_NUMBER", cCode.Replace(" ", " "));
return newTemplateHtml;
}
The result of the conversion from HTML to PDF is the following (with the "REPRINT" strings not vertically):
enter image description here
What can I change in the convertHtmlToPdf C# method for obtained the "REPRINT" strings vertically?
Try using this latest bugfix version:
https://www.gemboxsoftware.com/document/nightlybuilds/GBD35v1134.zip
Or this latest NuGet package:
Install-Package GemBox.Document -Version 35.0.1134-hotfix
The writing-mode CSS property in table cells should now be supported.

Base64 string encoded Images not loading on the output PDF (TuesPechkin / Wkhtmltopdf)

Fair warning: This post is a bit of an essay-sized question... So let me say my thanks beforehand to whoever goes through it and tries to answer it.
Context:
I have been trying the only 2 free-commercial-use open-source html to pdf converting libraries I could find.
PDFSharp unfortunately outputs a pdf with a completely messy style layout that doesn't respect the formatting of the input HTML and sometimes doesn't output images properly. (How it should've look vs how it looks with PDF#)
TuesPechkin (wkhtmltopdf c# wrapper library) on the other hand does it all right except for only outputting these odd "image containers" (a hollow outline of where the image supposedly should be).
I declare the IConverter object upon calling my class' constructor like so:
converter = new ThreadSafeConverter( new RemotingToolset<PdfToolset>( new Win64EmbeddedDeployment( new TempFolderDeployment())));
Then I have the following method where you can find the GlobalSettings and ObjectSettings I'm currently using for the conversion.
/// <summary>
/// Method for converting an .EML's HTML Body to a PDF
/// </summary>
/// <param name="html">The HTML to be converted</param>
/// <param name="usern">Optional: Username for file naming</param>
/// <param name="idx">Optional: Index for file naming</param>
public void Convert2PDF(string html, string usern = null, int? idx = null)
{
string userName = usern ?? "test";
var document = new HtmlToPdfDocument
{
GlobalSettings =
{
ProduceOutline = true,
DocumentTitle = userName.Split('#')[0] + "__" + idx.Value.ToString(),
PaperSize = PaperKind.A4,
Margins =
{
Left = 6,
Top = 4,
Right = 6,
Bottom = 8,
Unit = Unit.Millimeters
},
UseCompression = false
},
Objects =
{
new ObjectSettings { HtmlText = html,
WebSettings = new WebSettings
{
EnableIntelligentShrinking = false,
DefaultEncoding = "UTF-8",
LoadImages = true,
PrintBackground = true,
},
FooterSettings = new FooterSettings{CenterText = "[page]"},
}
}
};
byte[] bolb = converter.Convert(document);
File.WriteAllBytes(Path.Combine(mailBoxDirPath, ".PDFs", userName.Split('#')[0] + "__" + idx.Value.ToString() + "__with_TuesPechkin__" + ".pdf"), bolb);
/* ↑ TuesPechkin */
/* ↓ PdfSharp */
byte[] blob = null;
using(MemoryStream ms = new MemoryStream())
{
PdfDocument pdf = PdfGenerator.GeneratePdf(html,PageSize.A4,/*margin from border to content ==*/ 0);
pdf.Save(ms);
blob = ms.ToArray();
}
userName = usern ?? "test";
File.WriteAllBytes(Path.Combine(mailBoxDirPath, ".PDFs", userName.Split('#')[0] + "__" + idx.Value.ToString() + "__with_PDF#__" + ".pdf"), blob);
}
This "HTML" string is obtained from the output of another library I'm using called "MailKit/MimeKit" made by "Jstedfast".I take this output and insert my own kind of "formatted header with some of the email's info" while also switching the image's CID every time there's one, with the following code that uses MailKit/MimeKit's tools:
...
foreach (MimePart part in temp.BodyParts)
{
if (!part.IsAttachment && part.ContentId != null)
{
using (Stream stream = new MemoryStream())
{
part.Content.WriteTo(stream);
stream.Flush();
stream.Seek(0, SeekOrigin.Begin);
using (StreamReader sr = new StreamReader(stream))
{
string cid = string.Format("src=\"cid:{0}", part.ContentId);
string data = string.Format("src=\"data:{0}/{1};{2},\n{3}", part.ContentType.MediaType, part.ContentType.MediaSubtype, part.ContentTransferEncoding, sr.ReadToEnd());
rValue.Replace(cid, data);
}
}
}
}
...
Side note: "temp" would be my MimeMessage.
And here would be the whole string-building process for reference. I usually test these outputs on HTML previewers, and they come out without any issues in formatting or image display, so I know the issue isn't my HTML input when trying to convert to PDF:
...
MimeMessage temp = emp.Pop3.GetMessage(idx);
StringBuilder rValue = new StringBuilder(null);
Regex bodyTag = new Regex(#"^<body.*>$");
Regex charset = new Regex("charset=(.*)\"");
string body = string.Empty, condHelper = string.Empty;
List<string> tempBody = temp.HtmlBody.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList<string>();
int tempidx = 0;
foreach (string line in tempBody) // Looks-up this HTML's charset and sets it to utf-8
{
if(charset.IsMatch(line))
{
condHelper = charset.Match(line).Value;
tempidx = tempBody.IndexOf(line);
tempBody[tempidx] = line.Replace(condHelper, "charset=utf-8\"");
break;
}
}
foreach(string line in tempBody) //Looks up the index of the body tag so I append that "custom header" with basic info from the email
{
if (bodyTag.IsMatch(line))
{
tempidx = tempBody.IndexOf(line);
break;
}
}
string line4change = tempBody[tempidx];
line4change += emp.HeaderBuilder(temp.Subject, temp.From.Mailboxes.First(), temp.To.Mailboxes.ToList<MailboxAddress>(), temp.Date.DateTime, temp.Cc.Mailboxes.ToList<MailboxAddress>());
tempBody[tempidx] = line4change;
for (int i = 0; i < tempBody.Count; i++) // starts building the final version of the whole html string
body += tempBody[i] + Environment.NewLine;
rValue.Append(body);
foreach (MimePart part in temp.BodyParts)
{
if (!part.IsAttachment && part.ContentId != null)
{
using (Stream stream = new MemoryStream())
{
part.Content.WriteTo(stream);
stream.Flush();
stream.Seek(0, SeekOrigin.Begin);
using (StreamReader sr = new StreamReader(stream))
{
string cid = string.Format("src=\"cid:{0}", part.ContentId);
string data = string.Format("src=\"data:{0}/{1};{2},\n{3}", part.ContentType.MediaType, part.ContentType.MediaSubtype, part.ContentTransferEncoding, sr.ReadToEnd());
rValue.Replace(cid, data);
}
}
}
}
try
{
emp.Convert2PDF(rValue.ToString(), emp.User, idx);
}
catch { }
...
So, my objective is to fix the odd output of these hollow image containers on the outputted PDF file.
Edit: Here's an example of an HTML string taken directly from the debugger right before it gets sent to the "Convert2PDF" method:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="margin-top:24px;"></div>
<span style="font-family: Segoe UI; font-size: 16; font-weight: bold; "> t est</span><br>
<span><hr style="height: 4px; border: none; margin-top: 2px; margin-bottom: 12px; color:#000; background-color:#000;" /></span>
<table style="margin-bottom:32px; " cellspacing="0" cellpadding="4">
<tr>
<td style="margin-left: auto; padding-right: 128px; white-space: nowrap;"><span style="font-family: Segoe UI; font-size: 14; font-weight: bold; "> From:</span></td>
<td style="white-space: nowrap;"><span style="font-family:Segoe UI; font-size: 14;">tester[REDACTED]#outlook.com</span></td>
<td style="width:99%; "></td>
</tr>
<tr style="background-color:#f2f2f2;">
<td style="margin-left: auto; padding-right: 128px; white-space: nowrap;"><span style="font-family:Segoe UI; font-size: 14; font-weight: bold;"> Sent:</span></td>
<td style="white-space: nowrap;"><span style="font-family:Segoe UI; font-size: 14; ">Monday, 11th of October 2021, 08:52:49</span></td>
<td style="width:99%; "></td>
</tr>
<tr>
<td style="margin-left: auto; padding-right: 128px; white-space: nowrap;"><span style="font-family:Segoe UI; font-size: 14; font-weight: bold;"> To:</span></td>
<td style="white-space: nowrap;"><span style="font-family:Segoe UI; font-size: 14;">[REDACTED]</span></td>
<td style="width:99%; "></td>
</tr>
<tr style="background-color:#f2f2f2;">
<td style="margin-left: auto; padding-right: 128px; white-space: nowrap;"><span style="font-family:Segoe UI; font-size: 14; font-weight: bold;"> Subject:</span></td>
<td style="white-space: nowrap;"><span style="font-family:Segoe UI; font-size: 14;">Testing TuesPechkin Library w/Images</span></td>
<td style="width:99%; "></td>
</tr>
</table>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
1st Inline image:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<img style="width: 187px; height: 221px; max-width: 100%;" size="7198" contenttype="image/png" width="187" height="221" alt="key points of an email" data-outlook-trace="F:1|T:1" src="data:image/png;Base64,
iVBORw0KGgoAAAANSUhEUgAAALsAAADdCAIAAABsX5R6AAAAAXNSR0IArs4c6QAAAARnQU1BAACx
jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABuzSURBVHhe7Z15WBPHH4edDQEUKYfiUbxaLR54
IYhWi1b9WfHASr1QPKpQarVaLZaqQERQPEFr1QpKq8UDq+CBgE8Vigoo0gcRQfABRX0QCo8ID8JD
8pA8/HJsktlNAlnZmCDf9682k91E5s3szOzOZzo0AQATwBiAGWAMwAwwBmAGGAMwA4wBmAHGAMwA
YwBmgDEAM8AYgBksGSMqP+XlOKJlnHxiXpGHAG0Ttox5vn+icYeWMZ5yqIw8BGibgDEAM8AYgBk6
MoY7dNm+I2qIuJJXTx4CtE10ZIzJtKOVZBHwfqE3Y0Q1T7LSbitIf1DaIH61vjjpwMbl7tOnzVgU
lsGXvVMBv+zfy5E7Nvp4fuXmOnXqtJnui7x+DP4t7t5L+htlqP+EpqY3xdeP8tZ8Pd9t+gz3JWtD
Tqa/FEhfl9JYkX0hfNM3Hl+Kv8IcD+9NBy4+rBaRZTiiurJH/97LeVrVSL7QbtCbMfwb3/XhkO8W
wx0T+qgyNWCsFYFkL5jMPvGGfKv49JUZh73H25qSZVSQqe1nPhH3XtMrVvUTCuqKzq0b151LOQ3i
WDv/lFguPrqhIPqbUVYc6ocg496zwrOUX0VMQ17U8uGWRpL3oY59poXcrFLn1PuKwRjjHPCbT39p
LchQGtOQf3zhAPWyKEFm9t7nnwllR8igf8LodTsW9qPaIofoNud4xunFGkoRd/D6VIUzoue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qvP/LZQOrxufxyzGezFE96VxhjPZ0QZoJ8YIC0LHdO5q5+ziPMCS0tc06r8m+V2vVmrbtCNj
VCcAEMd2wenSt+tkt1varzHIqNvEbbcM5tG2NkN76ceUnV892tZMOi2HOGYfjnBdFX7jOXR434J2
YowMYX3Vyxcvq+rVz74AWtGujAFYAIwBmAHGAMwAYwBmgDEAM8AYgBlgDMAMMAZgQlPT/wHgbtxB
+HbHjAAAAABJRU5ErkJggg==
"><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
2nd Inline image:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<img style="width: 100px; height: 100px; max-width: 100%;" size="967" contenttype="image/png" width="100" height="100" alt="2 dradients" data-outlook-trace="F:1|T:1" src="data:image/png;Base64,
iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAANcSURBVHhe7dzJS5RxHMfxb3u2u83q7pj7vhta
Zlbj7FMEBQURFBTUwUNBHTx48OLBg4eCOhQUFEREUBARERFERFppZWWWmeW+tjc95++pub0PA68/
4Mfn8vBsbxlLcET8p8hYYYiMFYbIWGGIjBUGGbOnAw0nZgHJuD0NaDApD0gm7KlA/clFQDJpTwHq
SykDkilbMlBvajWQTNuSgLrTaoFkxpYE9CS9HsgYKxHokaMRSGZtCUAPMpxAMme1A93L9ALJvNUG
dCcrCCTfrFagW9m7gOS71Qp0I2cPkPywWICu5e4Dkp8WM9CVvANAxlgmoEv5h4DklyUe6ELBESD5
bYkDOld4DEj+mOOAzhQ1A8lfcyxQZ8kJIAmZY4A6Sk8BGWNFA7WXtQBJyLQOqK28FcgYay1Qa0Ub
UGSsMEDHaqlsBzLGWgN0sqoDyBhrNdDx6k4gCcWvAmquOQ1kjLUS6OiGs0DGWCuADteeBzLGigI6
WHcRSEJxUUD7N14GMsZaDrR301UgY6xlQLvrrwMZYy0F2rn5JpAx1hIgf8NtIAnFLgZyb7kLBB1r
W+N9IGOsRUANWx8CGWMtBKrb/hhIQjELgGqcT4GMsYgqmp4D6VNCFLteAulTQuS73wDpU0JkewaA
JBRN5PB+AtKnhEjxfQHSp4RI8I8B6VNCmANTQPqUELE75oH0ZQgiLjgHBL03jA/OAkGflJqCM0DQ
94am4DQQ9CsadRmCgH6AawlMAkF/R7EGJoGgP2faAhNA0FSBPTAOJKMJDiB1UwYhqk0DkegfBRLV
poFI9I8AiWrTQCT5R4BEtWkgkn1fgUS1aSDUI0oIUW0aiFTfMJCoNg1Emu8zkKg2DUS6bwhIVJsG
wuEdAhLVpoFQL+wgRLVpIDK8g0Ci2jQQ670fgUS1aSAyPR+ARLVpILI8A0Ci2jQQ6vMVCFFtGogc
z3sgUW0aiBxPP5CoNg1ErvsdkKg2DUSe+y2QqDYNhPqYE0JUmwaiwN0HJKpNA1Ho6gMS1aaBKHK9
BhKVW4Eodr0CEpVbgVC/NkCIyq1AlLh6gUTlViBKm3qAROVWIMqaeoBE5VYgypteAInKrUCoH/0g
ROVWICqdz4BE5VYgqpzdQKJyKxBVzi4gUbkViGpnF46z6x+zRQbPWHJSYgAAAABJRU5ErkJggg==
"><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Stylized text:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-family: Georgia, serif; color: rgb(179, 106, 226);">​<b><i><u><strike>S o m e T e x t</strike></u></i></b></span><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-family: Georgia, serif; color: rgb(179, 106, 226);"><b><i><u><strike><br>
</strike></u></i></b></span></div>
</body>
</html>
I have been using the following site to test these HTML strings making sure their formatting and images are displaying correctly: https://www.onlinehtmleditor.net/
I tested your HTML using NuGet package itext7.pdfhtml and the images didn't show either. However after some investigation, I discovered an issue with the value in the src property.
In the src property value you have data:image/png;Base64. It should be data:image/png;base64 - notice the lower-case b for base64.
After changing Base64 to base64 it seems to work.
<img style="width: 187px; height: 221px; max-width: 100%;" size="7198" contenttype="image/png" width="187" height="221" alt="key points of an email" data-outlook-trace="F:1|T:1" src="data:image/png;base64,
iVBORw0KGgoAAAANSUhEUgAAALsAAADdCAIAAABsX5R6AAAAAXNSR0IArs4c6QAAAARnQU1BAACx
jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABuzSURBVHhe7Z15WBPHH4edDQEUKYfiUbxaLR54
IYhWi1b9WfHASr1QPKpQarVaLZaqQERQPEFr1QpKq8UDq+CBgE8Vigoo0gcRQfABRX0QCo8ID8JD
8pA8/HJsktlNAlnZmCDf9682k91E5s3szOzOZzo0AQATwBiAGWAMwAwwBmAGGAMwA4wBmAHGAMwA
YwBmgDEAM8AYgBksGSMqP+XlOKJlnHxiXpGHAG0Ttox5vn+icYeWMZ5yqIw8BGibgDEAM8AYgBk6
MoY7dNm+I2qIuJJXTx4CtE10ZIzJtKOVZBHwfqE3Y0Q1T7LSbitIf1DaIH61vjjpwMbl7tOnzVgU
lsGXvVMBv+zfy5E7Nvp4fuXmOnXqtJnui7x+DP4t7t5L+htlqP+EpqY3xdeP8tZ8Pd9t+gz3JWtD
Tqa/FEhfl9JYkX0hfNM3Hl+Kv8IcD+9NBy4+rBaRZTiiurJH/97LeVrVSL7QbtCbMfwb3/XhkO8W
wx0T+qgyNWCsFYFkL5jMPvGGfKv49JUZh73H25qSZVSQqe1nPhH3XtMrVvUT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
SQn866uUt4fExozfU6xS+1Iaqwpvxv3+y86gwC1bAnjBoWFH/oxLvl/abEq+NjH5SkS1xbfOR+wL
4flv8Q8MCg2POHOjQP5ElYGG6bNpTFuhIdYTu7GNTGccM5SnldoC7dCYxgeUKUWj/utuGs4v2PBp
J8aIqvP/LZQOrxufxyzGezFE96VxhjPZ0QZoJ8YIC0LHdO5q5+ziPMCS0tc06r8m+V2vVmrbtCNj
VCcAEMd2wenSt+tkt1varzHIqNvEbbcM5tG2NkN76ceUnV892tZMOi2HOGYfjnBdFX7jOXR434J2
YowMYX3Vyxcvq+rVz74AWtGujAFYAIwBmAHGAMwAYwBmgDEAM8AYgBlgDMAMMAZgQlPT/wHgbtxB
+HbHjAAAAABJRU5ErkJggg==
">

sql clr c# function to make rest api call

I am trying to write a SQL CLR C# function/store procedure to get data from an api server but I'm not getting proper results. Probably I never wrote and never done this. I have searched a lot and found the following code, but this returns data in a full page format where as I want only data in xml format so that I can process it in SQL Server. Also I am passing an url and username password which is Ok, how can I add more parameters to this?
//code
using System;
using System.Data;
using System.Data.SqlClient;
usig System.Data.SqlTypes;
using System.Collections;
using System.Globalization;
// For the SQL Server integration
using Microsoft.SqlServer.Server;
// Other things we need for WebRequest
using System.Net;
using System.Text;
using System.IO;
public partial class Functions
{
// Function to return a web URL as a string value.
[Microsoft.SqlServer.Server.SqlFunction(DataAccess = DataAccessKind.Read)]
public static SqlString GET(SqlString uri, SqlString username, SqlString passwd)
{
// The SqlPipe is how we send data back to the caller
SqlPipe pipe = SqlContext.Pipe;
SqlString document;
// Set up the request, including authentication
WebRequest req = WebRequest.Create(Convert.ToString(uri));
if (Convert.ToString(username) != null & Convert.ToString(username) != "")
{
req.Credentials = new NetworkCredential(Convert.ToString(username), Convert.ToString(passwd));
}
((HttpWebRequest)req).UserAgent = "CLR web client on SQL Server";
// Fire off the request and retrieve the response.
// We'll put the response in the string variable "document".
WebResponse resp = req.GetResponse();
Stream dataStream = resp.GetResponseStream();
StreamReader rdr = new StreamReader(dataStream);
document = (SqlString)rdr.ReadToEnd()
// Close up everything...
rdr.Close();
dataStream.Close();
resp.Close();
// .. and return the output to the caller.
return (document);
}
}
This code returns this result:
<html> <head><link rel="alternate" type="text/xml" href="/api.asmx?disco" /> <style type="text/css"> BODY { color: #000000; background-color: white; font-family: Verdana; margin-left: 0px; margin-top: 0px; } #content { margin-left: 30px; font-size: .70em; padding-bottom: 2em; } A:link { color: #336699; font-weight: bold; text-decoration: underline; } A:visited { color: #6699cc; font-weight: bold; text-decoration: underline; } A:active { color: #336699; font-weight: bold; text-decoration: underline; } A:hover { color: cc3300; font-weight: bold; text-decoration: underline; } P { color: #000000; margin-top: 0px; margin-bottom: 12px; font-family: Verdana; } pre { background-color: #e5e5cc; padding: 5px; font-family: Courier New; font-size: x-small; margin-top: -5px; border: 1px #f0f0e0 solid; } td { color: #000000; font-family: Verdana; font-size: .7em; } h2 { font-size: 1.5em; font-weight: bold; margin-top: 25px; margin-bottom: 10px; border-top: 1px solid #003366; margin-left: -15px; color: #003366; } h3 { font-size: 1.1em; color: #000000; margin-left: -15px; margin-top: 10px; margin-bottom: 10px; } ul { margin-top: 10px; margin-left: 20px; } ol { margin-top: 10px; margin-left: 20px; } li { margin-top: 10px; color: #000000; } font.value { color: darkblue; font: bold; } font.key { color: darkgreen; font: bold; } font.error { color: darkred; font: bold; } .heading1 { color: #ffffff; font-family: Tahoma; font-size: 26px; font-weight: normal; background-color: #003366; margin-top: 0px; margin-bottom: 0px; margin-left: -30px; padding-top: 10px; padding-bottom: 3px; padding-left: 15px; width: 105%; } .button { background-color: #dcdcdc; font-family: Verdana; font-size: 1em; border-top: #cccccc 1px solid; border-bottom: #666666 1px solid; border-left: #cccccc 1px solid; border-right: #666666 1px solid; } .frmheader { color: #000000; background: #dcdcdc; font-family: Verdana; font-size: .7em; font-weight: normal; border-bottom: 1px solid #dcdcdc; padding-top: 2px; padding-bottom: 2px; } .frmtext { font-family: Verdana; font-size: .7em; margin-top: 8px; margin-bottom: 0px; margin-left: 32px; } .frmInput { font-family: Verdana; font-size: 1em; } .intro { margin-left: -15px; } </style> <title> API Web Service </title></head> <body> <div id="content"> <p class="heading1">API</p><br> <span> <p class="intro">Click here for a complete list of operations.</p>

Display More then 10000 records in JqGrid

IN my Database table i have more then 30,000 records,here i am trying to Display these records in JqGrid,Here i displayed upto 900 records only, How can i display all records in JqGrid,here i am attaching my code.
<script type="text/javascript">
$(function () {
$("#dataGrid").jqGrid({
url: 'Default.aspx/GetDataFromDB',
datatype: 'json',
mtype: 'POST',
overflow:'visible',
serializeGridData: function (postData) {
return JSON.stringify(postData);
},
ajaxGridOptions: { contentType: "application/json" },
loadonce: true,
colNames: ['AOfficeKey', 'AChartNumber', 'APatientName', 'AVisit#'],
colModel: [
{ name: 'AOfficeKey', index: 'AOfficeKey', width: 80 },
{ name: 'AChartNumber', index: 'AChartNumber', width: 150 },
{ name: 'APatientName', index: 'APatientName', width: 160 },
{ name: 'AVisit#', index: 'AVisit#', width: 160 }
],
pager: '#pagingGrid',
rowNum: 100,
height: 300,
width:600,
rowList: [10, 100, 1000, 10000],
gridview: true,
viewrecords: true,
gridview: true,
jsonReader: {
page: function (obj) { return 1; },
total: function (obj) { return 1; },
records: function (obj) { return obj.d.length; },
root: function (obj) { return obj.d; },
repeatitems: false,
id: "0"
},
});
});
</script>
</head>
<body style="font-family: Arial; font-size: 10pt">
<table style="border: solid 1px ; width: 100%; vertical-align: central;">
<tr>
<td style="padding-left: 20px; padding-top: 20px; padding-bottom: 20px; font-family: 'Times New Roman'; font-weight: bold; font-size: 20pt; color: chocolate;">
</td>
</tr>
<tr>
<td style="text-align: center; vertical-align: central; padding: 100px;">
<table id="dataGrid" style="text-align: center; width: 100%;"></table>
<div id="pagingGrid"></div>
</td>
</tr>
</table>
C# code is
[WebMethod]
public static List<Dictionary<string, object>> GetDataFromDB()
{
DataTable dt = new DataTable();
using (SqlConnection con = new SqlConnection(#"Data Source=Abc;Database=Training;User Id=sa;Password=abc;"))
{
using (SqlCommand cmd = new SqlCommand("SELECT * AOfficeKey,AChartNumber, APatientName,AVisit# from adjs", con))
//("SELECT ID,Client,Location,Address FROM AClients ", con))
{
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();
Dictionary<string, object> row;
foreach (DataRow dr in dt.Rows)
{
row = new Dictionary<string, object>();
foreach (DataColumn col in dt.Columns)
{
row.Add(col.ColumnName, dr[col]);
}
rows.Add(row);
}
return rows;
}
}
}
I've tried your code and it works without error. However in order to load large data from server you will need to increase allowed JSON size when using json serialization. In order to do it past following code to your web.config in the <configuration> tag:
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="50000000"/>
</webServices>
</scripting>
</system.web.extensions>

Getting error in WCF JSON calls

no matter what i do , i am getting error in jQuery Ajax calls. Can you figure out what am I missing here?
Here is my Interface IShow
[ServiceContract]
public interface IShow
{
[OperationContract]
string getShow(int _showID);
}
Here is my Class
[DataContract]
public class Show
{
private string _title, _description;
private DateTime _showDate;
private int _showID;
[DataMember]
public string Title
{
get { return _title; }
set { _title = value; }
}
[DataMember]
public string Description
{
get { return _description; }
set { _description = value; }
}
[DataMember]
public DateTime ShowDate
{
get
{
return _showDate;
}
set { _showDate = value; }
}
[DataMember]
public int ShowID { get { return _showID; } set { _showID = value; } }
}
my Service called sShows.svc
[AspNetCompatibilityRequirements(
RequirementsMode
= AspNetCompatibilityRequirementsMode.Allowed)]
public class sShows : IShow
{
[WebInvoke(Method = "POST",
BodyStyle = WebMessageBodyStyle.WrappedRequest,
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json
)]
public string getShow(int _showID)
{
MySqlConnection Conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["CS1"].ConnectionString);
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = Conn;
cmd.CommandType = System.Data.CommandType.Text;
cmd.CommandText = " SELECT s.master_id, m.showname, m.showinfo, MIN(CONCAT(s.show_date, ' ', s.show_time)) AS first_show_date, MAX(CONCAT(s.show_date, ' ', s.show_time)) AS last_show_date FROM shows s LEFT OUTER JOIN master m ON s.master_id = m.master_id WHERE (s.wt_offsale = '') AND (s.master_id = #mid) GROUP BY s.master_id ORDER BY s.show_date, s.show_time";
cmd.Parameters.AddWithValue("#mid", _showID.ToString());
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
DataTable dt = new DataTable();
try
{
Conn.Open();
da.Fill(dt);
Show sh = null;
if (dt.Rows.Count > 0)
{
sh = new Show
{
Title = dt.Rows[0].ItemArray[1].ToString(),
Description = dt.Rows[0].ItemArray[2].ToString()
};
}
// return sh;
return JsonConvert.SerializeObject(sh, Formatting.Indented);
}
catch (Exception)
{
throw;
}
finally
{
Conn.Close();
dt.Dispose();
da.Dispose();
}
}
}
and finally this is my web.config (In the service project)
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="WebBehaviour">
<!--<enableWebScript/>-->
<webHttp defaultOutgoingResponseFormat="Json"/>
<!--<webHttp/>-->
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
this is my Ajax Call
jQuery.ajax({
type: "POST",
url: "http://localhost:10677/sShows.svc/Web/getShow",
data: "{_showID: 288}",
contentType: "application/json; charset=utf-8",
dataType: "json",
processData: true,
success: function (result) {
alert(result.d.Title);
},
error: function (result) {
alert(result.statusText);
console.log("Service = " + result.d);
}
});
No matter what i do, i am getting "Error" on the client as an alert. Can you please check what exactly the issue is ???
Thanks
UPDATE
Here is what i got from fiddler
OPTIONS http://localhost:10677/sShows.svc/Web/getShow HTTP/1.1
Host: localhost:10677
Connection: keep-alive
Access-Control-Request-Method: POST
Origin: http://localhost:2299
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36
Access-Control-Request-Headers: accept, content-type
Accept: */*
DNT: 1
Referer: http://localhost:2299/SimiArts/events.aspx
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,ur;q=0.6
HTTP/1.1 405 Method Not Allowed
Cache-Control: private
Allow: POST
Content-Length: 1565
Content-Type: text/html; charset=UTF-8
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcQXRoYXJBbmlzXERvY3VtZW50c1xNRUdBXFBQSCBKb2JzXFNoYXVuXFdjZlNlcnZpY2UxXHNTaG93cy5zdmNcV2ViXGdldFNob3c=?=
X-Powered-By: ASP.NET
Date: Tue, 08 Apr 2014 16:12:24 GMT
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Service</title>
<style>BODY { color: #000000; background-color: white; font-family: Verdana; margin-left: 0px; margin-top: 0px; } #content { margin-left: 30px; font-size: .70em; padding-bottom: 2em; } A:link { color: #336699; font-weight: bold; text-decoration: underline; } A:visited { color: #6699cc; font-weight: bold; text-decoration: underline; } A:active { color: #336699; font-weight: bold; text-decoration: underline; } .heading1 { background-color: #003366; border-bottom: #336699 6px solid; color: #ffffff; font-family: Tahoma; font-size: 26px; font-weight: normal;margin: 0em 0em 10px -20px; padding-bottom: 8px; padding-left: 30px;padding-top: 16px;} pre { font-size:small; background-color: #e5e5cc; padding: 5px; font-family: Courier New; margin-top: 0px; border: 1px #f0f0e0 solid; white-space: pre-wrap; white-space: -pre-wrap; word-wrap: break-word; } table { border-collapse: collapse; border-spacing: 0px; font-family: Verdana;} table th { border-right: 2px white solid; border-bottom: 2px white solid; font-weight: bold; background-color: #cecf9c;} table td { border-right: 2px white solid; border-bottom: 2px white solid; background-color: #e5e5cc;}</style>
</head>
<body>
<div id="content">
<p class="heading1">Service</p>
<p>Method not allowed.</p>
</div>
</body>
</html>
"{_showID: 288}" is not valid JSON. "{\"_showID\": 288}" is probably what you're looking for. Or, better, create a plain object and let jQuery do the JSON serialization.
data: { _showId: 288 },
The OPTIONS call is due to the cross-site scripting call. Make the web site and service on the same host and port, or use a JSONP callback like jQuery $.ajax(), $.post sending "OPTIONS" as REQUEST_METHOD in Firefox suggests.

Categories