getSeed requires a parameter of type getSeedRequest, and returns a getSeedResponse object.
Testing this in a console app:
CrSeedClient client = new CrSeedClient();
getSeedRequest req = new getSeedRequest();
getSeedResponse resp = client.getSeed(req);
runs OK but still returns null in resp. If I omit the getSeedRequest parameter it won't compile.
However, if I run the above code with Fiddler listening in, then I can see the response received does actually contain XML, and is not null. Not entirely sure what's happening here but I suspect there's no implementation of getSeedRequest.ToString() so it returns nothing. As a workaround, the following seems to work fine:
staticvoid Main(string args)
WebRequest webreq = WebRequest.Create("https://palena.sii.cl/DTEWS/CrSeed.jws?WSDL");
webreq.Method = "POST";
byte bData = Encoding.ASCII.GetBytes("<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><q1:getSeed xmlns:q1=\"http://DefaultNamespace\"/></s:Body></s:Envelope>");
webreq.GetRequestStream().Write(bData, 0, bData.Length);
WebResponse webresp = webreq.GetResponse();
XmlDocument doc = new XmlDocument();
Suppose your API takes a ID and then it returns a JSON response with that the ID in it.
Ex: Get: http:/example.com/id="12345";
Is it possible to validate 100s of different APIs and their responses if they all contain the same parameter and its value you passed in the response, this could be any datatype and any attribute and check if response contains that. but they all are different.. and make it generic??
Those "100s of APIs", are they developed in-house? Do you have access to their source code?
Could you give us a clue to why and how the solution you are searching should be applied to literally hundreds of APIs - are you (or your employer) actually developing (implementations for) hundreds of APIs that should use the same validation?
In these hundreds of APIs, could you give some hint to what kind of datatypes and attributes you will find?
Would it be an option to return to your superior and say: "I am convinced that it is a poor idea to make one super-general validation function for every possible data type and attribute in several hundred APIs. I suggest that we don't do that!" ?
... Noone here believes that your problem statement comes from a real-world software developments project. It shines bright and clear that this is an exercize given at a college or other educational institution.
So be honest with it: The professor has given us this assignment, and I here is what I have written to return the attribute name ("id") and value ("12345"): [...]. But he wants it to valid for "any datatype" - I don't understand what he means typ that; it comes as a string from the URL. How can it come as some other datatype?"
That would be a valid question that might generate responses. But the way you have presented it, it sounds more like: "I am too busy to do this homework assignment right now, so could someone please provide something for me to hand in?"
If you really are as totally blank as it seems, tell us. Indicate whichever pieces you have understood, if ever so small, and we could try to work it out from there. But be warned that you can only expect to get help to understand things enough to do the homework yourself. You won't get help so that you don't have to do it yourself.
Is it possible to validate 100s of different APIs and their responses if they all contain the same parameter and its value you passed in the response, this could be any datatype and any attribute and check if response contains that.
Member 14779968 wrote:
but they all are different.. and make it generic??
They'd have to provide additional info; nothing you can do to make it generic.
You can't be sure, unless they give you a validation method. (Not to be confused with a programming method).
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
The "id" is a "key", the "12345" is a value. Which is the equivalent of a dictionary entry in a "dictionary" collection. In this case, it would be of generic type Dictionaty<string,string> which can be used to valid any "attribute / value" pair. You may need a separate dictionary for each API; a dictionary of dictionaries: Dictionary<string,dictionary<string,string>>. Duplicate API dictionaries are simply references to other dictionaries.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food