You must Sign In to post a response.
  • Category: Webservices

    Index was outside the bounds of the array

    If i pass the below url I'm getting below error so kindly give solution

    http://localhost:54771/SMSWEBSERVICE/Service.asmx/SubmitBody?XmlFileData=<?xml version="1.0" ?><S:Envelope xmlns:S=""> <S:Body> <ns2:xmlData xmlns:ns2=""> <data><name>vinod</name></data> </ns2:xmlData> </S:Body></S:Envelope>

    Error Details

    System.IndexOutOfRangeException: Index was outside the bounds of the array.
    at System.Web.Services.Protocols.HttpServerType..ctor(Type type)
    at System.Web.Services.Protocols.HttpServerProtocol.Initialize()
    at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)
    at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
  • #753831

    The problem is you are passing the xml data(envelop) as query string, this is not a valid format to send it across the query strings.

    If the envelop structure is common for all users then store it in a database are in a configuration file instead passing through query strings like :

    XmlFileData=<?xml version="1.0" ?>
    <S:Envelope xmlns:S="">
    <ns2:xmlData xmlns:ns2="">

    Then pass the value of <name> element as query strings, then the envelop and replace the name in it.

    Sample code like:

    strValue = Request.QueryString["XmlFileData"];


    then do the need full.

    I hope it will helps you.


  • #753835
    Hai G.Renganathan,
    This is quite common error which will occur when you try to access the elements with the indexes and the index is not available.
    If you can past your server side code where you are trying to access the values, we can help better.
    You need to check your server side code may be inside service that how this string(input) is getting parsed and then access the value and pass to the service to get the result.
    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

  • Sign In to post your comments