Auto-Generating Client Code - OpenRasta, Nancy and ServiceStack -
i have looked through documentation above frameworks see if provide facility auto-generate client code, i.e. classes models. know whether can, or have try , using svcutil? if so, have experience of this?
servicestack has number of different options enabling strong typed api consuming servicestack services on client:
1) share server dto's on client
servicestack encourages logically separating services services request , response dto's (i.e. message contracts) defined in dependency , impl-free project, typically named {projectname}.servicemodel
. recommended project structure contained within each of servicestackvs vs.net project templates.
the benefits of approach you're clients able re-use server dto dll (used define web services contract with) in combination of .net service clients enable end-to-end typed api without code-gen.
this approach lets define message-based dto's (i.e. services contracts) code-first, i.e. free of implementation concerns letting focus on domain value of services should accept , return. once dto's defined, client , server teams can implement them in parallel , independently of each other clients can bind service responses before they've been implemented.
all servicestack's serviceclients implements clean interfaces (e.g. iserviceclient
) allow clients mocked to return stub results until server implemented.
2) add servicestack reference
add servicestack reference provides alternative sharing dto dlls, can enable better dev workflow external clients can instead generate (and update) typed apis remote servicestack services baseurl - reducing burden , effort required consume servicestack services whilst benefiting clients native language strong-typing feedback.
add servicestack reference includes integration leading ide's clients can add reference remote servicestack instance , update dto's directly within vs.net, xamarin studio, xcode , android studio these supported languages:
supported languages
- c# add servicestack reference
- f# add servicestack reference
- vb.net add servicestack reference
- typescript add servicestack reference
- swift add servicestack reference
- java add servicestack reference
3) soap , wsdl generated proxies
sharing dto's or using add servicestack reference recommended approach holds number of benefits on using soap, wsdl's , generated proxies enabling typed client api encourages complex , fragile combination of technologies used in web service implementations today.
but when they're needed, servicestack enables soap endpoints services follow soap limitations, providing wsdl , xsd's necessary external clients generate wsdl-generated proxy.
Comments
Post a Comment