<SOAP-ENV:Fault>  Premature end of file

Version 1
    This document was generated from CDN thread

    Created by: Dan Coffey on 24-06-2009 03:35:20 PM
    I'm writing my first SOAP-AXL code and I'm getting the same error from several attempts.
    I've matched the sample XML in the XML Dev Guide 7.0(1) for getUser and executeSQLQuery. 
    XML Dev Guide 7.0(1) page 1.4 getUser example, the XML below matches the Dev Guide
    Obviously I'm doing something wrong, but I can't see it.
    Thanks for any help.
     
    Dan
     
    The Java String I'm sending is:
     
    "<SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <SOAP-ENV:Body>
                <axl:getUser xmlns:axl="http://www.cisco.com/AXL/7.0"
                    si:schemaLocation="http://www.cisco.com/AXL/API/7.0  http://192.168.5.58/schema/axlsoap.xsd"
                    sequence="1234">
                      <userid>*</userid>
                </axl:getUser>
             </SOAP-ENV:Body> 
    </SOAP-ENV:Envelope> "
     
    the second try I replace <userid>*</userid> with <userid>Greenberg</userid> and still get the same error
     
    The return is:
     
    "<SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
    <SOAP-ENV:Fault>
    <faultcode>SOAP-ENV:Client</faultcode>
    <faultstring>Premature end of file.</faultstring>
    <detail>
    <axl:Error xmlns:axl="http://www.cisco.com/AXL/API/1.0">
    <axl:code>5001</axl:code>
    <axl:message>Premature end of file.</axl:message>
    <request/>
    /axl:Error>
    </detail>
    </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>"

    Subject: RE: <SOAP-ENV:Fault>  Premature end of file
    Replied by: Stephan Steiner on 24-06-2009 04:14:13 PM
    I took that request, put it in an XML file and opened it in a webbrowser (my standard behavior when I don't trust something.. and don't worry.. I have to do it plenty of times for my own strings.. and I also do it for CCM's responses).
     
    Firefox tells me XML Parsing Error: prefix not bound to a namespace and refers to </axl:getUser>.
     
    Now, that's not quite correct since you have
    xmlns:axl="http://www.cisco.com/AXL/7.0"
    in your code. However, the error starts immediately after that.
     
    The next line is
     
    si:schemaLocation="http://www.cisco.com/AXL/API/7.0  http://192.168.5.58/schema/axlsoap.xsd"
     
    and there's an x missing.. it should be xsi:schemaLocation=....
     
    Then, Firefox displays the whole thing as valid XML so that's step 1. Then, you using * tells me you want to list all users. To get lists of things, AXL offers two means: one is sending SQL queries (executeSqlQuery), the other is the list operations.. e.g. listUserByName, which takes 3 parameters: firstName, lastName and searchLimit (the maximum number of results).. and it allows you to use the wildcard * for firstName and lastName.
     
    getUser in itself requires that you specify a userid of an enduser configured in callmanager - first names or last names won't work, and neither will wildcards.

    Subject: RE: <SOAP-ENV:Fault>  Premature end of file
    Replied by: David Staudt on 24-06-2009 04:40:48 PM
    Also it seems AXL does not like the line breaks within an element.  I made the following changes and the request succeeded on CM7.0(1):
     
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <SOAP-ENV:Body>
                <axl:getUser xmlns:axl="http://www.cisco.com/AXL/7.0" xsi:schemaLocation="http://www.cisco.com/AXL/API/7.0  http://192.168.5.58/schema/axlsoap.xsd" sequence="1234">
                      <userid>dstaudt</userid>
                </axl:getUser>
             </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
     
    As Stephen notes, getUser won't work for wildcard.

    Subject: RE: <SOAP-ENV:Fault>  Premature end of file
    Replied by: Dan Coffey on 24-06-2009 09:13:21 PM
    Thanks, for the reply. 
    I fixed the si= and changed it to xsi= (the documentation needs to be fixed)
    I checked that the String I'm writing out is one line with no breaks (see below).
    But I'm still getting the same error.  I've included the code I'm using.
    The first test used user="dstaudt"
    The second test used user="wgreenberg"
    The second user is in LDAP.
    I can't see what I'm doing wrong.
     
    Dan

    This is the Java code that creates outbound String axlString and the response ldapInputStream.

                axlOutPutStream = urlConn.getOutputStream();
                axlInPutStream = urlConn.getInputStream();
                  BufferedWriter axlBufferedWriter = new BufferedWriter(new OutputStreamWriter(axlOutPutStream));
            try {
       1          String axlString = createAXLEnvelope("axl:getUser", "userid", "dstaudt");// first test
       2        String axlString = createAXLEnvelope("axl:getUser", "userid","wgreenberg");//second test
                axlBufferedWriter.write(axlString);
                axlBufferedWriter.flush();
                axlBufferedWriter.close();
                  ldapInputStream = toString(axlInPutStream);

    I can't see any breaks in the String below in the text editor.
     
    axlString =
    " <SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <SOAP-ENV:Body>    <axl:getUser
    xmlns:axl="http://www.cisco.com/AXL/7.0
    xsi:schemaLocation="http://www.cisco.com/AXL/API/7.0 
    http://192.168.5.58/schema/axlsoap.xsd"   sequence="1234"> 
    <userid>dstaudt</userid>  </axl:getUser> 
    </SOAP-ENV:Body>  </SOAP-ENV:Envelope> "


    "<SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header/><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>Premature
    end of file.</faultstring><detail><axl:Error
    xmlns:axl="http://www.cisco.com/AXL/API/1.0"><axl:code>5001</axl:code><axl:message>Premature
    end of
    file.</axl:message><request/></axl:Error></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>"

    Subject: RE: <SOAP-ENV:Fault>  Premature end of file
    Replied by: David Staudt on 25-06-2009 12:28:03 AM
    Something seems not right...can you obtain the AXL service logs using the RTMT tool from UCM?  The logs should contain exactly what is being received from the client, and you may spot something...attach here if  you like.

    Subject: RE: <SOAP-ENV:Fault>  Premature end of file
    Replied by: Dan Coffey on 25-06-2009 01:38:46 AM
    I found my problem.
    I was not setting the SOAP payload size and the AXL server did not know were the SOAP message ended.
     
    Thanks for you help
     
    Dan