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 8897941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:28:52+00:00 2026-06-15T00:28:52+00:00

I have a SQL Server 2005 stored procedure that has a signature like this:

  • 0

I have a SQL Server 2005 stored procedure that has a signature like this:

CREATE PROCEDURE [dbo].[ProcTRequest] 
   @Pxml xml, @ClientCode varchar(10) 
AS
BEGIN
  ...
END

I’m tasked with writing an .asmx web service that will call this stored procedure. This is where I’m having a block.

If the parameter @Pxml is specified as string in the C# web method, we get

Server was unable to process request.

Then tried XmlText as the type for @Pxml, which resulted in

Server was unable to process request. Method MyWebService.MyWebMethod can not be reflected. There was an error
reflecting ‘PXml’. ->; There was an error reflecting type
‘System.Xml.XmlText’. -> System.Xml.XmlText cannot be used as: ‘xml
element’.

What is the correct way to call this stored procedure from a C# web method? Please note that the @Pxml parameter will always be a well-formed XML.

The person that will be calling this web service is using Curl on a Unix system.

Though the requirement is an ASMX, if this can be implemented via WCF, can you please show me how with a piece of pseudo code? I’m not familiar with WCF yet.

Please help. Thank you.

UPDATE: This is how I call the SP

 [WebMethod]
 public string GetRequestID(string PXml, string clientcode)
    {
        Database db = DatabaseFactory.CreateDatabase();
        using (IDataReader dr = db.ExecuteReader("ProcRequestID", PXml, clientcode))
        {
            return dr["RequestID"].ToString();
        }
    }
  • 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-15T00:28:54+00:00Added an answer on June 15, 2026 at 12:28 am

    Couldn’t you use a string on the ASMX interface (so the caller send you a string), but inside the ASMX web service, you define the @PXml parameter on the stored procedure call as SqlDbType.Xml ? I think that ought to work ….

    Something along the lines of :

    [WebMethod]
    public void MyWebMethod(string input, string clientCode)
    {
            using (SqlConnection conn = new SqlConnection(your-connection-string-here))
            using (SqlCommand cmd = new SqlCommand("dbo.ProcTRequest", conn))
            {
                cmd.CommandType = CommandType.StoredProcedure;
    
                cmd.Parameters.Add("@Pxml", SqlDbType.Xml);
                cmd.Parameters.Add("@ClientCode", SqlDbType.VarChar, 10);
    
                cmd.Parameters["@Pxml"].Value = input;
                cmd.Parameters["@ClientCode"].Value = clientCode;
    
                conn.Open();
                cmd.ExecuteNonQuery();
                conn.Close();
            }
    }
    

    Since you’re just calling the stored proc and not expecting a result set back – use ExecuteNonQuery instead of ExecuteReader.

    Also vitally important : tell ADO.NET that you’re calling a stored procedure! That’s what this line does:

                cmd.CommandType = CommandType.StoredProcedure;
    

    Otherwise, ADO.NET by default expects to get full inline SQL statement and might just not be able to parse and execute that ….

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

Sidebar

Related Questions

Let's say I have a stored procedure in Microsoft SQL Server 2005 that returns
I have written a stored procedure in sql server 2005 that searches for results.
Using SQL Server 2005 and have a stored procedure (not written by me) that
Working in SQL Server 2005, I have a stored procedure that inserts a record
I have the following stored procedure in an SQL Server 2005 database (meant simply
I have a stored procedure on SQL Server 2005. It is pulling from a
I'm working on SQL server 2005 and I have a very simple stored procedure:
FYI: SQL Server 2005 I have a database user account (user_web) that has the
I'm developing a C# SQL Server 2005 stored procedure that does data validation for
SQL Server Server 2005. I'm staring at a database that has 500+ stored procedures,

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.