XML response

zaczac Member Posts: 29
Hi guys,
I'm using web service technology and messaging to communicate with Navision over NAS. I have to create XML stream as response to web service. My response XML stream should looks like
<soap:Body>
      <GetArticleInformationResponse>
         <GetArticleInformationResult>
            <Items>
               <Item>
                  <Item>
                     <Prices>
                        <Price>
                           <Text>Netto</Text>
                           <Value>52.02</Value>
                           <VAT>0</VAT>
                           <TaxIncluded>false</TaxIncluded>
                           <CurrencyCode>EUR</CurrencyCode>
                           <Rebate>0</Rebate>
                        </Price>
                        <Price>
                           <Text>Brutto</Text>
                           <Value>80.47</Value>
                           <VAT>12.85</VAT>
rest of the tags....
My question is: It's possible to create XML port and export data in the stream without creating a file and send these data over out stream directly to the web service?
And one more: It's possible to tags <item> and <price> in XML port dynamically amplify because customer can check price for one article or for several in the same time?
Thanks

Answers

  • ara3nara3n Member Posts: 9,256
    the answer for 1st question is yes.

    The answer to 2nd depends on what you mean dynamically?

    Are you referring to sending multiple Items in the xml file? Yes.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • zaczac Member Posts: 29
    ara3n wrote:
    Are you referring to sending multiple Items in the xml file? Yes.
    I don't wont to create any XML file. I would like to have core XML port and if customer ask for more then one item and price, there is possibility to extend more <item> and <price> tags... It's possible?
  • ara3nara3n Member Posts: 9,256
    yes.

    by xml file I meant an xml structure in memory.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • zaczac Member Posts: 29
    Any example how I will do it?
  • ara3nara3n Member Posts: 9,256
    Sure I will post an example later when I have time.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ara3nara3n Member Posts: 9,256
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • zaczac Member Posts: 29
    ara3n wrote:

    Thanks ara3n I saw this example but I use MSMQ procedure not directly over XMLHttpConn. I used known example from http://msdn.microsoft.com/en-us/library/ms952079.aspx

    I loaded InStream in XMLDom document and over some function I run XMLport to get some data in OutStream like this:
    myXMLPort.SETTABLEVIEW(recordItem);
    myXMLPort.SETDESTINATION(OutStream);
    myXMLPort.EXPORT;
    
    //Do I load OutStream in XMLDom like this
    XMLDom.load(OutStream);
    
    //Or save it like this
    XMLDom.save(OutStream);
    
    //If I save it in xml file it is ok, like this
    XMLDom.save('c:\OutStream.xml');
    
    //And send
    OutMsg.Send(0);
    
    //When I send it to the web service I get error there
    

    If I use the same XMLDom for loading InStream and OutStream do I have to clear XMLDom after l loaded InStream so I can use again XMLDom for OutStream purpose? I'm confused....
Sign In or Register to comment.