简体   繁体   中英

x-www-form-urlencoded response ignored by WCF Service call

I am calling a SOAP service in the following way

BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
EndpointAddress address = new EndpointAddress(System.Configuration.ConfigurationManager.AppSettings.Get("ServiceUri"));
ChannelFactory<IServiceInterface> factory = new ChannelFactory<IServiceInterface>(binding, address);
ISecPay3DSecure channel = factory.CreateChannel();

string rawResponse = channel.MethodName(params);

I generated the IServiceInterface by using WSDL.exe thus:

wsdl /si https://serviceUri

I then marked the generated interface with the [ServiceContract] and [OperationContract] attributes.

when I call the channel.MethodName(..); method it appears to work fine, but the string it is supposed to return is always null , I have fired up fiddler and can see that actually the service is responding correctly and it seems that the problem lies with the channel is simply not dealing with the response correctly, thus:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Date: Thu, 11 Sep 2014 08:48:02 GMT
Transfer-Encoding: chunked
Connection: Keep-Alive

529
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body><ns1:ServiceRequestResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://tempuri.org/">
<ServiceRequestReturn xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">/">?valid=true&amp;test_status=true&amp;tra....

presumably I am missing something in the channel configuration?

any pointers would be gratefully recieved

I have also tried adding a ClientMessageInspecor to see what is actually going on and again the System.ServiceModel.Channels.Message reply does have the data in. but once it is returned to the caller it has been set to null..

thanks

似乎是因为我从接口方法中省略了[return: System.Xml.Serialization.SoapElementAttribute("NameOfSoapElement")]属性

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM