Bom dia a todos.
Estou tentando escrever um WebService e publicá-lo no GlassFish v3 (no NetBeans 6.9.1). Ele é compilado normalment e consigo testá-lo através do NetBeans sem problemas. Porém, ao tentar consumir o serviço em outra linguagem, o servidor apresenta a seguinte mensagem de erro: [color=red]com.sun.xml.ws.protocol.soap.VersionMismatchException: Couldn’t create SOAP message. Expecting Envelope in namespace http://schemas.xmlsoap.org/soap/envelope/, but got http://schemas.xmlsoap.org/wsdl/soap/[/color]
Seguem os fontes:
Interface[code]package pacote;
import javax.jws.WebMethod;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
@WebService
@SOAPBinding(style=SOAPBinding.Style.RPC)
public interface Teste {
@WebMethod
@WebResult(partName="msg")
public String getMsg();
}[/code]
Implementação[code]package pacote;
import javax.jws.WebService;
@WebService(endpointInterface=“pacote.Teste”)
public class TesteImpl implements Teste{
@Override
public String getMsg() {
return "Hello World!";
}
}[/code]
Client em Perluse SOAP::Lite +trace;
my $url = 'http://localhost:8080/WSTesteRPC/TesteService?wsdl';
my $service = SOAP::Lite->service($url);
print "\nResponse: ", $service->getMsg() , ".";
Informações
SOAP::Transport::HTTP::Client::send_receive: POST http://localhost:8080/WSTesteRPC/TesteService HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 677
Content-Type: text/xml; charset=utf-8
SOAPAction: “”
SOAP de envio
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://www.w3.org/ns/ws-policy"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://pacote/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<tns:getNome xsi:nil="true" />
</soap:Body>
</soap:Envelope>
Informações 2
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x2363cd4)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
Connection: close
Date: Fri, 26 Nov 2010 12:27:57 GMT
Server: GlassFish v3
Content-Type: text/xml;charset=utf-8
Client-Date: Fri, 26 Nov 2010 12:27:57 GMT
Client-Peer: 127.0.0.1:8080
Client-Response-Num: 1
X-Powered-By: Servlet/3.0
SOAP de retorno 2
<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
<faultcode>S:VersionMismatch</faultcode>
<faultstring>Couldn't create SOAP message. Expecting Envelope in namespace http://schemas.xmlsoap.org/soap/envelope/, but got http://schemas.xmlsoap.org/wsdl/soap/ </faultstring>
</S:Fault>
</S:Body>
</S:Envelope>
Aparentemente o erro indica que o schema utilizado pelo GlassFish para os Envelopes SOAP é diferente do schema apontado pelo cliente. Como eu posso configurá-lo no servidor (se for este o problema)?
Se alguém puder me ajudar, agradeço…
Matheus