PDA

View Full Version : [Java]Problema con wsdl2java helloworld


pmhwp
26-08-2009, 15:01
Ciao,
premetto che non sono molto esperto di web services...sto iniziando adesso a fare le prime prove.

Ecco l'esempio che non riesco a realizzare.
Come prima cosa ho definito la seguente classe:
package pck;

public class CiaoATutti {

public String ciao() {
String results = "Ciao a tutti";
return results;
}
}

Dopodichè ho preso il file CiaoATutti.java e lo ho salvato in formato jws spostandolo nella cartella %CATALINA_HOME%/webapps/axis.

Ho caricato il link http://localhost:8080/axis/CiaoATutti.jws?wsdl e ho salvato il file wsdl ottenuto:


<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://localhost:8080/axis/CiaoATutti.jws" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/axis/CiaoATutti.jws" xmlns:intf="http://localhost:8080/axis/CiaoATutti.jws" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4 Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:message name="ciaoRequest">
</wsdl:message>
<wsdl:message name="ciaoResponse">
<wsdl:part name="ciaoReturn" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="CiaoATutti">
<wsdl:operation name="ciao">
<wsdl:input message="impl:ciaoRequest" name="ciaoRequest"/>
<wsdl:output message="impl:ciaoResponse" name="ciaoResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CiaoATuttiSoapBinding" type="impl:CiaoATutti">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="ciao">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="ciaoRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/>
</wsdl:input>
<wsdl:output name="ciaoResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/CiaoATutti.jws" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CiaoATuttiService">
<wsdl:port binding="impl:CiaoATuttiSoapBinding" name="CiaoATutti">
<wsdlsoap:address location="http://localhost:8080/axis/CiaoATutti.jws"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>


Dopodichè ho lanciato da riga di comando:
wsdl2java.bat "C:\Documents and Settings\Proprietario\Desktop\CiaoATutti.wsdl"

Ottengo quindi il seguente errore:
WSDLToJava Error: Rpc/encoded wsdls are not supported in JAXWS 2.0

Che cosa devo fare?

Grazie.