Http Post Web Service

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?cGhlbmdsYWk=?=

    Http Post Web Service

    I am not sure really how to explain this but here goes.

    I am creating some new web services and I want to be able to post data like
    the following:

    <Data>
    <some value>1</some value>
    <more info>2</more info>
    </Data>

    I have the object built and I can call the web service but all I get in
    return is "ERROR". My webservice looks like this:

    [WebMethod]
    public string GeneratePDFBOL( BillInfo bi)
    {
    try
    {
    return bi.BillNumber;
    }
    catch(Exception e)
    {
    return e.Message;
    }
    }

    If I take out the BillInfo and add a string value in there, I can post data
    but when I try to pass complex data, it does not work.I have searched all
    over and I can not find anything on how to do this. It seems to work for Soap
    but I want to have unified calls for both SOAP and HTTP-POST.

    Can someone point me in the right direction?

    Jerel
  • =?Utf-8?B?TWFuaXNoIEJhZm5h?=

    #2
    RE: Http Post Web Service

    Hi,
    As per my uderstanding HTTP-GET or HTTP-POST supports only native data
    types(primitive data types).Only SOAP allows the client to pass objects as
    parameters.

    However, SOAP toolkits exist for most programming languages, including Java
    and COM-based Microsoft programming languages such as Visual C++ and Visual
    Basic. You'll almost always use SOAP encoding with your XML Web services, for
    the following reasons:
    Only SOAP allows the client to pass objects as parameters. In other words,
    the current version of the UpdateCustomers method wouldn't work over HTTP GET
    or HTTP POST because it requires a CustomerDetails object as a parameter.
    SOAP also provides support for ByRef parameters.

    SOAP is more standardized. .NET defines its own rules for encoding
    information in an HTTP GET or HTTP POST message.

    SOAP provides better exception support with .NET clients. If a method called
    over HTTP GET or if HTTP POST fails, it just returns an unhelpful HTTP error.
    --
    Thanks and Regards.
    Manish Bafna.
    MCP and MCTS.



    "phenglai" wrote:
    I am not sure really how to explain this but here goes.
    >
    I am creating some new web services and I want to be able to post data like
    the following:
    >
    <Data>
    <some value>1</some value>
    <more info>2</more info>
    </Data>
    >
    I have the object built and I can call the web service but all I get in
    return is "ERROR". My webservice looks like this:
    >
    [WebMethod]
    public string GeneratePDFBOL( BillInfo bi)
    {
    try
    {
    return bi.BillNumber;
    }
    catch(Exception e)
    {
    return e.Message;
    }
    }
    >
    If I take out the BillInfo and add a string value in there, I can post data
    but when I try to pass complex data, it does not work.I have searched all
    over and I can not find anything on how to do this. It seems to work for Soap
    but I want to have unified calls for both SOAP and HTTP-POST.
    >
    Can someone point me in the right direction?
    >
    Jerel

    Comment

    • =?Utf-8?B?TWFuaXNoIEJhZm5h?=

      #3
      RE: Http Post Web Service

      Hi,
      In the previous post i have forgotten to mention that i have taken that info
      from sample chapter in the following link:

      I hope that previous post has answered your question.
      --
      Thanks and Regards.
      Manish Bafna.
      MCP and MCTS.



      "phenglai" wrote:
      I am not sure really how to explain this but here goes.
      >
      I am creating some new web services and I want to be able to post data like
      the following:
      >
      <Data>
      <some value>1</some value>
      <more info>2</more info>
      </Data>
      >
      I have the object built and I can call the web service but all I get in
      return is "ERROR". My webservice looks like this:
      >
      [WebMethod]
      public string GeneratePDFBOL( BillInfo bi)
      {
      try
      {
      return bi.BillNumber;
      }
      catch(Exception e)
      {
      return e.Message;
      }
      }
      >
      If I take out the BillInfo and add a string value in there, I can post data
      but when I try to pass complex data, it does not work.I have searched all
      over and I can not find anything on how to do this. It seems to work for Soap
      but I want to have unified calls for both SOAP and HTTP-POST.
      >
      Can someone point me in the right direction?
      >
      Jerel

      Comment

      Working...