[CLOSED] Ajax proxy working only in development server

  1. #1

    [CLOSED] Ajax proxy working only in development server

    Hi,
    I am using a treepanel with a ajax proxy.

    It works when I run it in Visual Studio but when I deploy it to IIS I get the following error on databinding:

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

    Here is my code, taken from ext.net example "https://examples2.ext.net/#/TreePanel/Loaders/WebService/" :


    .aspx
    
        <script type="text/javascript">
            function getXmlResponseData(response) {
                alert(response);
                try {
                    var xmlData = response.responseXML,
                        root = xmlData.documentElement || xmlData;
    
                    return this.readRecords(Ext.decode(root.firstChild.nodeValue));
                } catch (ex) {
                    var error = new Ext.data.ResultSet({
                        total: 0,
                        count: 0,
                        records: [],
                        success: false,
                        message: ex.message
                    });
    
                    this.fireEvent('exception', this, response, error);
    
                    return error;
                }
            }
    
        </script>
    
    <ext:TreePanel Width="400"
                        ID="tpFamiglieArticolo" 
                        runat="server" 
                        Title="Categorie di prodotto" 
                        Border="true"
                        RootVisible="false"
                        >
                        <Store>
                            <ext:TreeStore ID="TreeStore1" runat="server">
                                <Proxy>
                                    <ext:AjaxProxy Url="~/WebServices/TreeXmlService.asmx/GetNodes">
                                    <ActionMethods Read="POST" />   
                                                                <Reader>
                                            <ext:JsonReader >
                                                <CustomConfig>
                                                    <ext:ConfigItem Name="getResponseData" Value="getXmlResponseData" Mode="Raw" />
                                                </CustomConfig>
                                            </ext:JsonReader>
                                        </Reader>
                                    </ext:AjaxProxy>
                                </Proxy>
                            </ext:TreeStore>
                        </Store>
                        <Root>
                            <ext:Node NodeID="0" Text="Root" />
                        </Root>
                    </ext:TreePanel>

    web service
        /// <summary>
        /// Summary description for TreeXmlService
        /// </summary>
        [WebService(Namespace = "http://tempuri.org/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        [System.ComponentModel.ToolboxItem(false)]
        // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
        [System.Web.Script.Services.ScriptService]
        public class TreeXmlService : System.Web.Services.WebService
        {
    
            [WebMethod]
            public string GetNodes(string node)
            {
                NodeCollection nodes = new NodeCollection(false);
    
                if (!string.IsNullOrEmpty(node))
                {
                    for (int i = 1; i < 6; i++)
                    {
                        Node asyncNode = new Node();
                        asyncNode.Text = node + i;
                        asyncNode.NodeID = node + i;
                        nodes.Add(asyncNode);
                    }
    
                    for (int i = 6; i < 11; i++)
                    {
                        Node treeNode = new Node();
                        treeNode.Text = node + i;
                        treeNode.NodeID = node + i;
                        treeNode.Leaf = true;
                        nodes.Add(treeNode);
                    }
                }
    
                return nodes.ToJson();
            }
        }
    Last edited by Daniil; Sep 18, 2012 at 4:05 PM. Reason: [CLOSED]
  2. #2
    Actually, I couldn't get work neither the "TreePanel using WebService" example.

    I get the same error.

    M
  3. #3
    I could get the example working LOCALLY adding

    <ActionMethods Read="POST" ></ActionMethods>
    but still it doesn't work once deployed.
    M
    Last edited by Daniil; Sep 18, 2012 at 12:16 PM. Reason: Please use [CODE] tags
  4. #4
    Maybe the stack trace can help:

    [InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/GetNodes'.]
       System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +569481
       System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +212
       System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +47
       System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +203
       System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +128
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
    Last edited by Daniil; Sep 18, 2012 at 12:16 PM. Reason: Please use [CODE] tags
  5. #5
    Hi Marco,

    Are the page and WerService deployed in the same domain?

    Can you access the WebService via browser? What is the link?

    Also please post the page link.
  6. #6
    Hi Daniil,
    the page and the web service are in the same project. I mean in the same web application.

    Web Service address is:
    http://renoapp/Reno_B2B_ExtNET/TreeXmlService.asmx

    page address is
    http://renoapp/Reno_B2B_ExtNET/Test.aspx
  7. #7
    Add the following to web.config
    <webServices>
    
    
        <protocols>
    
    
            <add name="HttpGet"/>
    
    
            <add name="HttpPost"/>
    
    
        </protocols>
    
    
    </webServices>
  8. #8
    Please, mark as closed.
    Thank you.
    M

Similar Threads

  1. [CLOSED] 'Dynamic' url for an AJAX proxy
    By Justin_Wignall in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 23, 2012, 12:57 PM
  2. Replies: 13
    Last Post: Sep 07, 2012, 6:23 PM
  3. Replies: 3
    Last Post: Feb 21, 2012, 7:46 AM
  4. Replies: 2
    Last Post: Nov 15, 2011, 11:13 PM
  5. [CLOSED] Remote filtering is not working with proxy
    By Aparna_B in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 23, 2011, 10:49 AM

Posting Permissions