|
I have a question about how to obtain the results from a web service
Basically I have received a C# console application code that calls a remote webservice and consumes the results. The console application runs by giving it commands to know what method in the web service to call.
Now I am going to write a C# 2010 service application that will call the C# 2008 console and run the commands in a specificed order.
Basically the steps would be:
1. write the new .net app to make callls in a sequential order to a console app progrm.
2. The console application calls the web service and obtains the results,
3. The new .net app obtains the results of the web service from the console application it called.
Let me know how I can accomplish my goal with code and/or references.
|
|
|
|
|
Why don't you directly consume the web service in the new application? That would be the easiest to do.
|
|
|
|
|
I do not want to change the console application that was written by the contract shop unless I need to for the following reasons:
1. There are alot of edits in the *.xsd that was written by the contract shop. I do not know how to tell how these edits are tied to the application. is there a way that I can tell how the edits are tied to the console application?
2. It is extremely hard to get ahold of the contract shop and to ask them questions. The customer that pays both of us, is in charge of how we communicate with this contract shop. There is alot of red tape to ask the contract shop any question.
|
|
|
|
|
How did you plan on sending "commands" to a console-app?
dcof wrote: Let me know how I can accomplish my goal with code and/or references.
Aight.. easiest way would be to have the "commands" in a separate text-file. Makes it easy to modify, and you can loop the lines easily after reading all text.
The loop could use a Console.ReadLine to get a command (read it from the file later), use a switch to see what should be done, print the results to the console.
What type of command? Can you give an example with three commands? Do they have parameters?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Right now I can entering the values in a command window and clicking on the command to execute the code. In the new .net application, I plan on running these commands based on the sequence of commands the application is setup to run.
The commands do have paramters. The parameters are the location of the webservice followed by the type of command that needs to be executed.
|
|
|
|
|
You have talked around this app several times over the last few days. It's obvious that you can't do what you're trying to do, which should tell you that your architecture is wrong. Why aren't you directly consuming the service?
|
|
|
|
|
You should consume the Service directly or the "app" should be an API instead. In fact, why not explore the contents of the "app" to see what public methods are available.
Or see if this ProcessCommunicator[^] will help.
modified 2-Sep-12 12:37pm.
|
|
|
|
|
Can you explain why I would want to do the process communication? I do not currently understand how this would help me.
|
|
|
|
|
dcof wrote: Basically I have received a C# console application code that calls a remote webservice and consumes the results.
If and only if this really is a console application then the following is true.
- Input is ONLY via files and/or stdin.
- Output is ONLY via files and/or stdout/stderr.
If that is true then you write a management control API using System.Diagnostics.Process.
That class specifically provides the following functionality.
- A way to start/stop/manage an application (any application)
- Access to stdin/stdout/stderr
You can google for example on how to use Process however the specifics of writing your API depends on you understanding how the console app works.
If you application is not in fact an actual console application, then if it was me, I would look at AutoIt. There are probably others like this but I have had success with this tool a number of times so I look to it first.
http://www.autoitscript.com/site/[^]
|
|
|
|
|
The following is true about the console application:
- Input is ONLY via files and/or stdin.
- Output is ONLY via files and/or stdout/stderr.
When I run a command it always starts with 'start' statement followed by the execution path and a couple of parameter values.
This can you tell me and/or point me to a reference on using the 'process' as you stated in your last response. Is there a way that I can use the process class as part of my way of calling the console application? If so, how would I call the console application using the process class?
|
|
|
|
|
dcof wrote: Is there a way that I can use the process class as part of my way of calling
the console application?
Probably.
dcof wrote: how would I call the console application using the process class?
Read the documentation. Give it the path to the executable and any parameters. You can redirect the input and output streams as necessary.
|
|
|
|
|
|
Hi Can you help on those queries which is provided on the blog. www.dotnet-discussion.blogspot.com
Thanks
Sudha
|
|
|
|
|
Repost of same question you asked two questions before this one in this forum ?
"If you shoot at mimes, should you use a silencer ?" Stephen Wright
|
|
|
|
|
Guys i wanna find tan^-1(0.666666667) which is equals to 33.69 degres.....
But when i use the Atan(0.66666667) i get 0.588...
Now i wanna knwo what is it that i'm doing wrong here... or the method is not doing what is meant to do?..
Thanks in advance
modified 2-Sep-12 3:35am.
|
|
|
|
|
|
|
Read the documentation on the functions next time. It's in documented that these functions operate on Radians, not Degrees. The conversion between the two is easy though.
|
|
|
|
|
Hi Can you help on those queries which is provided on the blog. www.dotnet-discussion.blogspot.com
Thanks
Sudha
|
|
|
|
|
Hi Can you help on those queries which is provided on the blog. www.dotnet-discussion.blogspot.com
Thanks
Sudha
|
|
|
|
|
No.
If you have a question, then post it here on Code Project. Don't try to drive traffic to other sites.
|
|
|
|
|
No. I'm not going to help someone on another site and who hyjaks someone elses thread.
|
|
|
|
|
I need to know how to map fields coming from a stored procedure to output fields on a crystal report. Any feedback is greatly appreciated. The output that I'm getting on the report is the name of the fields instead of the values coming from the database.
Also, If at least someonce can tell me how to assign the database value on the .xsd Default Value, that'd help. Right now if I type "TEST" on the .xsd Default Value property (hardcoded), it gets displayed on the report. I need to be able to set that value with the one coming from my database.
The code is based on this sample:
http:
Here's my code:
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web.Configuration;
namespace project
{
public partial class check : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument rptCheck = new ReportDocument();
dsCheck ds = new dsCheck(); // .xsd file name
DataTable dt = new DataTable();
// Just set the name of data table
dt.TableName = "Crystal Report Checks";
dt = getChecks(); //This function is located below this function
ds.Tables[0].Merge(dt);
// Your .rpt file path will be below
rptCheck.Load(Server.MapPath("checkprt.rpt"));
//set dataset to the report viewer.
CrystalReportViewer1.ReportSource = rptCheck;
}
public DataTable getChecks()
{
string sqlCon = WebConfigurationManager.ConnectionStrings["hello"].ConnectionString;
SqlConnection Con = new SqlConnection(sqlCon);
SqlCommand cmd = new SqlCommand();
DataSet ds = null;
SqlDataAdapter adapter;
try
{
Con.Open();
//Stored procedure calling. It is already in sample db.
cmd.CommandText = "spGetData";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Date", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output;
cmd.Parameters.Add("@Name", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output;
cmd.Parameters.Add("@Amount", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output;
cmd.Parameters.Add("@AccountID", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output;
cmd.Connection = Con;
ds = new DataSet();
adapter = new SqlDataAdapter(cmd);
adapter.Fill(ds);
//get output param list
string Count1 = cmd.Parameters["@Date"].Value.ToString();
string Count2 = cmd.Parameters["@Name"].Value.ToString();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
cmd.Dispose();
if (Con.State != ConnectionState.Closed)
Con.Close();
}
return ds.Tables[0];
}
}
}
|
|
|
|
|
Have you looked at the tutorials, this is SSRS 101 and is a well documented [^]area.
Also look into embedded (local)[^] reports these are suffixed with RDLC
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
No I haven't. I'm my wondering if my issue is related to mapping the xsd fields to the database. Do I have to do that? or the data that is coming from my stored procedure is good enough? If so, the question here is...how do I get that data to the output fields on the crystal report?
|
|
|
|