0

I have a web service method which can return below response without (SOAPAction: "")

Method

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;

        }
    }
}

Required Response with SOAPAction: ""

Content-Type: text/xml;charset=utf-8 Content-Length: 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>

What should I do to get response with SOAPAction, thanks in adavnce?

please see this link for "Sample SOAP response" http://support.sas.com/documentation/cdl/en/wbsvcdg/62759/HTML/default/viewer.htm#n1wblekhip1yrln1fv2s5b6a2d9f.htm

4

1 回答 1

1

您可以在 OperationContract 属性中指定 Action 属性。检查这个问题如何为 WCF 指定自定义 SoapAction

于 2013-08-03T18:39:58.057 回答