Archives for the '.NET' Category
Calling a WCF service from PHP
The WCF service needs to use basicHttpBinding.
The PHP code:
define(’NEWLINE’, “<br />\n”);
// SOAP client
$wsdl = ‘http://example.com/SampleWcfService.SampleService.Service?wsdl’;
$soapClient = new SoapClient($wsdl, array(’cache_wsdl’ => 0));
// SOAP call
$sampleData->SampleProperty = “abc”;
$parameters->sampleId = 123;
$parameters->sampleData = $sampleData;
try
{
$result = $soapClient->GetData($parameters);
}
catch (SoapFault $fault)
{
echo “Fault code: {$fault->faultcode}” . NEWLINE;
echo “Fault string: {$fault->faultstring}” . NEWLINE;
if ($soapClient != null)
{
$soapClient = null;
}
exit();
}
$soapClient = null;
//echo “<pre>\n”;
//print_r($result);
//echo “</pre>\n”;
echo “Return value: {$result->GetDataResult}” […]
Entity Framework Performance Comparison
Caveat emptor: These numbers are merely indicative. The “shape” of your data, your indexing, your SQL Server setup, etc. are big differentiating factors. Your mileage may vary. Do not sue me if you make any architectural decisions based on these figures and discover some fundamental flaw one year down the road, a few days before […]
System.Xml.XmlException: hexadecimal value 0×00 invalid character
I got the following error message when trying to validate an XML file against an XSD file using .NET:
Unhandled Exception: System.Xml.XmlException: ‘.’, hexadecimal value 0×00, is an invalid character. Line 2, position 1.
It turned out that my XSD file was encoded using UCS-2 Little Endian. So I used Notepad++ to convert it to UTF-8 and […]
Snippet Compiler
This is one programming tool I wish I had discovered from the very beginning: Snippet Compiler. It allows you to test out C# code without having to fire up Visual Studio and laboriously create test console applications etc.
Although the latest version (3.0.2 for .NET 3.5) is an alpha, it seems very polished and I have […]
Uniting WCF Tracing with the Unity Application Block
Background
An application in the presentation tier sends a request to a WCF service. With “includeExceptionDetailInFaults” at the WCF service set to false (which is the recommended setting for production environments), should an exception occur in the WCF service, the exception that will be raised in the client application will be along the lines of “the […]
