[Mono-list] WCF service using JSON over Ajax possible on mono?

Jeff Bonhag jbonhag at SCA-CORP.COM
Tue Sep 23 16:24:45 UTC 2014


Hi Olli,

You might not necessarily need a WSDL.  I don't think they're usually used
with JSON/REST services (although WADLs exist to do a similar thing).

The WCF status page indicates that endpoint export is not implemented yet,
which is what that error message seems to confirm:

    http://www.mono-project.com/docs/web/wcf/

What happens if you add a service method with arguments after the service
name, like:

    http://127.0.0.1:8080/Service1.svc/SayHello?name=Olli

Cheers,

Jeff Bonhag
Software Consulting Associates



-----Original Message-----
From: Olli Heiskanen [mailto:ohjelmistoarkkitehti at gmail.com]
Sent: Tue 9/23/2014 12:00 PM
To: Agustín Giménez
Cc: Jeff Bonhag; mono-list at lists.ximian.com
Subject: Re: [Mono-list] WCF service using JSON over Ajax possible on mono?
 
Hi Agustin,

Thanks for the suggestion, in other circumstances I might try just that,
but I must use a wcf service without other stacks/frameworks etc. In any
case, there is something wrong with my xsp/mono/mod_mono installation so I
might get problems later with any code I'd run on this environment. I do
appreciate your input though, and will probably try servicestack in other
projects.

According to Jeff's example a simple wcf service should work on mono
environment, and it is configured correctly, yet I'm getting the
NotImplementedException just by trying to access the service. Any help in
locating and fixing the problem is most welcome!

cheers,
Olli




2014-09-23 14:34 GMT+03:00 Agustín Giménez <geniwab at gmail.com>:

> Hi Olli.
>
> This is not a solution but a suggestion.
>
> If your needs are a service which communicates through http with json
> encoding, try servicestack, its portable and works with mono in all
> architectures and creates very robust REST services.
>
> Cheers.
>
> Enviado desde mi iPad
>
> El 23/09/2014, a las 11:07, Olli Heiskanen <ohjelmistoarkkitehti at gmail.com>
> escribió:
>
> Hi,
>
> I found that one person has had a similar issue than what I'm having,
> although this does not tell how to fix the situation.
>
> Here's a link to the question:
> http://stackoverflow.com/questions/20882497/issues-with-running-wcf-services-on-debian-using-mono
>
> Problem seems to be that xsp wsdl exporter has some parts not implemented.
> Apparently I have something broken in my installations but I don't know how
> to fix it. I tried re-installing xsp (from git master) but that had no
> effect, I still have that same error.
>
> Is there any way xsp can be installed so this error could be avoided? Does
> the compiler used to compile mono or xsp matter here?
>
> I hope you guys can help me solve this error, I really need to get mono
> working.
>
> cheers,
> Olli
>
>
>
> 2014-09-22 11:13 GMT+03:00 Olli Heiskanen <ohjelmistoarkkitehti at gmail.com>
> :
>
>> Hi,
>>
>> Thanks a million Jeff, your example and comments are extremely helpful!
>>
>> I think there's something wrong in my setup, as my own project is similar
>> to the one you provided. When I made sure my Web.config matches Jeff's
>> example, and eploy my wcf service on my CentOS 6.5 server, I get the
>> following error while accessing the .svc file:
>>
>> Failed to export endpoint 'WebHttpBinding_IDataService': wsdl exporter
>> 'System.ServiceModel.Channels.WebMessageEncodingBindingElement' threw an
>> exception: System.NotImplementedException: The requested feature is not
>> implemented. at
>> System.ServiceModel.Channels.WebMessageEncodingBindingElement.System.ServiceModel.Description.IWsdlExportExtension.ExportEndpoint
>> (System.ServiceModel.Description.WsdlExporter exporter,
>> System.ServiceModel.Description.WsdlEndpointConversionContext context)
>> [0x00000] in <filename unknown>:0 at
>> System.ServiceModel.Description.WsdlExporter.ExportEndpoint_Internal
>> (System.ServiceModel.Description.ServiceEndpoint endpoint) [0x00000] in
>> <filename unknown>:0
>>
>>
>> My mono version is  3.10.1 so it seems strange that the
>> WebMessageEncodingBindingElement would not be implemented. In fact, I
>> compiled mono, mod_mono and xsp right from github masters only a few days
>> ago, which leads me to wonder if there's something wrong somewhere else.
>>
>> Any idea how I could locate the problem?
>>
>> cheers,
>> Olli
>>
>>
>> 2014-09-20 19:00 GMT+03:00 Jeff Bonhag <jbonhag at sca-corp.com>:
>>
>>>  Hi Olli,
>>>
>>> The biggest problem I had was getting the Web.config set up properly.
>>> For each service you need to define an endpoint, a service behavior, and
>>> an endpoint behavior -- .NET does a lot of this automatically so it can
>>> be very confusing why your service doesn't work.
>>>
>>> Here's a trivial WCF service that runs on Mono:
>>>
>>>     https://github.com/jeffbonhag/wcfservice1
>>>
>>> WCF works well!  You can perform AJAX requests, you can deserialize a
>>> request to an object, and serialize a POCO by specifying it as the
>>> return type of your WCF method -- it's all good.
>>>
>>> One issue I had is that UriTemplates of the form:
>>>
>>>     "weather/{state}/{city}"
>>>
>>> don't seem to work -- at least on Ubuntu, Mono 3.2.8.  Perhaps there's
>>> additional behavior that needs to be specified.  I'll revisit the issue
>>> someday.
>>>
>>> Good luck!  I've struggled with this for some time so I'm happy to
>>> help any way I can.
>>>
>>> Cheers,
>>>
>>> Jeff Bonhag
>>>
>>>
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: mono-list-bounces at lists.ximian.com on behalf of Olli Heiskanen
>>> Sent: Sat 9/20/2014 7:16 AM
>>> To: mono-list at lists.ximian.com
>>> Subject: [Mono-list]  WCF service using JSON over Ajax possible on mono?
>>>
>>> Hello list,
>>>
>>> I've been working on a wcf service to be run on mono on a CentOS 6.5
>>> platform. Can the current mono support a wcf service that communicates
>>> JSON
>>> over Ajax calls from a html5 web client? I can't seem to find any
>>> examples
>>> of someone being able to build such a system on a mono environment. I
>>> wonder if I need to add something extra compared to the plentiful online
>>> examples that are written for Windows platform?
>>>
>>> Cheers,
>>> Olli
>>>
>>>
>>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20140923/04eafccd/attachment-0001.html>


More information about the Mono-list mailing list