I'm trying to set up a webservice using nuSoap (0.9.5v), so in my productList.php I wrote this
require_once("./lib/nusoap.php");
$server = new soap_server();
$server->configureWSDL('hellowsdl', 'tns:hellowsdl');
$server->register('hello', array('name' => 'xsd:string'), array('return' => 'xsd:string'), 'tns:hellowsdl', 'tns:hellowsdl#hello', 'rpc', 'encoded', 'Returns hello name');
function hello($name) { return 'Hello, ' . $name.' !!!'; }
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
And it generate this WSDL:
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="tns:hellowsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="tns:hellowsdl">
<types>
<xsd:schema targetNamespace="tns:hellowsdl">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:schema>
</types>
<message name="helloRequest">
<part name="name" type="xsd:string"/>
</message>
<message name="helloResponse">
<part name="return" type="xsd:string"/>
</message>
<portType name="hellowsdlPortType">
<operation name="hello">
<documentation>Returns hello name</documentation>
<input message="tns:helloRequest"/>
<output message="tns:helloResponse"/>
</operation>
</portType>
<binding name="hellowsdlBinding" type="tns:hellowsdlPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="hello">
<soap:operation soapAction="tns:hellowsdl#hello" style="rpc"/>
<input>
<soap:body use="encoded" namespace="tns:hellowsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="tns:hellowsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="hellowsdl">
<port name="hellowsdlPort" binding="tns:hellowsdlBinding">
<soap:address location="http://www.sitidicarde.altervista.org/soap/productlist.php"/>
</port>
</service>
</definitions>
Now, if I create a project in soapUI linked to that WSDL it gives me this input
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="tns:hellowsdl" xmlns:nam="NAMESPACE" xmlns:res="RESULT">
<soapenv:Header/>
<soapenv:Body>
<tns:hello soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<name xsi:type="xsd:string">ASD</name>
</tns:hello>
</soapenv:Body>
</soapenv:Envelope>
And when I click submit it gives me no output and a Error Log that says:
Thu Jan 02 02:10:53 CET 2014:ERROR:org.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body (expected: 515; received: 271
org.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body (expected: 515; received: 271
at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:178)
at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:197)
at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:155)
at org.apache.http.util.EntityUtils.toByteArray(EntityUtils.java:100)
at org.apache.http.entity.BufferedHttpEntity.<init>(BufferedHttpEntity.java:60)
at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpMethodSupport.getResponseBody(HttpMethodSupport.java:281)
at com.eviware.soapui.impl.wsdl.submit.transports.http.support.methods.ExtendedPostMethod.getResponseBody(ExtendedPostMethod.java:128)
at com.eviware.soapui.impl.wsdl.submit.transports.http.SinglePartHttpResponse.<init>(SinglePartHttpResponse.java:49)
at com.eviware.soapui.impl.wsdl.submit.transports.http.support.attachments.WsdlSinglePartHttpResponse.<init>(WsdlSinglePartHttpResponse.java:36)
at com.eviware.soapui.impl.wsdl.submit.filters.HttpPackagingResponseFilter.wsdlRequest(HttpPackagingResponseFilter.java:71)
at com.eviware.soapui.impl.wsdl.submit.filters.HttpPackagingResponseFilter.afterAbstractHttpResponse(HttpPackagingResponseFilter.java:48)
at com.eviware.soapui.impl.wsdl.submit.filters.AbstractRequestFilter.afterRequest(AbstractRequestFilter.java:64)
at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:290)
at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:123)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
EDIT
I change my soapUI's poperties like this:
In my opinion the problem is that soapUI doesn't find an Input and an Output declared when instead in the WSDL are declared.
And my code now is this:
require_once("./lib/nusoap.php");
$server = new soap_server();
$namespace = "tns:hellowsdl";
$server->configureWSDL('hellowsdl');
$server ->wsdl->schemaTargetNamespace = $namespace;
$server->register('hello', array('name' => 'xsd:string'), array('return' => 'xsd:string'), 'tns:hellowsdl', 'tns:hellowsdl#hello', 'rpc', 'encoded', 'Returns hello name');
function hello($name) { return 'Hello, ' . $name.' !!!'; }
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
Probrably the problem is in my host. I gave at Asim the correct answer and the bounty becaude it helped me to figure out to change host :)