none
FORMATTING WCF RESPONSE RRS feed

  • Question

  • How can I format this response in 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">
          <PaymentValidationResult xmlns="http://cps.huawei.com/cpsinterface/c2bpayment">
             <ResultCode>0</ResultCode>
             <ResultDesc>Received Successfully</ResultDesc>
             <ThirdPartyTransID>100</ThirdPartyTransID>
          </PaymentValidationResult>
       </s:Body>
    </s:Envelope>

    to

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:c2b="http://cps.huawei.com/cpsinterface/c2bpayment">
    <soapenv:Header/>
    <soapenv:Body>
    <c2b:C2BPaymentValidationResult>
    <ResultCode>0</ResultCode>
        <ResultDesc>Service processing successful</ResultDesc>
        <ThirdPartyTransID>100</ThirdPartyTransID>
    </c2b:C2BPaymentValidationResult>
    </soapenv:Body>
    </soapenv:Envelope>

    Friday, August 12, 2016 10:54 AM

Answers

  • Hi SARTO,

    For formatting response, you could try custom MessageEncoder or Custom MessageFormatter and a derived Message class.

    You could refer the link below for more information.
    # Customize WCF Envelope and Namespace Prefix
    http://vanacosmin.ro/Articles/Read/WCFEnvelopeNamespacePrefix

    Best Regards,

    Edward

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.
    Microsoft does not control these sites and has not tested any software or information found on these sites;
    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Saturday, August 13, 2016 6:06 AM

All replies

  • Hi SARTO,

    For formatting response, you could try custom MessageEncoder or Custom MessageFormatter and a derived Message class.

    You could refer the link below for more information.
    # Customize WCF Envelope and Namespace Prefix
    http://vanacosmin.ro/Articles/Read/WCFEnvelopeNamespacePrefix

    Best Regards,

    Edward

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.
    Microsoft does not control these sites and has not tested any software or information found on these sites;
    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Saturday, August 13, 2016 6:06 AM
  • Hi EDWARD

    Thank you for your response.

    Have gone through the link you sent but am unable to apply it to the above case. Could you be having a workaround for the same.

    It will be of great help.

    Monday, August 15, 2016 5:34 AM
  • Hi SARTO,

    >> Have gone through the link you sent but am unable to apply it to the above case

    Could you share us what you have tried and where it did not work for you? It would be helpful if you could share us more information about your implementation and issues.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, August 16, 2016 7:53 AM