I am new to the domain of web services and have started using
ServiceStack with MONO. I was able to setup a self hosted web services
and implemented couple of GET calls using that. Now I am trying to
implement POST and PUT calls and want to send XML payload in that. I
would really appreciate if anyone could give pointers on how to go
about implementing that. The given ServiceStack samples are more
ASP.NET centric. I am using C# for all the implementation and using
the programmatic ways of ServiceStack. Right now I am trying to
implement a POST call like this
POST <host-uri>/client, and the following as XML.
<ClientName>abc</ClientName>
<ClientDetails>details</ClientDetails>
Thank you for the help.
Regards.
var serviceClient = new XmlServiceClient("http://host/baseurl");
var response = serviceClient.Post<ClientResponse>(
new Client {ClientName = "Name", ClientDetails = "..."});
<Movies xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.servicestack.net/types">
<Id>String</Id>
<Movie>
<Director>String</Director>
<Genres xmlns:d3p1="http://schemas.microsoft.com/2003/10/
Serialization/Arrays">
<d3p1:string>String</d3p1:string>
</Genres>
<Id>String</Id>
<Rating>0</Rating>
<ReleaseDate>0001-01-01T00:00:00</ReleaseDate>
<TagLine>String</TagLine>
<Title>String</Title>
</Movie>
</Movies>
Is there a way the same can be done be removing things like xmlns
attribute or like this
<Movies>
<Id>String</Id>
<Movie>
<Director>String</Director>
<Genres>String</Genres>
<Id>String</Id>
<Rating>0</Rating>
<ReleaseDate>0001-01-01T00:00:00</ReleaseDate>
<TagLine>String</TagLine>
<Title>String</Title>
</Movie>
</Movies>
Such type of payload will be easier for users to provide. Again, thank
you for your time to answer my previous query.
Regards.
On Nov 21, 4:39 pm, Demis Bellot <demis.bel...@gmail.com> wrote:
> So the normal way to call ServiceStack's XML web service is to still use
> the strong typed generic Xml client, i.e.
>
> var serviceClient = new XmlServiceClient("http://host/baseurl");
>
> > var response = serviceClient.Post<ClientResponse>(
> > new Client {ClientName = "Name", ClientDetails = "..."});
>
> Doing this will send a Serialized XML Client DTO to your ServiceStack *
> Client* service.
> I'd recommend using something like fiddler (or wireshark) so you can
> monitor the traffic and see the exact xml that gets sent.
>
> Instead of using a typed client you can also send plain xml, see this
> StackOverflow answer for an example of sending raw Xml with a WebClient:http://stackoverflow.com/questions/8046538/json-format-data-from-cons...<http://stackoverflow.com/questions/8046538/json-format-data-from-cons...>
>
> Cheers,