Error running hellowsdl examples

Help
Fred
2008-12-19
2013-06-06
  • Fred
    Fred
    2008-12-19

    quick note:
    I have posted this message in the mlist before remembering the forum; so, if you will, preferably please use the forum instead, for replying (if anyone can help at all :); however I could not post "teste.html" as i thought it would be possible, so I'm posting the resulting text at the end of this message; sorry for inconvenience.

    So far, I have managed to run a nusoap soap server service without WSDL. Now i'm trying to implement WSDL and all the examples from http://www.scottnichol.com/nusoapprogwsdl.htm fail with the same error. I cannot find any references to this problem anywhere.

    The output is as in teste.html:

    "wsdl error: XML error parsing WSDL from http://localhost/hellowsdl.php?WSDL on line 77: Attribute without value"

    There is no code portion missplaced and nusoap files update from CVS returns the same result.

    I have also tried the "$server->configureWSDL('hellowsdl', 'urn:hellowsdl', false, 'document');" variante as well.

    This goes both for "hellowsdl.php" and "hellowsdl2.php" and any other request with the code structure presented in the examples.

    I'm using PHP5.x and Apache2.2.

    Thanks for any clue you may have.
    Fred

    request file
    ---------------------------
    <?php
    // Pull in the NuSOAP code
    require('../../_common/nusoap2/nusoap.php');

    // Create the client instance
    $client = new nusoap_client('http://localhost/hellowsdl.php?WSDL',true);
    // Check for an error
    $err = $client->getError();
    if ($err) {
        // Display the error
        echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
        // At this point, you know the call that follows will fail
    }
    // Call the SOAP method
    $result = $client->call('hello', array('name' => 'Scott'));
    // Check for a fault
    if ($client->fault) {
        echo '<h2>Fault</h2><pre>';
        print_r($result);
        echo '</pre>';
    } else {
        // Check for errors
        $err = $client->getError();
        if ($err) {
            // Display the error
            echo '<h2>Error</h2><pre>' . $err . '</pre>';
        } else {
            // Display the result
            echo '<h2>Result</h2><pre>';
            print_r($result);
        echo '</pre>';
        }
    }
    // Display the request and response
    echo '<h2>Request</h2>';
    echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
    echo '<h2>Response</h2>';
    echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
    // Display the debug messages
    echo '<h2>Debug</h2>';
    echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
    ?>
    ---------------------------

    server file
    ---------------------------
    <?php
    // Pull in the NuSOAP code
    require('../../_common/nusoap2/nusoap.php');

    // Create the server instance
    $server = new soap_server;

    // Initialize WSDL support
    $server->configureWSDL('hellowsdl', 'urn:hellowsdl');

    // Register the method to expose
    $server->register('hello',                // method name
        array('name' => 'xsd:string'),        // input parameters
        array('return' => 'xsd:string'),      // output parameters
        'urn:hellowsdl',                      // namespace
        'urn:hellowsdl#hello',                // soapaction
        'rpc',                                // style
        'encoded',                            // use
        'Says hello to the caller'            // documentation
    );
    // Define the method as a PHP function
    function hello($me) {
            return 'Hello, ' . $me;
    }
    // Use the request to (try to) invoke the service
    $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
    $server->service($HTTP_RAW_POST_DATA);
    ?>
    ---------------------------

    result
    ---------------------------

    Error

    wsdl error: XML error parsing WSDL from http://localhost/hellowsdl.php?WSDL on line 77: Attribute without value

    Request

    Response

    Debug

    2008-12-19 11:19:39.903570 nusoap_client: ctor wsdl=1 timeout=0 response_timeout=30
    endpoint=string(44) "http://localhost/hellowsdl.php?WSDL"
    2008-12-19 11:19:39.903907 nusoap_client: will use lazy evaluation of wsdl from http://localhost/hellowsdl.php?WSDL
    2008-12-19 11:19:39.904166 nusoap_client: call: operation=hello, namespace=http://tempuri.org, soapAction=, rpcParams=, style=rpc, use=encoded, endpointType=wsdl
    params=array(1) {
      ["name"]=>
      string(5) "Scott"
    }
    headers=bool(false)
    2008-12-19 11:19:39.904428 nusoap_client: instantiating wsdl class with doc: http://localhost/hellowsdl.php?WSDL
    2008-12-19 11:19:39.904718 wsdl: ctor wsdl= timeout=0 response_timeout=30
    2008-12-19 11:19:39.904958 wsdl: parse and process WSDL path=
    2008-12-19 11:19:39.905217 wsdl: setCredentials username= authtype= certRequest=
    array(0) {
    }
    2008-12-19 11:19:39.905464 wsdl: parse and process WSDL path=http://localhost/hellowsdl.php?WSDL
    2008-12-19 11:19:39.905700 wsdl: parse WSDL at path=http://localhost/hellowsdl.php?WSDL
    2008-12-19 11:19:39.905939 wsdl: getting WSDL http(s) URL http://localhost/hellowsdl.php?WSDL
    2008-12-19 11:19:39.906215 soap_transport_http: ctor url=http://localhost/hellowsdl.php?WSDL use_curl= curl_options:
    array(0) {
    }
    2008-12-19 11:19:39.906471 soap_transport_http: parsed URL scheme = http
    2008-12-19 11:19:39.906705 soap_transport_http: parsed URL host = ta-kkrzr7f
    2008-12-19 11:19:39.907155 soap_transport_http: parsed URL path = hellowsdl.php
    2008-12-19 11:19:39.907390 soap_transport_http: parsed URL query = WSDL
    2008-12-19 11:19:39.907638 soap_transport_http: set header Host: ta-kkrzr7f
    2008-12-19 11:19:39.907904 soap_transport_http: set header User-Agent: NuSOAP/1.0rc1 (1.121)
    2008-12-19 11:19:39.908154 soap_transport_http: set header Accept-Encoding: gzip, deflate
    2008-12-19 11:19:39.908391 soap_transport_http: set header Connection: close
    2008-12-19 11:19:39.908633 soap_transport_http: entered send() with data of length: 0
    2008-12-19 11:19:39.908874 soap_transport_http: connect connection_timeout 0, response_timeout 30, scheme http, host ta-kkrzr7f, port 80
    2008-12-19 11:19:39.909120 soap_transport_http: calling fsockopen with host ta-kkrzr7f connection_timeout 0
    2008-12-19 11:19:39.910186 soap_transport_http: set response timeout to 30
    2008-12-19 11:19:39.910570 soap_transport_http: socket connected
    2008-12-19 11:19:39.916634 soap_transport_http: HTTP request: GET hellowsdl.php?WSDL HTTP/1.1
    2008-12-19 11:19:39.916885 soap_transport_http: HTTP header: Host: ta-kkrzr7f
    2008-12-19 11:19:39.917134 soap_transport_http: HTTP header: User-Agent: NuSOAP/1.0rc1 (1.121)
    2008-12-19 11:19:39.917366 soap_transport_http: HTTP header: Accept-Encoding: gzip, deflate
    2008-12-19 11:19:39.917596 soap_transport_http: HTTP header: Connection: close
    2008-12-19 11:19:39.917915 soap_transport_http: wrote data to socket, length = 148
    2008-12-19 11:19:39.974015 soap_transport_http: read line of 17 bytes: HTTP/1.1 200 OK
    2008-12-19 11:19:39.974328 soap_transport_http: read line of 37 bytes: Date: Fri, 19 Dec 2008 11:19:39 GMT
    2008-12-19 11:19:39.974571 soap_transport_http: read line of 30 bytes: Server: Apache/2.2.6 (Win32)
    2008-12-19 11:19:39.974813 soap_transport_http: read line of 22 bytes: Content-Length: 4733
    2008-12-19 11:19:39.975054 soap_transport_http: read line of 19 bytes: Connection: close
    2008-12-19 11:19:39.975296 soap_transport_http: read line of 25 bytes: Content-Type: text/html
    2008-12-19 11:19:39.975536 soap_transport_http: read line of 2 bytes:
    2008-12-19 11:19:39.975809 soap_transport_http: found end of headers after length 152
    2008-12-19 11:19:39.976118 soap_transport_http: want to read content of length 4733
    2008-12-19 11:19:39.976418 soap_transport_http: read buffer of 4733 bytes
    2008-12-19 11:19:39.976673 soap_transport_http: read body of length 4733
    2008-12-19 11:19:39.976917 soap_transport_http: received a total of 4885 bytes of data from server
    2008-12-19 11:19:39.977277 soap_transport_http: closed socket
    2008-12-19 11:19:39.977533 soap_transport_http: No Content-Encoding header
    2008-12-19 11:19:39.977770 soap_transport_http: end of send()
    2008-12-19 11:19:39.978031 wsdl: got WSDL URL
    2008-12-19 11:19:39.978264 wsdl: Parse WSDL
    2008-12-19 11:19:39.978960 wsdl: XML error parsing WSDL from http://localhost/hellowsdl.php?WSDL on line 77: Attribute without value
    2008-12-19 11:19:39.979203 wsdl: XML payload:

            <html><head><title>NuSOAP: hellowsdl</title>
            <style type="text/css">
                body    { font-family: arial; color: #000000; background-color: #ffffff; margin: 0px 0px 0px 0px; }
                p       { font-family: arial; color: #000000; margin-top: 0px; margin-bottom: 12px; }
                pre { background-color: silver; padding: 5px; font-family: Courier New; font-size: x-small; color: #000000;}
                ul      { margin-top: 10px; margin-left: 20px; }
                li      { list-style-type: none; margin-top: 10px; color: #000000; }
                .content{
                margin-left: 0px; padding-bottom: 2em; }
                .nav {
                padding-top: 10px; padding-bottom: 10px; padding-left: 15px; font-size: .70em;
                margin-top: 10px; margin-left: 0px; color: #000000;
                background-color: #ccccff; width: 20%; margin-left: 20px; margin-top: 20px; }
                .title {
                font-family: arial; font-size: 26px; color: #ffffff;
                background-color: #999999; width: 100%;
                margin-left: 0px; margin-right: 0px;
                padding-top: 10px; padding-bottom: 10px;}
                .hidden {
                position: absolute; visibility: hidden; z-index: 200; left: 250px; top: 100px;
                font-family: arial; overflow: hidden; width: 600;
                padding: 20px; font-size: 10px; background-color: #999999;
                layer-background-color:#FFFFFF; }
                a,a:active  { color: charcoal; font-weight: bold; }
                a:visited   { color: #666666; font-weight: bold; }
                a:hover     { color: cc3300; font-weight: bold; }
            </style>
            <script language="JavaScript" type="text/javascript">
            <!--
            // POP-UP CAPTIONS...
            function lib_bwcheck(){ //Browsercheck (needed)
                this.ver=navigator.appVersion
                this.agent=navigator.userAgent
                this.dom=document.getElementById?1:0
                this.opera5=this.agent.indexOf("Opera 5")>-1
                this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
                this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
                this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
                this.ie=this.ie4||this.ie5||this.ie6
                this.mac=this.agent.indexOf("Mac")>-1
                this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
                this.ns4=(document.layers && !this.dom)?1:0;
                this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
                return this
            }
            var bw = new lib_bwcheck()
            //Makes crossbrowser object.
            function makeObj(obj){
                this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
                if(!this.evnt) return false
                this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;
                this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0;
                this.writeIt=b_writeIt;
                return this
            }
            // A unit of measure that will be added when setting the position of a layer.
            //var px = bw.ns4||window.opera?"":"px";
            function b_writeIt(text){
                if (bw.ns4){this.wref.write(text);this.wref.close()}
                else this.wref.innerHTML = text
            }
            //Shows the messages
            var oDesc;
            function popup(divid){
                if(oDesc = new makeObj(divid)){
                oDesc.css.visibility = "visible"
                }
            }
            function popout(){ // Hides message
                if(oDesc) oDesc.css.visibility = "hidden"
            }
            //-->
            </script>
            </head>
            <body>
            <div class=content>
                <br><br>
                <div class=title>hellowsdl</div>
                <div class=nav>
                    <p>View the <a href="hellowsdl.php?wsdl">WSDL</a> for the service.
                    Click on an operation name to view it&apos;s details.</p>
                    <ul><li><a href='#' onclick="popout();popup('hello')">hello</a></li><div id='hello' class='hidden'>
                        <a href='#' onclick='popout()'><font color='#ffffff'>Close</font></a><br><br><font color='white'>Name:</font> hello<br><font color='white'>Binding:</font> hellowsdlBinding<br><font color='white'>Endpoint:</font> http://localhost/hellowsdl.php<br><font color='white'>SoapAction:</font> urn:hellowsdl#hello<br><font color='white'>Style:</font> rpc<br><font color='white'>Input:</font><br>&nbsp;&nbsp;use: encoded<br>&nbsp;&nbsp;namespace: urn:hellowsdl<br>&nbsp;&nbsp;encodingStyle: http://schemas.xmlsoap.org/soap/encoding/<br>&nbsp;&nbsp;message: helloRequest<br>&nbsp;&nbsp;parts:<br>&nbsp;&nbsp;&nbsp;&nbsp;name: xsd:string<br><font color='white'>Output:</font><br>&nbsp;&nbsp;use: encoded<br>&nbsp;&nbsp;namespace: urn:hellowsdl<br>&nbsp;&nbsp;encodingStyle: http://schemas.xmlsoap.org/soap/encoding/<br>&nbsp;&nbsp;message: helloResponse<br>&nbsp;&nbsp;parts:<br>&nbsp;&nbsp;&nbsp;&nbsp;return: xsd:string<br><font color='white'>Namespace:</font> urn:hellowsdl<br><font color='white'>Transport:</font> http://schemas.xmlsoap.org/soap/http<br><font color='white'>Documentation:</font> Says hello to the caller<br></div>
                    <ul>
                </div>
            </div></body></html>
    2008-12-19 11:19:39.979497 nusoap_client: checkWSDL
    2008-12-19 11:19:39.979741 nusoap_client: got wsdl error: XML error parsing WSDL from http://localhost/hellowsdl.php?WSDL on line 77: Attribute without value

     
    • Fred
      Fred
      2008-12-19

      an update:
      ----------
      If requested directly, http://localhost/hellowsdl.php?WSDL will return the WSDL xml schema. It is the request from the client that doesn't work.

       
    • Fred
      Fred
      2008-12-19

      Can't understand this. I want/need the client to access the WSDL but if the call is made as:

      $client = new nusoap_client('http://localhost/hellowsdl.php?WSDL',FALSE);

      which differs from the call presented above in the FALSE argument, the WS works and the result is "Hello, Scott", as expected. I'm totally lost now...

      Which is the correct way to run the server with WSDL and allow the client to parse the results using the WSDL ???

      Thank you. Anyone?
      Fred

       
    • Fred
      Fred
      2009-04-25

      For anyone reading this in the future, its SOLVED. I just started using "false" to set the nusoap_client in a regular basis...