Olá, boa noite.
Fiz todos os procedimentos possíveis seguindo a vídeo aula mas ao criar o webservice a biblioteca LivrariaWSProxy não baixou automaticamente.
Alguém sabe me dizer o motivo?
Estou usando glassfish 3 e netbeans 8.1.
Você está vendo a versão anterior da nova experiência da Alura que estamos preparando para você. Em breve, ela ganha uma identidade visual novinha totalmente pensada em potencializar seus estudos!
Olá, boa noite.
Fiz todos os procedimentos possíveis seguindo a vídeo aula mas ao criar o webservice a biblioteca LivrariaWSProxy não baixou automaticamente.
Alguém sabe me dizer o motivo?
Estou usando glassfish 3 e netbeans 8.1.
Será que é porque o glassfish não é exatamente igual ao JBoss? Ele criou todas as outras classes e só não criou a LivrariaWSProxy ?
Diferenças
Jboss 7(vídeo aula) ServiceLocator.java, ServiceSoapBindingStub.java
Glassfish 3 ObjectFactory.java, package-info.java
Acredito q tenha uma biblioteca do glassfish equivalente a biblioteca ..proxy().
Pelo q entendi, essa biblioteca é responsável por fazer o POST no WebService.
Quais as classes que ele criou no glassfish ?
Autor.java, GetAutorPeloNome.java, GetAutorPeloNomeResponse.java, LivrariaWS.java, LivrariaWSService.java, ObjectFactory.java, package-info.java
Vê se algum desse se aproxima desse código
package br.com.caelum.livraria.webservice;
public class LivrariaWSProxy implements br.com.caelum.livraria.webservice.LivrariaWS {
private String _endpoint = null;
private br.com.caelum.livraria.webservice.LivrariaWS livrariaWS = null;
public LivrariaWSProxy() {
_initLivrariaWSProxy();
}
public LivrariaWSProxy(String endpoint) {
_endpoint = endpoint;
_initLivrariaWSProxy();
}
private void _initLivrariaWSProxy() {
try {
livrariaWS = (new br.com.caelum.livraria.webservice.LivrariaWSServiceLocator()).getLivrariaWSPort();
if (livrariaWS != null) {
if (_endpoint != null)
((javax.xml.rpc.Stub)livrariaWS)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
else
_endpoint = (String)((javax.xml.rpc.Stub)livrariaWS)._getProperty("javax.xml.rpc.service.endpoint.address");
}
}
catch (javax.xml.rpc.ServiceException serviceException) {}
}
public String getEndpoint() {
return _endpoint;
}
public void setEndpoint(String endpoint) {
_endpoint = endpoint;
if (livrariaWS != null)
((javax.xml.rpc.Stub)livrariaWS)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
}
public br.com.caelum.livraria.webservice.LivrariaWS getLivrariaWS() {
if (livrariaWS == null)
_initLivrariaWSProxy();
return livrariaWS;
}
public br.com.caelum.livraria.webservice.Livro[] getLivrosPeloNome(java.lang.String arg0) throws java.rmi.RemoteException{
if (livrariaWS == null)
_initLivrariaWSProxy();
return livrariaWS.getLivrosPeloNome(arg0);
}
}
Tenta isso mano.
LivrariaWSService service = new LivrariaWSService();
LivrariaWS req = service.getLivrariaPort(); //(Algo assim, service.Alguma_coisa)
O exemplo que me passou funcionou. Segue código.
LivrariaWSService service = new LivrariaWSService(); LivrariaWS req = service.getLivrariaWSPort();
List autoress = req.getAutorPeloNome("NomeAutor");
for (Autor autores : autoress) { System.out.println(autores.getNome()); }
Muito obrigado pela ajuda.
Opa, estamos ai.