Reputation: 8477
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.
Upvotes: 1
Views: 5574
Reputation: 24436
Most probably the WSDL has a mistake and the schema inside it does not match the actual response XML. You can publish the WSDL (and any referenced XSD) here together with the SOAP response (or mail them to me so I will try to look). Or you can set up a WCF service stub from the exact same WSDL (or from the client contract you already generated) and compare the response WCF sends to the one the actual service sends. You want to look for differences in XML namespaces (and understand delicate parts like if this is default namespace or prefixed one) and in the name of the first element under the body.
Upvotes: 1
Reputation: 7067
You may want to configure and enable WCF diagnostic event tracing and message logging, then rerun the test transaction and review the service trace log file. The following link demonstrates how to enable tracing and message logging.
http://msdn.microsoft.com/en-us/library/ms751526.aspx
In our experience, service discrepancies which otherwise show no obvious error, often show up in the service trace file.
Note: The breakpoint inside the proxy class reference.cs may not be reached because the following attribute has been set:
[System.Diagnostics.DebuggerStepThroughAttribute()]
Upvotes: 1