Hi Demis,
Thanks for the reply. As per your suggestion I moved to building the
binaries on Windows. I have the following classes available:
class Program
{
private static readonly string ListeningOn = "ip + port";
//HttpListener Hosts
static void Main(string[] args)
{
var appHost = new AppHost();
appHost.Init();
appHost.Start(ListeningOn);
Console.WriteLine("Started listening on: " + ListeningOn);
Console.WriteLine("AppHost Created at {0}, listening on
{1}",
DateTime.Now, ListeningOn);
Console.WriteLine("ReadKey()");
Console.ReadKey();
}
}
public class AppHost :
ServiceStack.WebHost.Endpoints.AppHostHttpListenerBase
{
public AppHost() : base("webservice",
typeof(HelloService).Assembly) { }
public override void Configure(Funq.Container container)
{
SetConfig(new EndpointHostConfig
{
GlobalResponseHeaders =
{
{ "Access-Control-Allow-Origin", "*" },
{ "Access-Control-Allow-Methods", "GET, POST" },
},
MarkdownSearchPath = "/debug/bogus/",
AllowJsonpRequests = false,
DebugMode = true,
WriteErrorsToResponse = true,
WsdlServiceNamespace = "SoapPrototype",
DefaultContentType =
ServiceStack.Common.Web.ContentType.Soap12,
});
Routes
.Add<Hello>("/hello")
.Add<Hello>("/hello/{Name}");
}
}
public class Hello
{
public string Name { get; set; }
}
public class HelloResponse
{
public string Result { get; set; }
}
public class HelloService : IService<Hello>
{
public object Execute(Hello request)
{
return new HelloResponse
{
Result = "Hello, " + request.Name
};
}
}
I wrote a WCF client by hand using the DataContract way
namespace TestWCF
{
class Program
{
private static TestWCF.Test.IHello helloChannel;
static void Main(string[] args)
{
ChannelFactory<TestWCF.Test.IHello> channelFactory = null;
string endpointUri = @"
http://xx.xx.xx.xx:48666/soap12/";
BasicHttpBinding binding = new BasicHttpBinding();
channelFactory = new
ChannelFactory<TestWCF.Test.IHello>(binding, new
EndpointAddress(endpointUri));
helloChannel = channelFactory.CreateChannel();
TestWCF.Test.Hello request = new TestWCF.Test.Hello();
request.Name = "chal jaaye";
TestWCF.Test.HelloResponse response = new
TestWCF.Test.HelloResponse();
response = helloChannel.Execute(request);
response.Result.ToString();
}
}
class Test
{
[DataContract()]
public class HelloResponse
{
[DataMember]
public string Result;
}
[DataContract()]
public class Hello
{
[DataMember]
public string Name;
}
[ServiceContract()]
public interface IHello
{
[OperationContract]
HelloResponse Execute(Hello request);
}
}
}
I am interested in using a standalone app and don't want to go the
ASP.NET. When I start the client for consuming the service I get the
following exception:
The content type application/json of the response message does not
match the content type of the binding (text/xml; charset=utf-8).
If using a custom encoder, be sure that the IsContentTypeSupported
method is implemented properly. The first 807 bytes of the response
were: '{
"ResponseStatus":{
"ErrorCode":"NotImplementedException",
"Message":"The method or operation is not implemented.",
"StackTrace":" at
ServiceStack.WebHost.Endpoints.Support.EndpointHandlerBase.ProcessRequest(IHttpRequest
httpReq, IHttpResponse httpRes, String operationName) in C:\\src\
\ServiceStack\\src\\ServiceStack\\WebHost.EndPoints\\Support\
\EndpointHandlerBase.cs:line 52\n at
ServiceStack.WebHost.Endpoints.AppHostHttpListenerBase.ProcessRequest(HttpListenerContext
context) in C:\\src\\ServiceStack\\src\\ServiceStack\\WebHost.EndPoints
\\AppHostHttpListenerBase.cs:line 58\n at
ServiceStack.WebHost.Endpoints.Support.HttpListenerBase.ListenerCallback(IAsyncResult
asyncResult) in C:\\src\\ServiceStack\\src\\ServiceStack\
\WebHost.EndPoints\\Support\\HttpListenerBase.cs:line 197"
}
}
'.
Is hosting on
ASP.NET/IIS the only way? I apologize if the answer is
obvious as I have little knowledge of ASP.Net. How would the service
host/work when I copy the binaries on Linux. Would I need an
equivalent of IIS on Linux like Apache running?
I would appreciate if you could more information on this. For the web-
service to be SOAP I am using the 'DefaultContentType =
ServiceStack.Common.Web.ContentType.Soap12' and using
'Soap12' in the endpoint of client. Would this make the endpoint to be
soap? Apologies if I am asking too many obvious questions. Thanks for
the help.
Regards.
On Apr 16, 3:51 pm, Demis Bellot <
demis.bel...@gmail.com> wrote:
> Unfortunately Mono has an incomplete version of XsdSchema meaning it's not
> able to generate the WSDL (used to code-gen the SOAP client proxies) on
> Mono.
> Creating code-gen'ed client proxies from WSDLs is a design-time process
>
> Although Mono still supports the SOAP endpoints at runtime i.e. the
> Soap11ServiceClient/Soap12ServiceClient allow you to call SOAP services
> (just like every otherhttps://
github.com/ServiceStack/ServiceStack/wiki/C%23-client) without
> needing to use the WSDL, since it makes use of the existing DTO types to
> provide a typed API without any code-gen. The preferred approach is to not
> use code-gen (since its an un-necessary post build step) but rather to
> re-use of the clean generic service clients + server DTOs.
>
> If you prefer you can still view your web services WSDL by deploying
> on Windows IIS/
ASP.NET where you can make use of
VS.NET to generate the
> client proxies. You can then copy the dlls to Linux/Mono and run it there.
> This is how the SOAP example were deployed (Note:www.serviecstack.netis
> hosted on CentOS/Mono):
http://www.servicestack.net/ServiceStack.Examples.Clients/Soap12.aspx
> source code at:
https://github.com/ServiceStack/ServiceStack.Examples/blob/master/src...
>
> Cheers,
>
> On Mon, Apr 16, 2012 at 3:15 PM,
devquer...@yahoo.com
> <
devquer...@yahoo.com>wrote: