1

I have a requirement to be able to pull data from a repeating table on an InfoPath form and put it into a report. I found a solution file on Codeplex that will read the data out of the repeating table and output it as XML via a SOAP query. I'm trying to read the SOAP query and output it to a web page via JQuery in a CEWP. I'm fairly new to trying this and I'm a little lost on how to approach this. The web service presents this example code:

POST /_vti_bin/InfoPathDB/InfoPathDB.asmx HTTP/1.1
Host: 10.158.2.5 
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>

<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
 <soap12:Body>
    <QueryFormLibrary xmlns="http://infopathdb.codeplex.com/">
      <SiteURL>string</SiteURL>
      <FormLibraryTitle>string</FormLibraryTitle>
      <OptionalContentType>string</OptionalContentType>
      <OptionalCAMLFilter>string</OptionalCAMLFilter>
      <OptionalBooleanIncludeAttachments>string</OptionalBooleanIncludeAttachments>
    </QueryFormLibrary>
 </soap12:Body>
</soap12:Envelope>

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <QueryFormLibraryResponse xmlns="http://infopathdb.codeplex.com/">
      <QueryFormLibraryResult>xml</QueryFormLibraryResult>
    </QueryFormLibraryResponse>
  </soap12:Body>
</soap12:Envelope>

My code block I'm adapting is below. I'm not sure how to shoehorn the example code into my Jquery block, if it is even the right way to go about doing it. Can I test the SOAP query by itself in a CEWP without embedding it in a Jquery block?

<script src="/Site_Assets/jquery-1.10.2.min.js"></script>
<script type="text/javascript">

   $(document).ready(function() {
        var soapEnv =
            <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <QueryFormLibrary xmlns="http://infopathdb.codeplex.com/">
      <SiteURL>http://255.255.255.1</SiteURL>
      <FormLibraryTitle>List Entries</FormLibraryTitle>
      </QueryFormLibrary>
  </soap12:Body>
</soap12:Envelope>";

        $.ajax({
            url: "/_vti_bin/InfoPathDB/InfoPathDB.asmx HTTP/1.1",
            type: "POST",
            dataType: "xml",
            data: soapEnv,
            complete: processResult,
            contentType: "text/xml; charset=\"utf-8\""
        });
    });
// some code that writes the output to the page
}</script>

Any pointers on what I'm doing wrong/right?

0

There are a few options but some would depend on your version of SharePoint and InfoPath.

The AJAX call is going to "call back" your function after the "complete:" which, in your example, is "processResult." You would need to write the "function processResult() { ... }" which is where you would process then be able to process through the returned XML results.

I see on the CodePlex site for the InfoPathDB it now has an option to output JSON which I find preferable to workwith vs. the XML given a choice. The other option would be to use the SPServices jQuery library and call the SPServices.SPXmlToJson function (http://spservices.codeplex.com/wikipage?title=%24().SPXmlToJson)

  • Daniel
  • Daniel - thank you for the pointer. I'm using SP 2010, and InfoPath 2010 as well. I'm still confused as to which of the two sections of example code from the Codeplex example is the one I should use in the SOAP Envelope of my code. – Scott Davis Dec 4 '13 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.