WCF client not mapping and returning null objects
I've setup a Service Reference (WCF Client) to call a Java Web Service
from a Console Application I've setup for testing. It is using HTTPS. I
have Fiddler setup and can see the proper values being sent and returned
from the service (in Fiddler). But no matter what method I call, the
returned values, regardless if it is a String or an object, comes back as
Null.
I'm not sure if the proxy client mapping isn't working or if I need to
change a configure value in app.config.
app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="ResultsSOAP12Binding">
<textMessageEncoding messageVersion="Soap12" />
</binding>
<binding name="ResultsSOAP12Binding1">
<textMessageEncoding messageVersion="Soap12" />
<httpsTransport />
</binding>
<binding name="ResultsSOAP12Binding2">
<textMessageEncoding messageVersion="Soap12" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="https://services.acme.com/results"
binding="customBinding"
bindingConfiguration="ResultsSOAP12Binding1"
contract="ResultsServiceReference.Result
</client>
</system.serviceModel>
</configuration>
Code:
static void CallResults()
{
var resultsRequest = new
ResultsServiceReference.ResultsRequest();
var client = new
ResultsServiceReference.ResultsPortTypeClient("ResultsSOAP12BindingQSPort");
Console.WriteLine("Call Results Service");
ResultsServiceReference.ResultsBatch result =
client.latestResults(resultsRequest);
Console.WriteLine(result.Status);
Console.ReadLine();
}
In this code the variable result is null, even though when you look in
Fiddler you can see the XML. No error is displayed until you try to use
result.
BTW, I tried setting a breakpoint inside the latestResults method in the
proxy class reference.cs, but the debugger doesn't reach it.
No comments:
Post a Comment