[quote=nel]Ale, o wsimport é nativo. Ele vem com a sua JDK, se tu configurou nas variáveis de ambiente do seu SO o Java, você pode simplesmente abrir um console e aplicar o comando. Ele “automaticamente” gera as tuas classes clientes, seu trabalho será apenas informar a URL de acesso. Enquanto o WSDL se manter o mesmo, as classes geradas para o cliente poderão ser usadas.
Não tem nada demais e é bem simples de usar. Se retornar um objeto é mais fácil ainda, trabalha diretamente com o objeto, se gerar uma String, sendo seu conteúdo o XML, basta converter para um objetc ou usar o DOM, que também vem nativo.[/quote]
Amigo ajudou muito achei um tuto na internet meio que falando como usar o WSImport, bom consegui gerar a classe, ele gerou um monte de objetos com os Elements do meu xml e também os dados de cabeçalho e tudo mais, blz. só fiquei com uma duvida, bom ele gerou mais 3 classes:
SystaxRet - que pelo que entendi vai estanciar todos os atributos dos objetos e etc montando o xml praticmante;
SystaxPortType - que na verdade é uma interface, eu tenho que instanciala para passar os valores das informações que preciso passar para consultar o webservice, valores como usuario, senha, codigos diversos;
Systax - esta que pelo que percebi tem vários metodos e um deles deve chamar o webservice e fazer a consulta, enviando a SystaxPortType e uma série de outras informações, mas não ache qual realmente o metodo que devo chamar e como fazer para salvar o XML, que é minha idéia original, salrvar o xml que vou ter como retorno para usar depois, será que pode me dar uma ajuda com essa parte ???
O código gerado é este aqui:
package webservice;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceFeature;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.4-b01
* Generated source version: 2.2
*
*/
@WebServiceClient(name = "systax", targetNamespace = "urn:systax", wsdlLocation = "http://sp.systax.com.br/webservice/systax_erp06.php?wsdl")
public class Systax
extends Service
{
private final static URL SYSTAX_WSDL_LOCATION;
private final static WebServiceException SYSTAX_EXCEPTION;
private final static QName SYSTAX_QNAME = new QName("urn:systax", "systax");
static {
URL url = null;
WebServiceException e = null;
try {
url = new URL("http://sp.systax.com.br/webservice/systax_erp06.php?wsdl");
} catch (MalformedURLException ex) {
e = new WebServiceException(ex);
}
SYSTAX_WSDL_LOCATION = url;
SYSTAX_EXCEPTION = e;
}
public Systax() {
super(__getWsdlLocation(), SYSTAX_QNAME);
}
public Systax(WebServiceFeature... features) {
super(__getWsdlLocation(), SYSTAX_QNAME, features);
}
public Systax(URL wsdlLocation) {
super(wsdlLocation, SYSTAX_QNAME);
}
public Systax(URL wsdlLocation, WebServiceFeature... features) {
super(wsdlLocation, SYSTAX_QNAME, features);
}
public Systax(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public Systax(URL wsdlLocation, QName serviceName, WebServiceFeature... features) {
super(wsdlLocation, serviceName, features);
}
/**
*
* @return
* returns SystaxPortType
*/
@WebEndpoint(name = "systaxPort")
public SystaxPortType getSystaxPort() {
return super.getPort(new QName("urn:systax", "systaxPort"), SystaxPortType.class);
}
/**
*
* @param features
* A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
* @return
* returns SystaxPortType
*/
@WebEndpoint(name = "systaxPort")
public SystaxPortType getSystaxPort(WebServiceFeature... features) {
return super.getPort(new QName("urn:systax", "systaxPort"), SystaxPortType.class, features);
}
private static URL __getWsdlLocation() {
if (SYSTAX_EXCEPTION!= null) {
throw SYSTAX_EXCEPTION;
}
return SYSTAX_WSDL_LOCATION;
}
}