Search Preview
POSTing Json data using the HttpClient from WCF Web API | Alexander Zeitler
alexanderzeitler.com.com > alexanderzeitler.com
SEO audit: Content analysis
Language | Error! No language localisation is found. | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Title | POSTing Json data using the HttpClient from WCF Web API | Alexander Zeitler | ||||||||||||||||||||||||||||||||||||
Text / HTML ratio | 48 % | ||||||||||||||||||||||||||||||||||||
Frame | Excellent! The website does not use iFrame solutions. | ||||||||||||||||||||||||||||||||||||
Flash | Excellent! The website does not have any flash contents. | ||||||||||||||||||||||||||||||||||||
Keywords cloud | = newCustomer _json CustomerDto customer StreamContent WCF Web httpClient usingHttpClient customerDto AddCustomerDto public APIs build HttpResponseMessage customerHeadersContentType response httpClientPost null | ||||||||||||||||||||||||||||||||||||
Keywords consistency |
|
||||||||||||||||||||||||||||||||||||
Headings |
|
||||||||||||||||||||||||||||||||||||
Images | We found 1 images on this web page. |
SEO Keywords (Single)
Keyword | Occurrence | Density |
---|---|---|
= | 16 | 0.80 % |
newCustomer | 6 | 0.30 % |
_json | 4 | 0.20 % |
CustomerDto | 4 | 0.20 % |
customer | 4 | 0.20 % |
StreamContent | 3 | 0.15 % |
WCF | 3 | 0.15 % |
Web | 3 | 0.15 % |
httpClient | 2 | 0.10 % |
usingHttpClient | 2 | 0.10 % |
customerDto | 2 | 0.10 % |
AddCustomerDto | 2 | 0.10 % |
public | 2 | 0.10 % |
APIs | 2 | 0.10 % |
build | 2 | 0.10 % |
HttpResponseMessage | 2 | 0.10 % |
customerHeadersContentType | 2 | 0.10 % |
response | 2 | 0.10 % |
httpClientPost | 2 | 0.10 % |
null | 2 | 0.10 % |
SEO Keywords (Two Word)
Keyword | Occurrence | Density |
---|---|---|
= new | 6 | 0.30 % |
newCustomer = | 4 | 0.20 % |
WCF Web | 3 | 0.15 % |
using the | 3 | 0.15 % |
customerDto usingHttpClient | 2 | 0.10 % |
customerHeadersContentType = | 2 | 0.10 % |
StreamContent customer | 2 | 0.10 % |
the WCF | 2 | 0.10 % |
Web APIs | 2 | 0.10 % |
public CustomerDto | 2 | 0.10 % |
CustomerDto AddCustomerDto | 2 | 0.10 % |
usingHttpClient httpClient | 2 | 0.10 % |
AddCustomerDto customerDto | 2 | 0.10 % |
need to | 2 | 0.10 % |
httpClient = | 2 | 0.10 % |
new HttpClient_baseAddress | 2 | 0.10 % |
HttpClient_baseAddress CustomerDto | 2 | 0.10 % |
CustomerDto newCustomer | 2 | 0.10 % |
= null | 2 | 0.10 % |
= _json | 2 | 0.10 % |
SEO Keywords (Three Word)
Keyword | Occurrence | Density | Possible Spam |
---|---|---|---|
= _json using | 2 | 0.10 % | No |
newCustomer = null | 2 | 0.10 % | No |
public CustomerDto AddCustomerDto | 2 | 0.10 % | No |
CustomerDto AddCustomerDto customerDto | 2 | 0.10 % | No |
customerDto usingHttpClient httpClient | 2 | 0.10 % | No |
usingHttpClient httpClient = | 2 | 0.10 % | No |
httpClient = new | 2 | 0.10 % | No |
= new HttpClient_baseAddress | 2 | 0.10 % | No |
new HttpClient_baseAddress CustomerDto | 2 | 0.10 % | No |
HttpClient_baseAddress CustomerDto newCustomer | 2 | 0.10 % | No |
CustomerDto newCustomer = | 2 | 0.10 % | No |
= null httpClientDefaultRequestHeadersAcceptAdd_json | 2 | 0.10 % | No |
the WCF Web | 2 | 0.10 % | No |
StreamContent customer = | 2 | 0.10 % | No |
customerHeadersContentType = _json | 2 | 0.10 % | No |
_json using HttpResponseMessage | 2 | 0.10 % | No |
using HttpResponseMessage response | 2 | 0.10 % | No |
HttpResponseMessage response = | 2 | 0.10 % | No |
response = httpClientPost | 2 | 0.10 % | No |
= httpClientPost customer | 2 | 0.10 % | No |
SEO Keywords (Four Word)
Keyword | Occurrence | Density | Possible Spam |
---|---|---|---|
using HttpResponseMessage response = | 2 | 0.10 % | No |
CustomerDto newCustomer = null | 2 | 0.10 % | No |
AddCustomerDto customerDto usingHttpClient httpClient | 2 | 0.10 % | No |
customerDto usingHttpClient httpClient = | 2 | 0.10 % | No |
usingHttpClient httpClient = new | 2 | 0.10 % | No |
httpClient = new HttpClient_baseAddress | 2 | 0.10 % | No |
= new HttpClient_baseAddress CustomerDto | 2 | 0.10 % | No |
new HttpClient_baseAddress CustomerDto newCustomer | 2 | 0.10 % | No |
HttpClient_baseAddress CustomerDto newCustomer = | 2 | 0.10 % | No |
newCustomer = null httpClientDefaultRequestHeadersAcceptAdd_json | 2 | 0.10 % | No |
the WCF Web APIs | 2 | 0.10 % | No |
customerHeadersContentType = _json using | 2 | 0.10 % | No |
= _json using HttpResponseMessage | 2 | 0.10 % | No |
_json using HttpResponseMessage response | 2 | 0.10 % | No |
HttpResponseMessage response = httpClientPost | 2 | 0.10 % | No |
response = httpClientPost customer | 2 | 0.10 % | No |
= httpClientPost customer newCustomer | 2 | 0.10 % | No |
httpClientPost customer newCustomer = | 2 | 0.10 % | No |
public CustomerDto AddCustomerDto customerDto | 2 | 0.10 % | No |
CustomerDto AddCustomerDto customerDto usingHttpClient | 2 | 0.10 % | No |
Internal links in - alexanderzeitler.com
Fixing Chrome 58+ [missing_subjectAltName] with openssl when using self signed certificates | Alexander Zeitler
Accessing an HTTP API running on your MacBook in a Docker container from your iPhone/iPad using dnsmasq | Alexander Zeitler
Deploying Ubuntu Mate Desktop as a developer environment in a Azure VM | Alexander Zeitler
Deploying Ubuntu Mate Desktop as a developer environment in AWS EC2 | Alexander Zeitler
Debugging mocha tests in a Docker container using Visual Studio Code | Alexander Zeitler
Debugging mocha tests with Visual Studio Code when Node.js is installed using nvm | Alexander Zeitler
Debugging a ES6 Node.js application in a Docker container using Visual Studio Code | Alexander Zeitler
Some thoughts on Open Source Software | Alexander Zeitler
Resizing a VMware Workstation VM partition using GParted - get the swap partition out of my way! | Alexander Zeitler
Workflows: using Docker Machine and Docker Compose together in development | Alexander Zeitler
Chrome crashes on Ubuntu in VMware Workstation | Alexander Zeitler
Rename Visual Studio project including files, folders and namespaces | Alexander Zeitler
A lap around AWS and docker-machine | Alexander Zeitler
Integration-testing ASP.NET 5 / MVC 6 Controllers on DNX Beta 4 | Alexander Zeitler
Deploying a ASP.NET MVC 6 API as Azure API App in Azure App Services | Alexander Zeitler
lowerCamelCase JSON with ASP.NET MVC 6 | Alexander Zeitler
Running ASP.NET 5 Beta 4 in Docker with DNX runtime #aspnet5 #docker | Alexander Zeitler
Stop complaining or improve yourself | Alexander Zeitler
#NodeJS / #ExpressJS: Adding routes dynamically at runtime | Alexander Zeitler
mongoose: Referencing schema in properties or arrays | Alexander Zeitler
MongoDB development environment journal size management using mongoctl | Alexander Zeitler
Farewell... | Alexander Zeitler
Inspecting AngularJS $scope using Firebug and Chrome Developer Tools | Alexander Zeitler
Useful @Brackets extensions for Web Developers | Alexander Zeitler
.NET User Group Karlsruhe: StreamInsight: Complex Event Processing by Microsoft | Alexander Zeitler
“Commit all must be called when a managed buffer has focus” in Microsoft SQL Server Data Tools | Alexander Zeitler
.NET User Group Karlsruhe: Git | Alexander Zeitler
Open Source Windows 8 App: Sprudelsuche | Alexander Zeitler
Open Source– Scheissegal? | Alexander Zeitler
Lowercase JSON with ASP.NET Web API | Alexander Zeitler
.NET Usergroup Karlsruhe: Think Big – Entwicklung skalierbarer Anwendungen mit Windows Azure | Alexander Zeitler
ASP.NET Web API and RavenDb | Alexander Zeitler
ASP.NET Web API Round-Up Slides | Alexander Zeitler
ASP.NET MVC 4 public beta including ASP.NET Web API | Alexander Zeitler
Hash Bang Urls in Single Page Applications mit ASP.NET MVC | Alexander Zeitler
.NET User Group Karlsruhe: Know your Tools | Alexander Zeitler
Git flow init liefert: flags: FATAL unable to determine getopt version unter Cygwin | Alexander Zeitler
Using JsonValue and JsonArray in WCF Web API | Alexander Zeitler
.NET User Group Karlsruhe: PowerShell 3.. 2.. 1.. | Alexander Zeitler
What’s new in WCF Web API Preview 5 – introducing the test client | Alexander Zeitler
Externe Templates in KnockoutJS laden | Alexander Zeitler
WCF Web API: Role based access control with basic authentication | Alexander Zeitler
.NET User Group Karlsruhe: Produce Cleaner Code with Aspect-Oriented Programming (AOP) | Alexander Zeitler
REST using the WCF Web API – POST it! | Alexander Zeitler
REST using the WCF Web API – getting more RESTful responses (Part 5) | Alexander Zeitler
TypeLoadException when mocking COM objects - Could not load type … from assembly. The type is marked… | Alexander Zeitler
REST using the WCF Web API – getting RESTful the BDD way (Part 4) | Alexander Zeitler
REST using the WCF Web API – refactoring to IoC style (Part 3) | Alexander Zeitler
REST using the WCF Web API – Basics (Part2) | Alexander Zeitler
Microsoft Web API – the REST is done by WCF (Part 1) | Alexander Zeitler
Microsoft Web API – den REST macht WCF (Teil 1) | Alexander Zeitler
.NET User Group Karlsruhe: Flexible Softwarearchitekturen mit Inversion of Control (IoC) | Alexander Zeitler
machine.fakes ReSharper Templates | Alexander Zeitler
CreateCert.cmd aus dem Windows Azure Platform Training Kit funktioniert nicht | Alexander Zeitler
JSON via jQuery direkt an einen ASP.NET MVC 3 Controller senden | Alexander Zeitler
POSTing Json data using the HttpClient from WCF Web API | Alexander Zeitler
Using the new WCF Web APIs HttpClient with ASP.NET Forms Authentication | Alexander Zeitler
Keyboard Jedi unter x64 | Alexander Zeitler
Using WCF Web APIs / WCF Http with ASP.NET Forms Authentication | Alexander Zeitler
WCF Web APIs / WCF Http mit ASP.NET Forms Authentication verwenden | Alexander Zeitler
ILSpy – Open Source .NET Assembly Browser und Decompiler | Alexander Zeitler
Alexanderzeitler.com Spined HTML
POSTing Json data using the HttpClient from WCF Web API | Alexander Zeitler Toggle navigation Home Feed POSTing Json data using the HttpClient from WCF Web API Written on March 21, 2011 If you need to POST Json data to your REST service, you can do this pretty straight forward using the HttpClient from the WCF Web APIs: public CustomerDto Add(CustomerDto customerDto) { using(HttpClient httpClient = new HttpClient(_baseAddress)) { CustomerDto newCustomer = null; httpClient.DefaultRequestHeaders.Accept.Add(_json); JavaScriptSerializer jsonSerializer = new JavaScriptSerializer(); byte[] customerBytes = Encoding.UTF8.GetBytes(jsonSerializer.Serialize(customerDto)); using (MemoryStream stream = new MemoryStream(customerBytes)) { StreamContent consumer = new StreamContent(stream); customer.Headers.ContentType = _json; using (HttpResponseMessage response = httpClient.Post("", customer)) { newCustomer = jsonSerializer.Deserialize<CustomerDto>(response.Content.ReadAsString()); } } return newCustomer; } } where _json is _json = new MediaTypeWithQualityHeaderValue("application/json"); The lawmaking applies to the WCF Web APIs Preview 3. Update: You know what? It's plane simpler using the new HttpContentExtensions and JsonContentExtensions: public CustomerDto Add(CustomerDto customerDto) { using(HttpClient httpClient = new HttpClient(_baseAddress)) { CustomerDto newCustomer = null; httpClient.DefaultRequestHeaders.Accept.Add(_json); StreamContent consumer = customerDto.ToContentUsingDataContractJsonSerializer() as StreamContent; customer.Headers.ContentType = _json; using (HttpResponseMessage response = httpClient.Post("", customer)) { newCustomer = response.Content.ReadAsObject<CustomerDto>(); } } return newCustomer; } In specimen you're missing the Microsoft.Http.Extensions.dll: you need to fix the build output path inside the Microsoft.Net.Http.Extensions project to point to the worldwide build directory. Thanks to Glenn Block for pointing me to the Extensions. Please enable JavaScript to view the comments powered by Disqus. Copyright © Alexander Zeitler 2003 - 2016 | Impressum