|
I have the additional comments/questions to ask:
1 When I call the web service and ask for a document, the web service places the document in a directory path that I specify in an app.config file for the console application I just started to write. I always receive the file in a PDF format and not in a word document format. Thus if I want to convert the PDF file to a word document, I probably need to do the conversation after I rewceive the file, correct? If I am wrong, how would I accomplish this goal?
2. when I call the web service and from a command dos prompt, I have been directing the output to a text file for now. However the output I receive is the command I wrote plus the xsd file response. I know that I will need obtain the response in another way besides redirecting the output to a text file. Thus can you tell me how I can save the xsd file format reponse? In addition, can you tell me how I can determine how to parse the xsd results so I can obtain the data I am looking for?
|
|
|
|
|
1) I don't know what the web service is capable of, so I suppose if you want the PDF as a word doc, then you'll have to convert it.
2) I'm not sure what you're doing, but it doesn't sound like you're calling the service via a proxy class. If you're doing something custom, I can't help you. Though, I am pretty sure an XSD isn't supposed to contain actual data... just shows the format of what data can be returned.
|
|
|
|
|
If you have the data contract (the xsd file), you can generate the code that you need for the data types using this[^] product. However, from the xsd, you don't get the operations that can be performed, you merely get the data structures. You are going to need to write the code to interact with the operations yourself.
classy_dog wrote: 1. How to connect a C# console, desktop, and/or web app to the web service?
WSCF.blue will give you the ability to generate the service reference code.
classy_dog wrote: 2. How can I obtain the xsd file from the web service and transverse the xsd
file to obtain the data I am looking for?
You already have the xsd file. You just said so.
classy_dog wrote: 3. How can I download the word document, pdf, and/or tiff file from the web
service?
You don't. You get whatever representation of these that the service returns (possibly a base 64 encoded string) and convert that at your end and save to disk.
|
|
|
|
|
classy_dog wrote: need to obtain the list of customer ids by working with an .xsd file
The xsd is a definition of what the xml will look like. Thus you don't get the ids from an xsd source.
|
|
|
|
|
Hi
Has anyone tried to access Comupter Associates ( CA) TOP-SECRET thru LDAP in C# code. If yes please respond as I would like to get some specific info to do the resource permissions checks.
Thanks, Ravi
|
|
|
|
|
Considering the verticle nature of your request, more than likely not.
The best place to ask about using a particular library or product is the manufacturer of the library or product.
|
|
|
|
|
I'm having a tough time converting month, day, and year into hex then byte[]. I did an internet search and I'm not finding anything that is similar enough to provide the link to. This is what I have so far from before I realized I needed the hex, but I do need the 2-digit mo/day/yr before it's hex. I'm a little confused about converting to hex since I would normally take the number and use ToString("X"), but it doesn't seem to apply here since I'm applying the formatting to get it to the 2-digit month, for example.
DateTime mfg = DateTime.Now;
mfgDate_mo = new byte[mfg.ToString("MM").Length * sizeof(char)];
convertStringToByteArr(mfg.ToString("MM"), ref mfgDate_mo);
mfgDate_dy = new byte[mfg.ToString("dd").Length * sizeof(char)];
convertStringToByteArr(mfg.ToString("dd"), ref mfgDate_dy);
mfgDate_yr = new byte[mfg.ToString("yy").Length * sizeof(char)];
convertStringToByteArr(mfg.ToString("yy"), ref mfgDate_yr);
private void convertStringToByteArr(String theString, ref byte[] theByteArr)
{
System.Buffer.BlockCopy(theString.ToCharArray(), 0, theByteArr, 0, theByteArr.Length);
}
|
|
|
|
|
I'm sorry, but your description doesn't make much sense to me. I've read it a couple of times and I can't visualise what you are trying to do. Given an input of todays date, what are you expecting to see in the byte array? If you could illustrate this, then perhaps I can help.
|
|
|
|
|
For example, today's date is 8/20/2012. I need to take the 8, represent it as 08, convert it to Hex which is still 08 for that one, then put it in a byte array. For the year, I need to take the 12, which is already 2 digits, then convert to hex, which is 0C, then put it in byte array.
|
|
|
|
|
So just use the following to convert:
private byte[] Convert(int datePart)
{
string convertedPart = datePart.ToString("X2");
System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
return enc.GetBytes(convertedPart);
}
|
|
|
|
|
Thanks! I'll give it a try. It seems like it will work with adding a conversion from DateTime to integer.
int mfgDate_mo_int = mfg.Month;
|
|
|
|
|
Why don't you just do binary serialization to a byte array? It'll be a little bigger then what you are doing because of the meta data, but if you want it really light weight, I don't really get the hex step. Just store the month, day and year?? Also, don't store just the 2 digit yr or you'll have Y2K issues.
|
|
|
|
|
I have to convert to hex and do 2-digits because of system requirements.
|
|
|
|
|
Are the requirements fixed? A DateTime is really a long internally (Ticks), which of course can be stored in/retrieved from 8 bytes very easily.
|
|
|
|
|
Yes, the requirements are fixed. This is related to a chip layout that a contractor designed years ago. Thanks for the suggestions, though!
|
|
|
|
|
No problem. Did you get it working?
|
|
|
|
|
Yes. I still have to try writing the data to the chip to test it, but hopefully all is good (encoding) when I do.
|
|
|
|
|
Hello,
I wanted to use a (flag) enum as index to access the single flag values.
Instead of
<CheckBox IsChecked="{Binding Obj[1]}" ...
I hoped that I could use something like
<CheckBox IsChecked="{Binding Obj[TestEnum.Enum1]}" ...
with some helper object providing an index operator. The first works, the second does not...
Additionally: Can I use an expression (for example an extension method
TestEnum.Enum1.DoSomething()
(which returns a different enum item of the same type) instead of the enum item name for the Binding?
Alex
|
|
|
|
|
Alex, in order to use an enum, you actually need to provide some instance information to WPF for it to be able to "understand" it. To do that, you need to set up an ObjectDataSource that binds in the enum. There's an example here[^] that shows how to do this.
You might also want to look at this[^] handy article.
BTW - you really should have asked this in the WPF forum. This has nothing to do with C#.
|
|
|
|
|
Sorry, I missed that there is an WPF forum (hidden behind Silverlight...).
Indeed, the samples shown in your links do it the other way round - get the string from the enum value. I needed the value from the string.
My error was simply to use the full name
"{Binding Obj[TestEnum.Enum1]}"
instead of simply
"{Binding Obj[Enum1]}"
The latter works now.
Alex
|
|
|
|
|
I'm glad you've got it working.
|
|
|
|
|
And for the expression
{Binding Obj[Enum1.DoSomething()]}
I found a simple workaround for my case.
I simply use multiple properties:
{Binding ObjDoSomething[Enum1]}
{Binding ObjDoSomethingElse[Enum1]}
which internally call the extension method.
Alex
|
|
|
|
|
I dunno anything about WPF, but to answer the question; yes to all. To answer the questions in reverse order;
LionAM wrote:
Additionally: Can I use an expression (for example an extension method
TestEnum.Enum1.DoSomething()
Yes, see example-code below (tested under Mono);
public enum TestEnum: int
{
Enum1 = 3,
EnumZwei = 9
}
public static class MyExt
{
public static TestEnum DoSomething(this TestEnum e)
{
return TestEnum.EnumZwei;
}
}
class Program
{
public static void Main (string[] args)
{
Console.WriteLine(TestEnum.Enum1.DoSomething());
}
}
LionAM wrote: I hoped that I could use something like
<CheckBox IsChecked="{Binding Obj[TestEnum.Enum1]}" ...
with some helper object providing an index operator. The first works, the second does not...
With a little helper you can. Add the method below;
public static class MyExt
{
public static string Parse(this string SomeString)
{
foreach (var enumVal in Enum.GetValues(typeof(TestEnum)))
{
string enumValAsString = String.Format("{0}.{1}",
enumVal.GetType().Name, enumVal);
int enumValAsInt = (int)enumVal;
if (SomeString.Contains(enumValAsString))
{
SomeString = SomeString.Replace(enumValAsString, enumValAsInt.ToString());
}
}
return SomeString;
}
}
class Program
{
public static void Main (string[] args)
{
string s = "{Binding Obj[TestEnum.Enum1]}";
Console.WriteLine(s);
Console.WriteLine(s.Parse());
}
}
Enjoy
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Thank you for your answer.
However, I have to admit that the C# forum was the wrong forum to ask my question. The Binding expression is not used within C# code but within a (static) .xaml file - although it should in principle be possible to assign the Binding string dynamically, I would avoid it for coding style reasons.
Alex
|
|
|
|
|
You're welcome
|
|
|
|