2013-07-09 61 views
0

我打电话一个典型的SOAP WCF方法void HelloWorld();WCF方法返回空消息元素

不幸的是,响应如下:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
<HelloWorld xmlns="http://tempuri.org/"/> 
</s:Body> 
</s:Envelope> 

有什么办法,我可以从删除<HelloWorld xmlns="http://tempuri.org/"/>线反应(基本上有一个空的<s:Body>)?

+0

它返回进行调用的方法的名称。无论如何,你为什么要忽略它?你想达到什么目的? – vibhu

回答

1

也许它会工作,如果你把这个声明为一个“裸”的服务:

[SoapDocumentService(Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Bare)] 

否则实施custom message inspector(如果它不DOWS工作,然后一个custom message encoder)来更改消息。