Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
We need to communicate with a Web Service via scripting (javascript, vbscript, jquery). We are getting an error trying to communicate with the Web Service. From the articles I have read it seems this line needs to be added into the Web Service:
[System.Web.Script.Services.ScriptService]
. Thing is we are not able to add this into service as it's a published site that comes with the software.

Will I be able to still call this service without that attribute? Is there anything else I can do to make the call using scripting language?

What I have tried:

<script type="text/javascript">
    $(document).ready(function()
        {
            $.ajax
                (
                {
                    type: "POST",
                    url: "myurl/method",
                    data: "{Operator:'elizma',OperatorPassword:'test',CompanyId:'T',CompanyPassword:'test',LanguageCode:'AUTO',LogLevel:'ldNoDebug',EncoreInstance:'EncoreInstance_0',XmlIn:''}",
                    contentType: "application/json; charset=utf-8",
                    datatype: "json",
                    success: OnSuccessCall,
                    error: OnErrorCall
                }
            );
        }
    );

    function OnSuccessCall(response) {
        alert(response.d);
    }


    function OnErrorCall(response) {
        alert(response.status + " " + response.statusText);
    }

</script>
Posted
Comments
F-ES Sitecore 6-Dec-18 5:02am    
What is the error you are getting?
ZurdoDev 6-Dec-18 10:55am    
There is no way for us to know. What is the error?

The only reason for that line of code is if it is Microsoft code. We know nothing about the published service so we can't even begin to answer you. But the error will probably help.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900