locked
Help on WCF service to process xml request RRS feed

  • Question

  • User136609187 posted

    Iam currently working on WCF to create a service that accepts an xml request and send xml response.
    I have the sample request and response xml from client.
    Basically the WCF service will be invoked by an ESB and will send request xml to WCF service.
    Within the service i have to read few values and do some calculations and then send the modified values in response XML.

    I have previously created WCF service which is being consumed by .Net apps by adding service reference.

    How can i create response XML in c# in specific format?

    No idea on how to go ahead with this.

    Please could you help me out with some sample

    Many Thanks

    Tuesday, July 9, 2013 10:23 PM

Answers

All replies

  • Wednesday, July 10, 2013 2:00 AM
  • User-836030956 posted

    Hello,

          here is easiest way to doing same.

       i. required to create type dataset in your project(Xsd file add table with column which you needs as out put)

       ii. now use svcutil.exe its part of .net and using this exe you can create data contarct from xsd file.

       ii. now you can use this class for responce object 

    Regards,

    Bhavik Solanki

       

    Wednesday, July 10, 2013 2:09 AM
  • User136609187 posted

    Please find below the request and response xml please could you help me out how to start with this.

    Request Xml
    -----------------
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
          xmlns:ns="ns:nsvs:services:schema:message:nsvsmetadata:v01"
          xmlns:ns1="ns:nsvs:services:schema:message:nsbcontext:v01"
          xmlns:ns2="ns:nsvs:location:v01">
     <soapenv:Header>
      <ns:NSVMetaData>
       <ns:ServiceCallerID>MLPCenter</ns:ServiceCallerID>
      </ns:NSVMetaData>
      <ns1:NSVContext soapenv:mustUnderstand="true" >
       <ns1:BusinessType>MLPCenter</ns1:BusinessType>
       <ns1:BusinessInstanceId>345352</ns1:BusinessInstanceId>
      </ns1:NSVContext>
     </soapenv:Header>
     <soapenv:Body>
      <ns2:convertMapRq>
       <ns2:FromMapRq>
        <ns2:Mapcode>
         <ns2:SysType>MLP Ref System</ns2:SysType>
         <ns2:XCoord>2333455.22</ns2:XCoord>
         <ns2:YCoord>4564562.19</ns2:YCoord>
        </ns2:Mapcode>
       </ns2:FromMapRq>
       <ns2:ToMapRq>
        <ns2:Mapcode>
         <ns2:Id>1</ns2:Id>
         <ns2:SysType>MLW System</ns2:SysType>
        </ns2:Mapcode>
       </ns2:ToMapRq>
      </ns2:convertMapRq>
     </soapenv:Body>
    </soapenv:Envelope>

    Response Xml
    ------------------

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
          xmlns:ns="ns:nsvs:services:schema:message:common:nsvsmetadata:v01"
          xmlns:ns1="ns:nsvs:services:schema:message:common:nsbcontext:v01"
          xmlns:ns2="ns:nsvs:location:v01">
     <soapenv:Header>
      <ns:ESBMetaData>
       <ns:ServiceCallerID>MLPCenter</ns:ServiceCallerID>
      </ns:ESBMetaData>
      <ns1:NSVContext soapenv:mustUnderstand="true" >
       <ns1:BusinessType>MLPCenter</ns1:BusinessType>
       <ns1:BusinessInstanceId>345352</ns1:BusinessInstanceId>
      </ns1:NSVContext>
     </soapenv:Header>
     <soapenv:Body>
      <ns2:convertMapRs>
       <ns2:convertMapRs>
        <ns2:Mapcode>
         <ns2:Id>1</ns2:Id>
         <ns2:SysType>MLP Ref System</ns2:SysType>
         <ns2:XCoord>2333455.22</ns2:XCoord>
         <ns2:YCoord>4564562.19</ns2:YCoord>
          </ns2:Mapcode>
      </ns2:convertMapRs>
       <ns2:ToMapcode>
        <ns2:Mapcode>
         <ns2:Id>1</ns2:Id>
         <ns2:SysType>MLO Ref System</ns2:SysType>
         <ns2:XCoord>14.971231</ns2:XCoord>
         <ns2:YCoord>61.908761</ns2:YCoord>
        </ns2:Mapcode>
       </ns2:ToMapcode>
      </ns2:convertMapRs>
     </soapenv:Body>
    </soapenv:Envelope>

     

    Wednesday, July 10, 2013 5:15 AM
  • User136609187 posted


    How can i create a WCF service with its input parameter and output as xml?

    Please help me out..

    Thanks

    Thursday, July 11, 2013 6:54 AM
  • User260886948 posted


    How can i create a WCF service with its input parameter and output as xml?

    Please help me out..

    Thanks

    Hi,

    Please try the following article:

    # WCF or WSDL or SOAP Request and Response XML Messages:

    http://jana-visuals.blogspot.in/2010/11/wcf-or-wsdl-or-soap-request-and.html.

    http://www.go4answers.com/Example/creating-wcf-service-xml-request-xml-45651.aspx .

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/3af25271-1471-41b1-94b1-56b3eb7559a9/wcf-and-xml-requestresponse-using-http-post .

    Hope it can help you.

    Best Regards,
    Amy Peng 

      

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 15, 2013 10:24 PM