none
How to simulate soap fault or HTTP404 in wcf RRS feed

  • Question

  • Hi 

      How to simulate soap fault or HTTP404 in wcf .how we can send a exception HTTP404 as soapfault 

    Wednesday, July 26, 2017 5:35 AM

All replies

  • Hi bhavijesh,

    What is your requirement?

    Based on subject, it seems you want to simulate SOAP Fault or HTTP 404.

    Based on content, it seems you want to return HTTP 404 as SOAPFault.

    It would be helpful if you could share us detail information about your requirement.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, July 27, 2017 2:38 AM
  • Hi Edward,

                       My Requestformat,

                        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Header/>
       <soapenv:Body/>
    </soapenv:Envelope>

    My Responseformat

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:imt="http://cps.huawei.com/cpsinterface/imtrecvmoney">
       <soapenv:Body>
          <imt:IMTInquiryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
             <TransactionInfo>
                <ActualAmount>10</ActualAmount>
                <Amount>10</Amount>
                <Currency>ETB</Currency>
                <IMT_TransactionId>Kaah117</IMT_TransactionId>
                <RecipientCountryCode>ET</RecipientCountryCode>
                <TransactionState>Completed</TransactionState>
                <TransferTime>20170406</TransferTime>
             </TransactionInfo>
          </imt:IMTInquiryResponse>
       </soapenv:Body>
    </soapenv:Envelope>

    If Some times our Response is not sucessfull at that time i want to send a soap error

    Means want to return HTTP 404 as SOAPFault.

    Thursday, July 27, 2017 6:52 AM
  • Hi bhavijesh,

    What do you mean by return HTTP 404 as SoapFault? As my understanding, http 404 is return when the request resource not found.

    If you want to return SOAPFault, I suggest you refer below link.

    # Sending and Receiving Faults

    https://docs.microsoft.com/en-us/dotnet/framework/wcf/sending-and-receiving-faults

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, July 28, 2017 5:06 AM