I have been wracking my brain to get this one figured out. I followed the MSDN "Simplified Configuration" model here, for .net 4.0 - http://msdn.microsoft.com/en-us/library/ee358768.aspx
I get this error when I try and hit the URL - http://localhost:62392/GetBuildings.svc/GetBuildings?numberOfPeople=2,4&amountOfTime=1&needComputer=true&dateSelected=12/1/2012
The service seems to actually run, I don't get a full on IIS error, but I am not getting the data expected. How can I evaluate whether my endpoint is setup correctly?
my web.config -
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
<authentication mode="None"/>
</system.web>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="webHttpBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webHttpBindingJsonP" crossDomainScriptAccessEnabled="true"></binding>
</webHttpBinding>
</bindings>
<protocolMapping>
<add scheme="http" binding="webHttpBinding" bindingConfiguration="webHttpBindingJsonP" />
</protocolMapping>
</system.serviceModel>
</configuration>
my Interface -
Imports System.ServiceModel
Imports System.ServiceModel.Web
<ServiceContract()>
Public Interface IGetLibrariesService
<OperationContract(Name:="LibraryData")> _
<WebGet(ResponseFormat:=WebMessageFormat.Json)> _
Function GetLibraries(ByVal numberOfPeople As String, ByVal amountOfTime As Integer, ByVal needComputer As Boolean, ByVal dateSelected As String) As BuildingReturnData
End Interface
and last, my code -
<DataContract()>
Public Class BuildingReturnData
<DataMember()>
Public libData As List(Of LibraryMobileData)
<DataMember()>
Public numberOfRooms As List(Of Integer)
<DataMember()>
Public totalRecordCount As Integer
End Class
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allo wed)>
Public Class MeetingRooms : Implements IGetLibrariesService
Private _libData As New List(Of LibraryMobileData)
Private _roomCountData As New List(Of Integer)
Public Function GetBuildings(numberOfPeople As String, amountOfTime As Integer, needComputer As Boolean, dateSelected As String) As BuildingReturnData Implements IGetLibrariesService.GetLibraries
Dim libTemp As New LibraryMobileData
Dim startPeople, endPeople, recordCount As Integer
Dim numberSplitArr As String()
numberSplitArr = Split(numberOfPeople, ",")
startPeople = numberSplitArr(0)
endPeople = numberSplitArr(1)
For x = 0 To endPeople
libTemp.LibraryId = x
libTemp.Name = "library " & x
libTemp.Latitude = 39.167107
libTemp.Longitude = -86.534359
_libData.Add(libTemp)
_roomCountData.Add(x + startPeople)
recordCount = x
Next
Dim temp As New BuildingReturnData
temp.libData = _libData
temp.numberOfRooms = _roomCountData
temp.totalRecordCount = recordCount
Return temp
End Function
End Class
Related
I want my WCF service to return json.
I'm using Visual Studio 2013 (VB.NET/ASP.NET 4.6.1)
In My aspx page (located on a folder called DataUnit) i try to call my WCF service located (at the moment) on the same folder of aspx page.
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: 'Service.svc/GetCustomers',
data: '{"MyDate": "' + dateval + '"}',......
But i receive Error 404
If i visualize Service.svc in Browser (http://localhost:64367/DataUnit/Service.svc) i receive message
Service Created
To Test Service.....
svcutil.exe http://localhost:64367/DataUnit/Service.svc?wsdl
I've also activated in Panel Control
Windows Communication Foundation HTTP Activation
Windows Communication Foundation Non-HTTP Activation
I've passed all day to resolve but i'm getting crazy.
This is my code
web.config
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="ServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<services>
<service name="MyNameSpace.Service" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="webHttpBinding" contract="MyNameSpace.Service" behaviorConfiguration="ServiceAspNetAjaxBehavior">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
</system.serviceModel>
Service.svc
Imports System.ServiceModel
Imports System.ServiceModel.Activation
Imports System.ServiceModel.Web
Imports Newtonsoft.Json
<ServiceContract()>
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>
Public Class Service
<OperationContract()>
<System.ServiceModel.Web.WebInvoke(Method:="POST", _
ResponseFormat:=System.ServiceModel.Web.WebMessageFormat.Json)> _
Public Function GetCustomers(ByVal MyDate As String) As String
Try
Dim gd As New GetOracleData
Dim b As String = Chr(34)
Dim newdataset As DataSet
Dim RAPPID As String = "01"
newdataset = gd.GetMyData(MyDate , RAPPID)
Dim json2 As String = JsonConvert.SerializeObject(newdataset, Newtonsoft.Json.Formatting.Indented)
Return json2
Catch ex As Exception
End Try
End Function
End Class
SVC Markup:
<%# ServiceHost Language="VB" Debug="true" Service="MyNameSpace.Service" CodeBehind="Service.svc.vb" %>
RouteConfig.vb
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.Mvc
Imports System.Web.Routing
Public Module RouteConfig
Public Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
routes.MapRoute(
name := "Default",
url := "{controller}/{action}/{id}",
defaults := New With {.action = "Index", .id = UrlParameter.Optional}
)
End Sub
End Module
UPDATE
I believe that problem is on this but i don't know why and how i must implement a controller for a simple ASPX page.
[HttpException]: The controller for path '/DataUnit/Service.svc/GetCustomers' was not found or does not implement IController.
in System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType)
in System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName)
in System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory)
in System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
in System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state)
in System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
in System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
in System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
in System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
-->
Bro,
We need to add the WebHttp endpoint behavior to the service endpoint. Like below.
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="WebApplication1.CostServiceAspNetAjaxBehavior">
<enableWebScript/>
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<services>
<service name="WebApplication1.CostService">
<endpoint address="" behaviorConfiguration="WebApplication1.CostServiceAspNetAjaxBehavior" binding="webHttpBinding" contract="WebApplication1.CostService"/>
</service>
</services>
</system.serviceModel>
For details.
https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/wcf/webhttp
Feel free to let me know if the problem still exists.
I just created a basic Web Controller in my project. I hit debug and try to browse to /api/duedate and I get a 404. I am new to controllers and have been looking at every tutorial I can find. None of them say I need to add anything more to get this to work.
Imports System.Net
Imports System.Web.Http
Public Class DueDateController
Inherits ApiController
' GET api/duedate
Public Function GetValues() As IEnumerable(Of String)
Return New String() {"value1", "value2"}
End Function
' GET api/duedate/5
Public Function GetValue(ByVal id As Integer) As String
Return "value"
End Function
' POST api/duedate
Public Sub PostValue(<FromBody()> ByVal value As String)
End Sub
' PUT api/duedate/5
Public Sub PutValue(ByVal id As Integer, <FromBody()> ByVal value As String)
End Sub
' DELETE api/duedate/5
Public Sub DeleteValue(ByVal id As Integer)
End Sub
End Class
My web.config looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
<add key="webPages:Version" value="2.0"/>
</appSettings>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true" />
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers></system.webServer>
</configuration>
I believe you need to add a route.
Routing in VB
If you read the last comment in this thread it should show you how to add routing to your app.
To help anyone else out and to simplify having to read through that long post. You need to create and modify your global.asax file to include this:
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
RouteTable.Routes.MapHttpRoute("WebApi1",
"api/{controller}/{id}",
defaults:=New With {.id = System.Web.Http.RouteParameter.Optional})
End Sub
I was trying to make a webservice call to return json formatted data to populated a grid control. It was not working and after using fiddler and firebug to monitor the call I see the data wrapped as xml. I tried to different calls; one makes a call to mongodb and the result is a simply collection and the other is data from another endpoint that is json format. I have the webservice set up as follows:
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports System.Web.Script.Services
Imports System.Web.Script.Serialization
Imports System.Net
Imports System.IO
Imports System.Xml
Imports Newtonsoft.Json
Imports System.ServiceModel
Imports MongoDB.Driver
Imports MongoDB.Bson
<System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ServiceBehaviorAttribute(IncludeExceptionDetailInFaults:=True)>
<ToolboxItem(False)> _
Public Class WebService1
Inherits System.Web.Services.WebService
Private mongo As MongoServer = MongoServer.Create()
Private Function convertToJson(ByVal username As String)
Dim product As New splnkObject()
product.userName = username
Dim jsonT As String = JsonConvert.SerializeObject(product)
Return jsonT
End Function
<WebMethod()> _
<ScriptMethod(UseHttpGet:=True,
XmlSerializeString:=False, ResponseFormat:=ResponseFormat.Json)> _
Public Function getDBData() As String
Dim response As String = String.Empty
mongo.Connect()
Dim db = mongo.GetDatabase("nodetest1")
Using mongo.RequestStart(db)
Dim collection = db.GetCollection(Of BsonDocument)("usercollection").FindAll()
response = collection.Collection.ToString
response = "{""d"":" + response + "}"
Return collection.ToArray.ToJson
End Using
End Function
This is the response captured in fiddler and the json tab says invalid json in body:
string [ xmlns=http://tempuri.org/ ]
[{ "_id" : ObjectId("52d2f2b3c60804b25bc5d2ca"), "username" : "testuser1",
"email" : "testuser1#testdomain.com" },
{ "_id" : ObjectId("52d2f2f9c60804b25bc5d2cb"), "username" : "testuser2",
"email" : "testuser2#testdomain.com" },
{ "_id" : ObjectId("52d2f2f9c60804b25bc5d2cc"), "username" : "testuser3",
"email" : "testuser3#testdomain.com" }]
My webconfig file as follows:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="connectionString2" value="Server=localhost:27017"/>
</appSettings>
<connectionStrings>
<system.web>
<authentication mode="None" />
<authorization>
<allow users="?" />
</authorization>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx"
type="System.Web.Script.Services.ScriptHandlerFactory" validate="false"/>
</httpHandlers>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false"
multipleSiteBindingsEnabled="true" />
<services>
<service name="WbTest.Service1">
<endpoint address="" behaviorConfiguration="WbTest.Service1AspNetAjaxBehavior"
binding="webHttpBinding" contract="WbTest.IService1" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="WebBehavior">
<webHttp />
<enableWebScript />
</behavior>
<behavior name="WbTest.Service1AspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings />
<client />
</system.serviceModel>
</configuration>
The javascript call:
var myStore = new Ext.data.Store({
model: 'User',
proxy: {
type: 'ajax',
url: 'WCFService/WebService1.asmx/getDBData',
contentType: 'application/json; charset=utf-8',
reader: {
type: 'json',
root: '_id'
}
}
});
myStore.load();
Please could someone take a look and identify where the issue is.
I'm not going to say this is the "right" way, however, one option would be to not specify a return type on the method and write directly to the response(HttpContext.Current.Response) object.
<WebMethod()> _
Public Sub getDBData()
Dim response As String = String.Empty
mongo.Connect()
Dim db = mongo.GetDatabase("nodetest1")
Using mongo.RequestStart(db)
Dim collection = db.GetCollection(Of BsonDocument)("usercollection").FindAll()
response = collection.Collection.ToString
response = "{""d"":" + response + "}"
Dim responseJson as String
responseJson = Collection.ToArray.ToJson
HttpContext.Current.Response.Write(responseJson)
End Using
End Sub
Additionally, If you are going to use Newtonsoft to manipulate objects, i find this method works well.
I should note, that asmx web services are legacy and the newer technology is wcf.
I am getting above error for ajax based WCF serive. Code looks like below.
Code
<ServiceContract()>
Public Interface IEditInitiatives
<OperationContract()> _
<WebInvoke(BodyStyle:=WebMessageBodyStyle.WrappedRequest, ResponseFormat:=WebMessageFormat.Json, UriTemplate:="GetGridData")> _
Function GetGridData(session As String) As List(Of InitiativeData)
<OperationContract()> _
<WebInvoke(Method:="POST", BodyStyle:=WebMessageBodyStyle.WrappedRequest, ResponseFormat:=WebMessageFormat.Json)> _
Function SaveGridData(input As String) As String
End Interface
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>
Public Class EditInitiatives
Implements IEditInitiatives
Function GetGridData(session As String) As List(Of InitiativeData) Implements IEditInitiatives.GetGridData
'Business logice
End Function
Function SaveGridData(ByVal input As String) As String Implements IEditInitiatives.SaveGridData
Return "ok"
End Function
End Class
Web.Config
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="metadataBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="MyCompany.CostReduction.EditInitiativesAspNetAjaxBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="MyCompany.CostReduction.EditInitiatives" behaviorConfiguration="metadataBehavior">
<endpoint address="" behaviorConfiguration="MyCompany.CostReduction.EditInitiativesAspNetAjaxBehavior" binding="webHttpBinding" contract="MyCompany.CostReduction.IEditInitiatives" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="UsernameWithTransport">
<security mode="Transport">
<transport clientCredentialType="Basic" />
</security>
</binding>
</webHttpBinding>
</bindings>
Taking a stab at it:
[Serializable]
[DataContract]
Make sure you place those attributes on InitiativeData
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
Allright, I'm using a WCF service to handle requests from my web app and respond with a JSONP format. I tried all the solutions I could find, studied the documentation (http://msdn.microsoft.com/en-us/library/ee834511.aspx#Y200) and the example project.
The problem is the response object (json) does not get wrapped with the callback supplied in the URL.
Request is like:
http://localhost/socialApi/socialApi.svc/api/login?callback=callback&username=AAAAA&password=BBBB
Web.config looks like:
<?xml version="1.0"?>
<configuration>
<system.web>
<trace enabled="true"/>
<compilation debug="true" targetFramework="4.0"><assemblies><add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=*************" /></assemblies></compilation>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<services>
<service name="RestService.socialApi">
<endpoint address="" binding="webHttpBinding" contract="RestService.IsocialApi" bindingConfiguration="webHttpBindingJsonP" behaviorConfiguration="webHttpBehavior">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttpBehavior" >
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="webHttpBindingJsonP" crossDomainScriptAccessEnabled="true"/>
</webHttpBinding>
</bindings>
<!--<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />-->
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<connectionStrings>
<add name="AsrAppEntities" connectionString="myconstring**********" />
</connectionStrings>
</configuration>
And my operationcontract:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Web;
using System.IO;
namespace socialApi
{
[ServiceContract]
public interface IsocialApi
{
[OperationContract]
[WebGet(
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "/api/login?username={username}&password={password}")]
JsonpAuthenticationResponse Login(string username, string password);
}
}
The response is just normal json:
{"Message":"unauthorized","Status":400,"Token":null}
And I want:
callbackfunction({"Message":"unauthorized","Status":400,"Token":null})
I think it has something to do with the Web.config, because when I modify the example and adjust the Web.config so it looks like mine the example doesn't function anymore. You would say I pinpointed the problem.. but no.
To supply as much as information as possible, here is the working solution from the example:
Web.config:
<?xml version="1.0"?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="None" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<standardEndpoints>
<webScriptEndpoint>
<standardEndpoint name="" crossDomainScriptAccessEnabled="true"/>
</webScriptEndpoint>
</standardEndpoints>
</system.serviceModel>
</configuration>
And the class:
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
namespace Microsoft.Samples.Jsonp
{
[DataContract]
public class Customer
{
[DataMember]
public string Name;
[DataMember]
public string Address;
}
[ServiceContract(Namespace="JsonpAjaxService")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class CustomerService
{
[WebGet(ResponseFormat = WebMessageFormat.Json)]
public Customer GetCustomer()
{
return new Customer() { Name="Bob", Address="1 Example Way"};
}
}
}
The above example returns a jsonp object. This is the call from the example:
function makeCall() {
var proxy = new JsonpAjaxService.CustomerService();
proxy.set_enableJsonp(true);
proxy.GetCustomer(onSuccess, onFail, null);
}
proxy.set_enableJsonp(true); is maybe something I am missing in my call? But I can't add this in my call because I'm not calling the service from the same solution.
So any idea's about what's causing the normal JSON response instead of the request JSONP?
The problem was in the factory settings. In the marckup of the svc file I had to change the factory to System.ServiceModel.Activation.WebScriptServiceHostFactory.