我有一个Web服务方法,可以在没有(SOAPAction:“”)
的情况下返回以下响应方法
public string SyncData(Stream xml)
{
}
的web.config
<service behaviorConfiguration="" name="PRO.API">
<endpoint address="" behaviorConfiguration="web" binding="customBinding"
bindingConfiguration="RawReceiveCapable" contract="PRO.IAPI" />
</service>
customBinding
<customBinding>
<binding name="RawReceiveCapable">
<webMessageEncoding webContentTypeMapperType="PRO.RawContentTypeMapper, PRO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<httpTransport manualAddressing="true" maxReceivedMessageSize="524288000" transferMode="Streamed" />
</binding>
</customBinding>
public class RawContentTypeMapper : WebContentTypeMapper
{
public override WebContentFormat GetMessageFormatForContentType(string contentType)
{
if (contentType.Contains("text/xml")
|| contentType.Contains("application/xml")
|| contentType.Contains("text/html"))
{
return WebContentFormat.Raw;
}
else
{
return WebContentFormat.Default;
}
}
}
SOAPAction所需的响应:“”
Content-Type:text / xml; charset = utf-8 内容长度:346 SOAPAction :“”
<soapenv:Envelope" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<syncOrderRelationResponse xmlns="http://www.csapi.org/schema/parlayx/data/sync/v1_0/local">
<result>0</result>
<resultDescription>success</resultDescription>
</syncOrderRelationResponse>
</soapenv:Body>
</soapenv:Envelope>
我应该怎样做才能获得SOAPAction的响应,谢谢你的帮助?
请参阅此链接以获取“示例SOAP响应” http://support.sas.com/documentation/cdl/en/wbsvcdg/62759/HTML/default/viewer.htm#n1wblekhip1yrln1fv2s5b6a2d9f.htm
答案 0 :(得分:1)
您可以在OperationContract属性中指定Action属性。请查看此问题How to specify custom SoapAction for WCF