Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
I have a wcf service deployed on IIS. The service is running when I access it from the browser http://SiteName:81/ServiceName.svc
 
I am also using this service to populate a list using BCS in Sharepoint which works fine.
 
I need to call this service from a Sharepoint form and I thought I could use jQuery/Ajax to accomplish this but so far I am not successful.
 
I have the following code inside the form(This is the NewForm.aspx for the custom list i am working on):
 
<script type="text/javascript">
$.ajax( { 
  type: "Get", 
  url: 'http://ServerName:81/mywebservice.svc', 
  success: function() { 
      alert("Service found); 
  },
  error: function () {
      alert("Service not found");
  }
}); 
</script>
 
I am unsure of whether jQuery/Ajax is the way to go or there is another solution or should I scrap all this and create a custom form with all the existing functionality.
 
If I can call the service then I can use it's methods.
 
Also, I have the above script working within Visual Studio for the Web Service, accept that I have to replace the ServerName with loocalhost like this: 'http://localhost:10006/mywebservice.svc'. The localhost:10006 is the VS webservice. If I change it to ServerName:81 it fails to locate the service.
 
Any thoughts on this would be appreciated.
 
Thanks
Mustansir
Posted 5-Sep-12 18:16pm
(unknown member)

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

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 5 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100