Reputation: 5626
I'm having a difficult time getting a service added via Add Service Reference to work. I can call the service without issue, and I gat a response back (I can see it in Fiddler):
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<executeResponse>
<request_number>REQ0048172</request_number>
</executeResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
However, I get a null for that executeResponse
in there. The relevant pieces from the Reference.cs are below.
Interface:
[System.ServiceModel.ServiceContractAttribute(Namespace="http://www.serviceprovider.com/service")]
public interface Soap {
// CODEGEN: Generating message contract since the operation execute is neither RPC nor document wrapped.
[System.ServiceModel.OperationContractAttribute(Action="http://www.serviceprovider.com/service/execute", ReplyAction="*")]
[System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
executeResponse1 execute(executeRequest request);
}
Client:
public partial class SoapClient : System.ServiceModel.ClientBase<Soap>, Soap {
executeResponse1 Soap.execute(executeRequest request) {
return base.Channel.execute(request);
}
public executeResponse execute(execute execute1) {
executeRequest inValue = new executeRequest();
inValue.execute = execute1;
executeResponse1 retVal = ((Soap)(this)).execute(inValue);
return retVal.executeResponse;
}
}
executeResponse1:
[System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
public partial class executeResponse1 {
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://www.serviceprovider.com/service", Order=0)]
public executeResponse executeResponse;
}
executeResponse:
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.serviceprovider.com/service")]
public partial class executeResponse : object, System.ComponentModel.INotifyPropertyChanged {
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
public string request_number { get; set; }
}
I'm not sure how to go backward from the SOAP response to fixing this issue. Any suggestions would be appreciated.
Upvotes: 0
Views: 535
Reputation: 24396
According to this:
Namespace="http://www.serviceprovider.com/service"
WCF expects the SOAP elements under the body to have the above namespace. However they are null. If you can change the result soap (even just temporarly for testing by mocking it) try to replace the body element with this:
<SOAP-ENV:Body xmlns="http://www.serviceprovider.com/service">
Otherwise try to set Namespace="" in the proxy code (I'm not sure if WCF will allow it). You could also replace this namespace in the WSDL with an empty string which might be a little more robust in terms of generating a proxy.
Finally if this does not help, set up a WCF service based on this WSDL (or directly the data contract you have in your proxy) and see how the soap it returns differs from the one the actual service returns.
Upvotes: 1