Send to webservice with a complete XML document inside a parameter - InfoPath Dev
in

InfoPath Dev

Send to webservice with a complete XML document inside a parameter

Last post 07-21-2010 05:03 AM by mlarsen_dk. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-20-2010 06:04 AM

    Send to webservice with a complete XML document inside a parameter

    Hi,

     I'm trying to make an Inforpath 2010 form which shoul call an existing WebService. The webservice is not under our control, so I can't change the way it works, only hope I can gat InfoPath to create the request to the likings of the Webservice.

    The webservice will accept a request like this (notice that the actual XML we're sending is embedded in the <XML> tag but that the tags within this tag needs to be HTML formatted, ie. &lt; and &gt; ):
    For the sake of simplicity, I'v only included one of the sections of the embedded XML, in real life it is considerably larger.

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema" xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Body>
    <tns:OpretKladde xmlns:tns="http://heweb.dk/webservices/hexml/">
    <tns:brugernavn>XXXX</tns:brugernavn>
    <tns:adgangskode>XXXXXX</tns:adgangskode>
    <tns:xml>&lt;kladde&gt;
       &lt;eftersyn&gt;
        &lt;ejendoms_forsikring&gt;Forsikring&lt;/ejendoms_forsikring&gt;
        &lt;reference&gt;MIL-001&lt;/reference&gt;
        &lt;tidl_tilstandsrapport&gt;Fra 2007&lt;/tidl_tilstandsrapport&gt;
        &lt;tidl_energimaerke&gt;Fra 2008&lt;/tidl_energimaerke&gt;
        &lt;bestiller&gt;Forsikringsselskab&lt;/bestiller&gt;
        &lt;besigt_dato&gt;2010-07-20&lt;/besigt_dato&gt;
        &lt;bbr_dato&gt;2010-06-30&lt;/bbr_dato&gt;
        &lt;bemaerkning&gt;sdfsfsd&lt;/bemaerkning&gt;
        &lt;starttid&gt;08:00&lt;/starttid&gt;
        &lt;sluttid&gt;10:00&lt;/sluttid&gt;
       &lt;/eftersyn&gt;
    &lt;/kladde&gt;
    </tns:xml></tns:OpretKladde></SOAP-ENV:Body></SOAP-ENV:Envelope>

    I've managed to generate a request where the &lt; and &gt; is just regular < and >, but the webservcie will not accept this.

    Is there any way I can generate the internal XML structure like the above example?

    Best regards, 

    Michael Larsen

  • 07-21-2010 05:03 AM In reply to

    Re: Send to webservice with a complete XML document inside a parameter

    Ahaaa! I figured it out myself :-)

     If anyboby runs into the same problem, I'll post my findings here:

     To get the XML structure to look like above, you need to modify the settings for the WebService connection. Specifically, you need to select the parameter witch contains the XML you want to transfer within the tag, and then check the "Send data as a string" checkbox in the bottom of the parameters.

    That's it, it's really that simple - no coding or anything :-)

    /Michael

     

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.