Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9268087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:43:09+00:00 2026-06-18T14:43:09+00:00

i need to call a web service without use webreference created with visual studio,

  • 0

i need to call a web service without use webreference created with visual studio, i have to use
http web request i have the soap request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pos="http://posting.ws.rpg.snamretegas.it/">
   <soapenv:Header/>
      <soapenv:Body>
         <pos:postAllReports>

            <report_name>REPORT_SWITCH</report_name>

            <report_date></report_date>

            <i_ambiente>ITG1</i_ambiente>

            <i_taxidOpco>TEST_YF1</i_taxidOpco>
         </pos:postAllReports>
      </soapenv:Body>
   </soapenv:Envelope>

this is the code behind asp page:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.OracleClient;


public partial class PubreportControl : System.Web.UI.Page 
{   
   private DB_Utility dbu;
   protected double size = 1;
   private string connectionString;
   private OracleConnection connection;
   private OracleCommand processNumQuery;
   private int indexdropitem;
   private int coloreriga = 1;

   protected void Page_Load(object sender, EventArgs e)
   {


    if (!IsPostBack)
    {
        Session["CONNECTSTRING"] = Request["CONNECTSTRING"];

        if (Session["CONNECTSTRING"] == null)
        {
            Response.Redirect("sessionup.asp?type=Pubreport");
        }

        connectionString = Session["CONNECTSTRING"].ToString();

        if (connectionString.IndexOf("DSN=") >= 0)
        {
            Comuni.Utility util = new Utility();
            connectionString = util.ConnStr(connectionString);
            Session["CONNECTSTRING"] = connectionString;
        }
        connection = new OracleConnection(connectionString);
        connection.Open();
        dbu = new DB_Utility(Session["CONNECTSTRING"].ToString());

    }
    else
    {
        connectionString = Session["CONNECTSTRING"].ToString();
        if (connectionString.IndexOf("DSN=") >= 0)
        {
            Comuni.Utility util = new Utility();
            connectionString = util.ConnStr(connectionString);
            Session["CONNECTSTRING"] = connectionString;
        }
        connection = new OracleConnection(connectionString);
        connection.Open();
        dbu = new DB_Utility(Session["CONNECTSTRING"].ToString());
    }

    if (!IsPostBack)
    {
            processNumQuery = new OracleCommand("select distinct nome_report from rpg_notification",connection);
            OracleDataReader reader = processNumQuery.ExecuteReader();

            while (reader.Read())
            {
                dropdownlist1.Items.Insert(0, new ListItem(reader.GetString(0), reader.GetString(0)));
            }
            reader.Close();

    }
    if(Request["txtSchedDate"] == null)
    {
         DateTime daDate = DateTime.Today;
         txtSchedDate.Text = daDate.ToString("dd/MM/yyyy");
    }
    else
    {
         txtSchedDate.Text = Request["txtSchedDate"];
         gwreportpub.DataSource = getDatiFromDb();
         gwreportpub.DataBind();


        DateTime schedDate = Convert.ToDateTime(Request["txtSchedDate"]);
        string reportname = dropdownlist1.SelectedItem.Text; 
        object[] WSMethodArguments = new object[3];
        WSMethodArguments[0] = reportname;
        WSMethodArguments[1] = schedDate.ToUniversalTime().ToString("s");
        WSMethodArguments[2] = "ITG1";
        PageAsyncTask task = new PageAsyncTask(
        new BeginEventHandler(BeginAsyncOperation),
        new EndEventHandler(EndAsyncOperation),
        new EndEventHandler(TimeoutAsyncOperation),
        WSMethodArguments
        );
        RegisterAsyncTask(task);
    }

   }


   protected void Button1_Click(object sender, EventArgs e)
   {

    //Response.Write("ciao " + dropdownlist1.SelectedIndex + " - " + dropdownlist1.SelectedItem.Text + " - " + dropdownlist1.Items[dropdownlist1.SelectedIndex].Text + " - " + Request["txtSchedDate"] + " - ");

    //ThreadPool.QueueUserWorkItem(new WaitCallback(callWebService),new object[] {"http://172.19.241.235:9001/snam-rpg-ws/ReportPosting","ReportPosting","postAllReports",WSMethodArguments});  

    gwreportpub.DataSource = getDatiFromDb();
    gwreportpub.DataBind();
    gwreportpub.Visible = true;
    if (gwreportpub.Rows.Count == 0)
    {   
            tbnotif.Text = "Non vi sono report pubblicati";
            tbnotif.Visible = true;
    }
    else{
        tbnotif.Visible = true;
        tbnotif.Text = "Tabella dei Report Pubblicati: ";
    }
    return;


   }
   void TimeoutAsyncOperation(IAsyncResult ar)
   {
    Response.Write("Pubblicazione Timeout");
   }
   IAsyncResult BeginAsyncOperation (object sender, EventArgs e, 
    AsyncCallback cb, object state)
    {

    object[] array = state as object[];

    HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(@"http://172.19.241.235:9001/snam-rpg-ws/ReportPosting"); 
    webRequest.Headers.Add(@"SOAP:Action"); 
    webRequest.ContentType = "text/xml;charset=\"utf-8\""; 
    webRequest.Accept = "text/xml"; 
    webRequest.Method = "POST"; 

    HttpWebRequest request = webRequest;
    XmlDocument soapEnvelopeXml = new XmlDocument();
    soapEnvelopeXml.LoadXml("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:pos=\"http://posting.ws.rpg.snamretegas.it/\"><soapenv:Header/><soapenv:Body><pos:postAllReports><report_name> " + array[0] +" </report_name> <report_date> " + array[1] + "</report_date> <i_ambiente> " + array[2] + "</i_ambiente> <i_taxidOpco></i_taxidOpco></pos:postAllReports></soapenv:Body></soapenv:Envelope>");

    using (Stream stream = request.GetRequestStream()) 
    { 
        soapEnvelopeXml.Save(stream); 
    }

    using (WebResponse response = request.GetResponse())
    {
        using (StreamReader rd = new StreamReader(response.GetResponseStream())) 
        { 
            string soapResult = rd.ReadToEnd();

        } 
    }

    SampleMethodCaller smd = new SampleMethodCaller(SampleClass.SampleMethod);
    IAsyncResult result = smd.BeginInvoke(null, null);
    return result;
    //return callWebService(new object[] {"http://172.19.241.235:9001/snam-rpg-ws/ReportPosting","ReportPosting","postAllReports",state});

}
public delegate bool SampleMethodCaller();

void EndAsyncOperation(IAsyncResult ar)
{
    Response.Write("Pubblicazione Terminata");
}

protected void Page_PreRenderComplete(object sender, EventArgs e)
{

}

   public DataSet getDatiFromDb()
   {
        OracleDataAdapter adapter = new OracleDataAdapter();
        OracleCommand orclc = new OracleCommand("select pubblicato, nome_report, data_report, md5 from rpg_notification where pubblicato = :flag and data_report <= TO_DATE(:repdate,'DD/MM/YYYY') and nome_report = :nome",this.connection);
        orclc.Parameters.Add(new OracleParameter(":flag", OracleType.VarChar));
        orclc.Parameters.Add(new OracleParameter(":nome", OracleType.VarChar));
        orclc.Parameters.Add(new OracleParameter(":repdate", OracleType.VarChar));
        orclc.Parameters[":flag"].Value = "Y";
        orclc.Parameters[":nome"].Value = dropdownlist1.SelectedItem.Text;
        orclc.Parameters[":repdate"].Value = Request["txtSchedDate"].ToString();

        adapter.SelectCommand = orclc;

        DataSet dt = new DataSet("rpg_notification");   
        adapter.Fill(dt,"rpg_notification");
        return dt;
   }
    protected void GridView1_PageIndexChanging(object sender,
GridViewPageEventArgs e)
    {
    gwreportpub.PageIndex = e.NewPageIndex;
    gwreportpub.DataBind();
    }
   protected void coloraRighe(object sender, GridViewRowEventArgs e)
    {
    if (e.Row.RowType==DataControlRowType.Header)
    {
        e.Row.BackColor = Color.Ivory;
    }

    else if (coloreriga == 2)
    {
        e.Row.BackColor = Color.LightYellow;
        coloreriga = 1;
    }
    else
    {
        e.Row.BackColor = Color.WhiteSmoke;
        coloreriga = 2;
    }
    }

}


public class SampleClass
    {
        public static bool SampleMethod()
        {

        return true;
        }

    }

please can you tell me why it dose not call the Ws ???

and please how can i debug this ??? you see something wrong in the code ??

i m getting crazy about the async pattern too

in the end the asp page:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Pubreport.aspx.cs"
Inherits="PubreportControl" Title="Untitled Page"  Async="true" %>

 <html xmlns="http://www.w3.org/1999/xhtml" >

  <script language="javascript" type="text/javascript">
     var size = 0;
     var id= 0;

  function add_gif() {
    document.getElementById("Label1").style.display = "none";       
         show_image("./wait.gif", 300,15, "Running");
 }


 function show_image(src, width, height, alt) {
    var img = document.createElement("img");
    img.src = src;
    img.width = width;
    img.height = height;
    img.alt = alt;
    document.getElementById("divUpload").style.display="inline";
    var div = document.getElementById("divUpload");
    div.appendChild(img);
 }

 function show_table() {
    document.getElementById("tbnotification").style.display="block";
 }

 </script>

 <head id="Head1" runat="server">
     <title>Pubblicazione Report</title>
<link rel="stylesheet" type="text/css" href="../controls/SnapIn.css" />
     <link rel="stylesheet" type="text/css" href="../controls/lsi18n.css" />

     <script type="text/javascript" src="../cust_batchrequest/calendario/prototype.js"></script>

     <script type="text/javascript" src="../cust_batchrequest/calendario/scriptaculous.js">     </script>

<script type="text/javascript" src="../cust_batchrequest/calendario/datepicker.js"></script>


     <link rel="stylesheet" type="text/css" href="../cust_batchrequest/calendario/datepicker.css" />


<style type="text/css">
    .errorMessage
    {
        color: #8B0000;
        text-align: center;
    }
    .confirmMessage
    {
        color: #006400;
        text-align: center;
    }
    .datebox
    {
        text-align:center;
    }
</style>
<style type="text/css"> 
    .CCSListBox 
    { 
        width: 200px; 
    }
</style>    
 </head>

 <body style="margin-left: 20%; margin-right: 20%">

<form id="form1" runat="server">
<table class="SnapIn" style="text-align: center; height: 100%; border: 0; background-color: #FFFFFF; width: 100%;
    border: 3px solid #6699CC" cellpadding="0" cellspacing="0">
    <tr class="ToolsRow">
        <td class="Title" style="white-space: nowrap; width=20%">
            Pubblicazione Report
        </td>
        <td style="width: 80%; text-align: right">

        </td>
    </tr>
    <tr style="height: 5%">
        <td colspan="2">
            &nbsp;
        </td>
    </tr>
    <tr style="text-align: center;">

    </tr>
    <tr style="height: 15%">
        <td colspan="2">
            &nbsp;
        </td>
    </tr>
    <tr>

        <td style="text-align: center" colspan="2"> 
        <div style="text-align:center">
             <b>Scegliere il nome del report *  </b>  &nbsp;
             <asp:DropDownList id="dropdownlist1" style="width:250px;" runat="server"></asp:DropDownList>
            <br />
            <br /> 
            <br /> 
            <b>Scegliere la data del report </b>  &nbsp; 
            <asp:TextBox runat="server" ID="txtSchedDate" name="txtSchedDate" type="text" cssclass="datebox" style="height:20px;" ReadOnly="true"/>
            <br />
            <br />
            <br />
            <asp:Button ID="Button1" runat="server" Text="Pubblica" OnClientClick="show_table();" OnCommand="Button1_Click" />
            <br />
            <br />
            <br />
            <br />
            <asp:Label ID="Label1" Font-Names="Arial" Font-Size="15px" runat="server" ForeColor="Red" Font-Bold="True" Text=""></asp:Label>
            <div id="divUpload" style="display:none">
            <div  style="width:200pt;;text-align:center;">Pubblicando...</div>
            </div>
        </div>
        </td>
    <br/>
    </tr>


    <tr>
        <td colspan="2" style="text-align: center">

            <br />
            &nbsp;
        </td>
    </tr>

    <tr>
        <td colspan="2" style="text-align: center">
            <br />
            &nbsp;
            <table width="100%" id="tbnotification" class="Stripy" style="display:block;">
            <tr>
                <tr>
                <td colspan="2" style="text-align: center">
                <asp:Label ID="tbnotif" runat="server" ReadOnly="True" Text="" >
                </asp:Label>
                </td>
                </tr>
               <tr>
               <td>

                <asp:GridView ID="gwreportpub" runat="server" CellPadding="5" BorderStyle="Solid" OnRowDataBound="coloraRighe" AllowPaging="true" PageSize="15" OnPageIndexChanging="GridView1_PageIndexChanging" style="border: 1px solid black;">
                 </asp:gridview>
               </td>
               </tr>
            </tr>
        </table>
        </td>
    </tr>


</table>
</form>
<script type="text/javascript"> 
    var dpck_1 = new DatePicker({ relative: 'txtSchedDate', language: 'it' });
</script>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:43:10+00:00Added an answer on June 18, 2026 at 2:43 pm

    ok did an external client in java and i did produce a jar that call the webservice
    after i did this for call the webserice inside the aspx page:

           System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.RedirectStandardError = true;
            proc.StartInfo.UseShellExecute = false;
            proc.StartInfo.FileName = "\"" + System.Web.HttpContext.Current.Server.MapPath(".") + "\\"  + "ConsoleApp.jar" + "\"" ;
    
            if(datarepo != "")
            proc.StartInfo.Arguments = "\""+connectionString +"\"" + " " +"\"" +reportname+"\""  + " " +"\"" +datarepo+"\""  + " " +"\"" +opco+"\""  + " " + "\"" +ambienteParm+"\"";
            else
            proc.StartInfo.Arguments = "\""+connectionString +"\"" + " " +"\"" +reportname+"\""  + " " +"\"" + "\""  + " " +"\"" +opco+"\""  + " " + "\"" +ambienteParm+"\"";
    
            proc.Start();
            proc.WaitForExit();
            //string result = proc.StandardOutput.ReadToEnd();
            //Response.Write(result + " - "  + proc.ExitCode);
            proc.Close();
    

    thxs to everyone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a pre-existing web service connect (SOAP) I would like to call without
I have a synchronous web service call that returns a message. I need to
I have a WCF service that I need to call in a ASP.NET web
I have created simple .NET Web Service (ASMX) that I call from my .NET
I need to call a web service from jQuery, when I put the breakpoint
In an Activity, I need to call a web service every 30 seconds or
I have a WCF Web Api Restful webservice. I want every single service call
is it possible to call Web service by using HTTP Client ? if yes
I need to call a REST web service that provides an XML feed of
My question is similar to this one: need to call soap ws without wsdl

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.