keller 29 de jan. de 2008
serathiuk 29 de jan. de 2008
Cara. Muito obrigado. Era bem isso que eu precisava mesmo.
serathiuk 30 de jan. de 2008
Estou tentando criar um cliente de webservice da forma sugerida pelo keller.
Estou utilizando o seguinte comando:
C : \java \teste_ws > wsimport - keep - p br . com . cliente . softintegrador . ws . cliente http : // localhost / cliente / ws / transportadora . php ? wsdl
Mas é retornado o seguinte erro:
warning : src - resolve : Cannot resolve the name 'SOAP-ENC:Array' to a ( n ) 'type def
inition' component .
line 0 of http :// localhost /cliente/ws/ transportadora . php ? wsdl # types ? schema1
error : undefined simple or complex type 'SOAP-ENC:Array'
line 0 of http :// localhost /cliente/ws/ transportadora . php ? wsdl # types ? schema1
error : undefined attribute 'SOAP-ENC:arrayType'
line 0 of http :// localhost /cliente/ws/ transportadora . php ? wsdl # types ? schema1
error : org . xml . sax . SAXParseException : undefined attribute 'SOAP-ENC:arrayType'
E o WSDL retornado pelo webservice:
< ? xml version = "1.0" encoding = "ISO-8859-1" ? >
< 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 = "urn:server.services" xmlns : soap = "http://schemas.xmlsoap.org/wsdl/soap/" xmlns : wsdl = "http://schemas.xmlsoap.org/wsdl/" xmlns = "http://schemas.xmlsoap.org/wsdl/" targetNamespace = "urn:server.services" >
< types >
< xsd : schema targetNamespace = "urn:server.services"
>
< xsd : import namespace = "http://schemas.xmlsoap.org/soap/encoding/" />
< xsd : import namespace = "http://schemas.xmlsoap.org/wsdl/" />
< xsd : complexType name = "Transportadora" >
< xsd : all >
< xsd : element name = "id" type = "xsd:int" />
< xsd : element name = "nome" type = "xsd:string" />
</ xsd : all >
</ xsd : complexType >
< xsd : complexType name = "Transportadoras" >
< xsd : complexContent >
< xsd : restriction base = "SOAP-ENC:Array" >
< xsd : attribute ref = "SOAP-ENC:arrayType" wsdl : arrayType = "tns:Transportadora[]" />
</ xsd : restriction >
</ xsd : complexContent >
</ xsd : complexType >
</ xsd : schema >
</ types >
< message name = "getTransportadorasRequest" ></ message >
< message name = "getTransportadorasResponse" >
< part name = "return" type = "tns:Transportadoras" /></ message >
< message name = "setTransportadorasRequest" >
< part name = "transportadoras" type = "tns:Transportadoras" /></ message >
< message name = "setTransportadorasResponse" ></ message >
< portType name = "TransportadoraPortType" >
< operation name = "getTransportadoras" >
< documentation > Retorna todas as transportadoras do sistema .</ documentation >
< input message = "tns:getTransportadorasRequest" />
< output message = "tns:getTransportadorasResponse" />
</ operation >
< operation name = "setTransportadoras" >
< documentation > Salvar transportadoras .</ documentation >
< input message = "tns:setTransportadorasRequest" />
< output message = "tns:setTransportadorasResponse" />
</ operation >
</ portType >
< binding name = "TransportadoraBinding" type = "tns:TransportadoraPortType" >
< soap : binding style = "rpc" transport = "http://schemas.xmlsoap.org/soap/http" />
< operation name = "getTransportadoras" >
< soap : operation soapAction = "urn:server.services#getTransportadora" style = "rpc" />
< input >< soap : body use = "literal" namespace = "urn:server.services" /></ input >
< output >< soap : body use = "literal" namespace = "urn:server.services" /></ output >
</ operation >
< operation name = "setTransportadoras" >
< soap : operation soapAction = "urn:server.services#setTransportadoras" style = "rpc" />
< input >< soap : body use = "literal" namespace = "urn:server.services" /></ input >
< output >< soap : body use = "literal" namespace = "urn:server.services" /></ output >
</ operation >
</ binding >
< service name = "Transportadora" >
< port name = "TransportadoraPort" binding = "tns:TransportadoraBinding" >
< soap : address location = "http://localhost/cliente/ws/transportadora.php" />
</ port >
</ service >
</ definitions >
Qual pode ser o problema, sendo que este mesmo webservice funciona corretamente com o Axis 1.4?
gcunhadebs 13 de fev. de 2008
Provavelmente você está usando a versão JAX-WS, mas você só consiguirá usando a JAX-RPC devido ao encode…
Abraço !
Rafael_Nunes 13 de fev. de 2008
Nunca utilizei a biblioteca do Java 6, todos os clientes que precisei fazer com Axis e XFire, ambos me atenderam muito bem e de forma bem simples.