|
Thank you for the clarification.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
I have created proxy services by add web reference in my Xamarin.Droid project to access asmx webservice.
Eg: I have a webservice for feature master
when I make a direct request with URL "http://XX.XX.XXX.XXX/tabsaleswithdatasync.asmx/FeatureMaster"
I am getting following info
[{"msg":"","FeatureSlno":"2","Feature":"Fuel Used","DefaultValue":"","FeatureType":"B","Groups":"OverView","GroupOrder":"0","SubGroupOrder":"0","CategorySlno":"2","UtilisationSlno":"1","IconImagePath":"","LowerIsBetter":"0"},{"msg":"","FeatureSlno":"3","Feature":"Seating Capacity","DefaultValue":"","FeatureType":"B","Groups":"OverView","GroupOrder":"0","SubGroupOrder":"0","CategorySlno":"3","UtilisationSlno":"0","IconImagePath":"","LowerIsBetter":"0"}]
I have written my method to get data
EngageWebReference.TabSalesWithDataSync objProxy = new EngageWebReference.TabSalesWithDataSync();
objProxy.FeatureMasterCompleted += ObjProxy_FeatureMasterCompleted;
objProxy.FeatureMasterAsync();
private void ObjProxy_CityMasterCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
{
// here I am getting XMLException as data at the root level is invalid. line 1 position 1.
throw new NotImplementedException();
}
Can anyone suggest how to make async call get the desired result into a variable eg:
List<featuremaster> res = new List<featuremaster>
res = GetFeatureMasterList();
|
|
|
|
|
Yeah...just a guess but your error is most likely related to the data being in JSON rather than XML.
Try parsing with Newtonsoft, or pass an "Accept: application/xml" header.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Thank you!!
Do you mean I have to make change in Webservice ??
|
|
|
|
|
Deserialize the result from the webservice to a .Net class:
Newtonsoft.Json.JsonConvert.DeserializeObject
It's a Nuget package you add to your project to get the dll references.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
What Gerry said.
Alternatively the agent you're using to make the request (such as HttpClient) can be configured to send custom accept headers, and if the web service supports it you can request the data in XML form instead, which was the second part of my suggestion.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
As I am using ASMX I think I cant configure to return XML. I have JSON data returning. Is there any possibilities to consume JSON from webservice with an Async call.
I am new to C# and Xamarin.
|
|
|
|
|
Yes, as I said and Gerry clarified. If you need help with the nuts and bolts we can provide that, but with the information you've given we don't even know how you're consuming the service, let alone any implementation details.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Thank you,
I was trying to consume ASMX web service as instructed in Xamarin ASMX
Consuming an ASP.NET Web Service (ASMX) - Xamarin[^]
I could make out the expected output was not as per the standards are given SOAP 1.1. So I have to modify the ASMX service
Thank you again
|
|
|
|
|
Hello All,
I am new to the language of C#. I am try to create a url
public void button1_Click(object sender, EventArgs e)
{
string myip = textBox1.Text;
string password = textBox2.Text;
string username = textBox3.Text;
string at = "@";
string mystring = "http://" + at + username + password + myip + "/command.htm?key= ";
Process.Start(mystring);
The result of clicking the button is below in my browser:
http:
How can I get the @ sign to show up in the url in the browser?
Any help would be greatly appreciated.
Kind
|
|
|
|
|
Um.
I think you need to rethink that one. "adminpassword192.168.123.123" probably isn't a valid domain (unless you buy a whole load of domains), and '@' is not a valid character in a domain name anyway.
What are you trying to achieve? Not "what are you trying to do?" but what are you doing that you think you need this?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
You are adding the at sign in the wrong place, and also missing the colon between the username and password. Make life easier for yourself by using the built in UriBuilder Class (System)[^] which will format the final URL string correctly. You also need to be aware that not all websites allow this form of authorisation; you may need to use HTTP authorisation parameters.
|
|
|
|
|
You used to be able to pass the username and password in the URL by using:
http://username:password@host/
However, this was an extremely bad idea.
Microsoft removed support for this from Internet Explorer 6 back in 2004:
Microsoft Security Bulletin MS04-004 - Critical[^]
Internet Explorer does not support user names and passwords in Web site addresses (HTTP or HTTPS URLs)[^]
Firefox still supports it, but displays a warning message:
Network.http.phishy-userpass-length - MozillaZine Knowledge Base[^]
Chrome tried to deprecate the feature back in 2012, but it looks like they were forced to turn it back on:
123150 - Chrome 19 doesn't respect basic auth details embedded in the URL - chromium - Monorail[^]
Behaviour in other browsers will vary. You can test your browser with the following URL:
https://foo:bar@httpbin.org/basic-auth/foo/bar[^]
Also, your code isn't building the correct URL. Your need:
string mystring = "http://" + username + ":" + password + "@" + myip + "/command.htm?key=";
string mystring = string.Format("http://{0}:{1}@{2}/command.htm?key=", username, password, myip);
string mystring = $"http://{username}:{password}@{myip}/command.htm?key=";
Alternatively, use the UriBuilder class[^]:
UriBuilder builder = new UriBuilder();
builder.UserName = username;
builder.Password = password;
builder.Host = myip;
builder.Path = "/command.htm";
builder.Query = "key=";
string mystring = builder.ToString();
But, as I said, the result of opening that URL will depend on your default browser.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello ,
I have a situation where I need to jump to a specific location from tab 1 to tab 2's certain section. Here is the sample of my code.
<pre>@{
<div id="tabs-1"><fieldset class="vs"><legend>tab1</legend>
<a href="mypage/#tabs-2">click me 1</a>
<p>click me 2</p>
</fieldset></div>
<div id="tabs-2">
<fieldset class="vs"><legend>tab2</legend>
<p>test1 description</p>
<ul>
<li>This is a test 1.</li>
</ul>
<p>test2 description</p>
<ul>
<li>This is a test 2.</li>
</ul>
<p>test3 description</p>
<ul>
<li>This is a test 3.</li>
</ul>
<p>test4 description</p>
<ul>
<li>This is a test 4.</li>
</ul>
<p>test5 description</p>
<ul>
<li>This is a test 5.</li>
</ul>
<p>test6 description</p>
<ul>
<li>This is a test 6.</li>
</ul>
<p>test7 description</p>
<ul>
<li>This is a test 7.</li>
</ul>
<p>test8 description</p>
<ul>
<li>This is a test 8.</li>
</ul>
<p>test9 description</p>
<ul>
<li>This is a test 9.</li>
</ul>
<p>test10 description</p>
<ul>
<li>This is a test 10.</li>
</ul>
<p>test11 description</p>
<ul>
<li>This is a test 11.</li>
</ul>
<p>test12 description</p>
<ul>
<li>This is a test 12.</li>
</ul>
<p>test13 description</p>
<ul>
<li>This is a test 13.</li>
</ul>
<p>test14 description</p>
<ul>
<li>This is a test 14.</li>
</ul>
</fieldset>
</div>
}
Now how do i click "Click me 1" and go to the "tabs-2" and scroll down to "test14 description"?
Please help.
Thank you
Dhyanga
modified 13-Feb-17 13:21pm.
|
|
|
|
|
You'll need to add an id to any element that you want to be a navigation target.
<p id="test14">test14 description</p>
You then specify that ID in the URL:
<a href="mypage/#test14">click me 1</a>
How you ensure that tabs-2 will be visible when you navigate to an item within the tab depends the script / CSS you're using to create the tabs. For example, with Bootstrap, something like this should work:
$(function(){
$("#tabs").tab();
if (location.hash){
var target = $(":target");
if (!target.is(".tab-pane")){
target = target.closest(".tab-pane");
}
if (target.is(".tab-pane")){
$("#tabs").one("shown.bs.tab", function(){
$("html, body").animate({
scrollTop: $(":target").offset().top
}, "fast");
});
var id = target.prop("id");
$("a[data-toggle='tab'][href='#" + id + "']").tab("show");
}
}
});
NB: This question has nothing to do with C#. In future, please post in the correct forum.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Guys,
I need help to write application to constantly check and read xml data saved in specific folder on network and extract data to sql database.
|
|
|
|
|
So, what have you written so far? We don't know what you have done, or what errors your code has encountered, or even what you are stuck on. All you have done is tell us what your application should do.
This space for rent
|
|
|
|
|

import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class Dom
{
public static void main (String[] args)
{
String badnumber = "MPP";
int badnumberconverted;
try {
badnumberconverted = Integer.parseInt(badnumber);
}catch (NumberFormatException nfEx){
}
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse("repeat.xml");
NodeList sampleIDs = doc.getElementsByTagName("Elements");
for(int i=0;i<sampleIDs.getLength();i++){
Node p = sampleIDs.item(i);
if(p.getNodeType() == Node.ELEMENT_NODE){
Element Elements = (Element) p;
String id = Elements.getAttribute("id");
NodeList nameList = Elements.getChildNodes();
for(int j=0;j<nameList.getLength();j++){
Node n = nameList.item(j);
if(n.getNodeType() == Node.ELEMENT_NODE){
Element name = (Element) n;
System.out.println("Elements" + id + ":" + name.getTagName()+ "=" + name.getTextContent());
}
}
}
}
}
catch (ParserConfigurationException e){
e.printStackTrace();
}
catch (SAXException e)
{
e.printStackTrace();
}
catch (IOException e){
e.printStackTrace();
}
}
public static String convert(String val)
{
double d = Double.parseDouble(val);
d = d/1000000;
return Double.toString(d);
}
}
|
|
|
|
|
Hi Peter,
This is what i have done so far. can only read xml data.
|
|
|
|
|
This is the C# forum. That code is Java.
This space for rent
|
|
|
|
|
please don't cross-post - you posted this in java - pick the best forum, stick to it, even if it's not 100%
btw - in c#, you can use 'TopShelf' as the basis for a Service - this might be worthwhile looking at NuGet Gallery | Topshelf.FileSystemWatcher 1.0.0.17
|
|
|
|
|
Suppose a data table can access 2003 such as fields execel file attachments, I want to query the warehouse group by name, bar code, goods, inventory, and then type the serial number, the results of its attachments write queries like? Attachments: http://www.mediafire.com/file/lv73f1usj5yqdk2/STTen.xls
|
|
|
|
|
You seem to have mistaken this for the Database forum. It's not - this is for C# questions. Please address your database questions in the right location.
This space for rent
|
|
|
|
|
I want to design the simply software that can convert the pdf files to the word files.
I use third part softwares to support my code. Third part software is sautinSoft.Pdffocus.
When I running my program, I find out a problem that can't convert the all of essay in pdf files to word files.
Can you tell me why I can't convert the all of essay in pdf files to word files? I have tried to check my program, but I can't find out any bugs in my program. I think it is very easy and simply function.
private void TransferFile(object sender, EventArgs e)
{
try
{
if (FileName.Text != "")
{
//PDFtoWord(FilePathFullName.Text, "Test");
SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
f.OpenPdf(@"C:\Users\DavidLin\Downloads\db-fund.pdf");
f.ToWord(@"C:\Users\DavidLin\Downloads\test.doc");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
MessageBox.Show("Finally");
}
|
|
|
|
|
Member 12757695 wrote: Can you tell me why I can't convert the all of essay in pdf files to word files?
No, we can't. We simply don't have access to your system, or to the PDF files you are attempting to convert. So even if we wanted to, we couldn't run that code and get the same results you do - which means we can't tell you "do this and it'll fix it".
What I'd suggest is that you start with the authors of your conversion software: SDK to convert PDF to Word, DOCX, RTF, HTML, Excel, Text, XML, Images TIFF for C# and VB.Net[^] - it's a paid for package, so they should provide technical support and will know a lot more about their system than we will. Or possibly, the trial is limited in it's functionality, and you have hit that limit. In which case, you need to buy it to continue using it!
We can't tell - we just can't run your code under the same conditions you can.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|