Reputation: 33
Here's my relevant client-side code called from a generic handler:
private static readonly IServiceClient Client = new Soap12ServiceClient("http://localhost/MyService/Send");
_serviceRequest = new ServiceRequest
{
String1 = "string1",
String2 = "string2",
String3 = "string3"
};
Client.Send<ServiceResponse>(_rawMessage);
On the service-side, I have the following in my web.config:
<system.webServer>
<handlers>
<add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true"/>
</handlers>
</system.webServer>
And following in my Global.asax.cs:
public class MyServiceAppHost : AppHostBase
{
public MyServiceAppHost() : base("My Service", typeof(MyService).Assembly) { }
public override void Configure(Container container)
{
Routes.Add<ServiceRequest>("/Send");
}
}
protected void Application_Start(object sender, EventArgs e)
{
new MyServiceAppHost().Init();
}
And finally, MyService class:
public class MyService : IService<ServiceRequest>
{
public object Execute(ServiceRequest request)
{
return new ServiceResponse
{
Response = true
};
}
Here are my POCO classes:
[DataContract]
public class ServiceRequest
{
[DataMember(Order = 1)]
public string String1 { get; set; }
[DataMember(Order = 2)]
public string String2 { get; set; }
[DataMember(Order = 3)]
public string String3 { get; set; }
}
[DataContract]
public class ServiceResponse
{
[DataMember(Order = 1)]
public bool Response { get; set; }
}
I've tried putting my client and service on the same IIS server (different app pool/web site) and also on different servers.
If I go to the url via my browser, http://localhost/MyService/Send
, I get the proper response(true) on the browser indicating that the service is up. But when I use the Soap12ServiceClient from my client, I get "The remote server returned an error: (404) Not Found."
Upvotes: 3
Views: 835
Reputation: 143319
SOAP can't make use of custom routes, it only supports HTTP POSTing SOAP messages to the same endpoint. So you should only configure it to use the base url for all services.
Upvotes: 2