consume local web service -ok consume remote service - Not OK

Discussion in 'ASP .Net Web Services' started by dgleeson422111, Jan 26, 2010.

  1. Hi Guys

    Im trying to figure something out about web services. I created the
    simplest web service on my local machine to add two numbers.

    I can consume the service using a proxy but need to understand the
    details of HTTP POST operation.

    So using the code below in a web site from VS2005 all is fine on my
    local machine.

    -------------------------------------------------------
    <%@ Page Language="C#" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="_Default" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://
    www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>Untitled Page</title>
    </head>
    <body>
    <form action="http://localhost/AddService/Service.asmx/Add"
    method="POST">
    <input name="a"></input>
    <input name="b"></input>

    <input type="submit" value="Enter"> </input>
    </form>

    </body>
    </html>
    ---------------------------------------------------------------

    We get the following response and you can see an answer of 30 on the
    second line as the parameters given were 20 and 10.

    --------------------------------------------------------------
    <?xml version="1.0" encoding="utf-8" ?>
    <int xmlns="http://tempuri.org/">30</int>
    --------------------------------------------------------------

    So now I have copied my service.asmx file to my web site on aspspider
    and I can see the service on http://aspspider.biz/DGleeson/Service.asmx

    All still OK!

    Now I modify my web site code above to use the (now) remote web
    service.
    changing the action line as below

    <form action="http://aspspider.biz/DGleeson/Service.asmx/Add"
    method="POST">

    Now I get the following web page error.

    ------------------------------------------------------------------
    Server Error in '/DGleeson' Application.
    -----------------------------------------------

    Request format is unrecognized for URL unexpectedly ending in '/Add'.

    What are the differences now that the web service is on the aspspider
    host?

    Thanks for any responses.

    Regards

    Denis
    _____________________________
    http://www.CentronSolutions.com
     
    dgleeson422111, Jan 26, 2010
    #1
    1. Advertising

  2. dgleeson422111

    sdunnin Guest

    Looking at the WSDL at http://aspspider.biz/DGleeson/Service.asmx?WSDL
    I don't see a porttype for HTTP-POST. Take a look at the WSDL
    generated from your local service.

    I think that might be a setting controlled in the web.config.

    This link might also provide some helpful information about asp.net
    web services http://oreilly.com/catalog/prognetws/chapter/ch02.html

    On Jan 26, 1:04 pm, dgleeson422111 <> wrote:
    > Hi Guys
    >
    > Im trying to figure something out about web services. I created the
    > simplest web service on my local machine to add two numbers.
    >
    > I can consume the service using a proxy but need to understand the
    > details of HTTP POST operation.
    >
    > So using the code below in a web site from VS2005 all is fine on my
    > local machine.
    >
    > -------------------------------------------------------
    > <%@ Page Language="C#" AutoEventWireup="true"
    > CodeFile="Default.aspx.cs" Inherits="_Default" %>
    >
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    >
    > <html xmlns="http://www.w3.org/1999/xhtml" >
    > <head runat="server">
    >     <title>Untitled Page</title>
    > </head>
    > <body>
    >   <form action="http://localhost/AddService/Service.asmx/Add"
    > method="POST">
    >         <input name="a"></input>
    >         <input name="b"></input>
    >
    >         <input type="submit" value="Enter"> </input>
    >   </form>
    >
    > </body>
    > </html>
    > ---------------------------------------------------------------
    >
    > We get the following response and you can see an answer of 30 on the
    > second line as the parameters given were 20 and 10.
    >
    > --------------------------------------------------------------
    >   <?xml version="1.0" encoding="utf-8" ?>
    >   <int xmlns="http://tempuri.org/">30</int>
    > --------------------------------------------------------------
    >
    > So now I have copied my service.asmx file to my web site on aspspider
    > and I can see the service onhttp://aspspider.biz/DGleeson/Service.asmx
    >
    > All still OK!
    >
    > Now I modify my web site code above to use the (now) remote web
    > service.
    > changing the action line as below
    >
    > <form action="http://aspspider.biz/DGleeson/Service.asmx/Add"
    > method="POST">
    >
    > Now I get the following web page error.
    >
    > ------------------------------------------------------------------
    > Server Error in '/DGleeson' Application.
    > -----------------------------------------------
    >
    > Request format is unrecognized for URL unexpectedly ending in '/Add'.
    >
    > What are the differences now that the web service is on the aspspider
    > host?
    >
    > Thanks for any responses.
    >
    > Regards
    >
    > Denis
    > _____________________________http://www.CentronSolutions.com
     
    sdunnin, Jan 28, 2010
    #2
    1. Advertising

  3. Many thanks

    Yes there was no HTTP POST interface to the web service

    a few lines in web.config fixed that.

    Regards

    Denis
    _____________________________
    http://www.CentronSolutions.com



    On Jan 28, 7:18 pm, sdunnin <> wrote:
    > Looking at the WSDL athttp://aspspider.biz/DGleeson/Service.asmx?WSDL
    > I don't see a porttype for HTTP-POST. Take a look at the WSDL
    > generated from your local service.
    >
    > I think that might be a setting controlled in the web.config.
    >
    > This link might also provide some helpful information about asp.net
    > web serviceshttp://oreilly.com/catalog/prognetws/chapter/ch02.html
    >
    > On Jan 26, 1:04 pm, dgleeson422111 <> wrote:
    >
    > > Hi Guys

    >
    > > Im trying to figure something out about web services. I created the
    > > simplest web service on my local machine to add two numbers.

    >
    > > I can consume the service using a proxy but need to understand the
    > > details of HTTPPOSToperation.

    >
    > > So using the code below in a web site from VS2005 all is fine on my
    > > local machine.

    >
    > > -------------------------------------------------------
    > > <%@ Page Language="C#" AutoEventWireup="true"
    > > CodeFile="Default.aspx.cs" Inherits="_Default" %>

    >
    > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    >
    > > <html xmlns="http://www.w3.org/1999/xhtml" >
    > > <head runat="server">
    > >     <title>Untitled Page</title>
    > > </head>
    > > <body>
    > >   <form action="http://localhost/AddService/Service.asmx/Add"
    > > method="POST">
    > >         <input name="a"></input>
    > >         <input name="b"></input>

    >
    > >         <input type="submit" value="Enter"> </input>
    > >   </form>

    >
    > > </body>
    > > </html>
    > > ---------------------------------------------------------------

    >
    > > We get the following response and you can see an answer of 30 on the
    > > second line as the parameters given were 20 and 10.

    >
    > > --------------------------------------------------------------
    > >   <?xml version="1.0" encoding="utf-8" ?>
    > >   <int xmlns="http://tempuri.org/">30</int>
    > > --------------------------------------------------------------

    >
    > > So now I have copied my service.asmx file to my web site on aspspider
    > > and I can see the service onhttp://aspspider.biz/DGleeson/Service.asmx

    >
    > > All still OK!

    >
    > > Now I modify my web site code above to use the (now) remote web
    > > service.
    > > changing the action line as below

    >
    > > <form action="http://aspspider.biz/DGleeson/Service.asmx/Add"
    > > method="POST">

    >
    > > Now I get the following web page error.

    >
    > > ------------------------------------------------------------------
    > > Server Error in '/DGleeson' Application.
    > > -----------------------------------------------

    >
    > > Request format is unrecognized for URL unexpectedly ending in '/Add'.

    >
    > > What are the differences now that the web service is on the aspspider
    > > host?

    >
    > > Thanks for any responses.

    >
    > > Regards

    >
    > > Denis
    > > _____________________________http://www.CentronSolutions.com
     
    dgleeson422111, Jan 31, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Saumendra
    Replies:
    0
    Views:
    1,265
    Saumendra
    Jun 24, 2003
  2. msnews.microsoft.com
    Replies:
    2
    Views:
    1,187
    =?Utf-8?B?R2FyeQ==?=
    May 19, 2004
  3. Jorge Luzarraga Castro

    Is it possible to consume a Web Service from an ASP Client?

    Jorge Luzarraga Castro, Nov 3, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    426
    S.M. Altaf [MVP]
    Nov 3, 2005
  4. steven
    Replies:
    0
    Views:
    323
    steven
    Aug 21, 2008
  5. dgleeson422111

    Consuming local web service - ok, remote web service -problem?

    dgleeson422111, Jan 26, 2010, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    928
    dgleeson422111
    Jan 26, 2010
Loading...

Share This Page