File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Axis2 Transport error calling stub Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Axis2 Transport error calling stub" Watch "Axis2 Transport error calling stub" New topic
Author

Axis2 Transport error calling stub

Mat Anthony
Ranch Hand

Joined: May 21, 2008
Posts: 237
Hi All,
I have created the following test to call my service, but on calling stub.findPersonID
the following error gets thrown

org.apache.axis2.AxisFault: Transport error: 302 Error: Moved Temporarily

Has anybody got any idea???

package org.test.common.service.impl;

import org.test.common.service.impl.MyServiceImplStub;

public class MyServiceTest
{
public static void main(String[] args)
{
try{

MyServiceImplStub stub = new MyServiceImplStub();

webservice.common.opus.xsd.FindPersonIDDocument document =webservice.common.opus.xsd.FindPersonIDDocument.Factory.newInstance();

webservice.common.opus.xsd.FindPersonIDDocument.FindPersonID findPersonID=
webservice.common.opus.xsd.FindPersonIDDocument.FindPersonID.Factory.newInstance();

long personId=3579470;

findPersonID.setPersonId(personId);

document.setFindPersonID(findPersonID);

System.out.println("personId="+stub.findPersonID(document).toString());

}catch(Exception e){System.out.println(e);}

}

}


Mat Anthony
Ranch Hand

Joined: May 21, 2008
Posts: 237
Hi All,
I'm currently using acegi security and have to go threw a class that implements AuthenticationEntryPoint, before
forwarding the request to my web service.

My previous error was caused by:-
httpServletResponse.sendRedirect(full)
instead of using:-
RequestDispatcher dispatcher = httpServletRequest.getRequestDispatcher(httpServletResponse.toString());
dispatcher.forward(httpServletRequest, httpServletResponse);

I'm now getting the following response back:-
org.apache.axis2.AxisFault: First Element must contain the local name, Envelope , but found HTML

I have added the following lines to my client code above, to solve this problem:-

HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
authenticator.setUsername("12345");
authenticator.setPassword("password");
authenticator.setPreemptiveAuthentication(true);

stub._getServiceClient().getOptions().
setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
Boolean.FALSE);

stub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, authenticator);

Has any body got any idea.
Mario Gomes
Greenhorn

Joined: Aug 31, 2013
Posts: 4
Hi all,

I have a application WEBSERVICE = AXIS2 + TOMCAT 7 + ECLIPSE

WSDL = http://www.webmotors.com.br/IntegracaoRevendedor/wsLoginSistemaRevendedor.asmx?WSDL

I make by Eclipse Juno and AXIS2 two class :

First is :
/**
* WsLoginSistemaRevendedorStub.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.6.1 Built on : Aug 31, 2011 (12:22:40 CEST)
*/
package wsloginsistemarevendedor.br.com.webmotors.www;



/*
* WsLoginSistemaRevendedorStub java implementation
*/


public class WsLoginSistemaRevendedorStub extends org.apache.axis2.client.Stub
{
protected org.apache.axis2.description.AxisOperation[] _operations;

//hashmaps to keep the fault mapping
private java.util.HashMap faultExceptionNameMap = new java.util.HashMap();
private java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap();
private java.util.HashMap faultMessageMap = new java.util.HashMap();

private static int counter = 0;

private static synchronized java.lang.String getUniqueSuffix(){
// reset the counter if it is greater than 99999
if (counter > 99999){
counter = 0;
}
counter = counter + 1;
return java.lang.Long.toString(java.lang.System.currentTimeMillis()) + "_" + counter;
}


private void populateAxisService() throws org.apache.axis2.AxisFault {

//creating the Service with a unique name
_service = new org.apache.axis2.description.AxisService("WsLoginSistemaRevendedor" + getUniqueSuffix());
addAnonymousOperations();

//creating the operations
org.apache.axis2.description.AxisOperation __operation;

_operations = new org.apache.axis2.description.AxisOperation[1];

__operation = new org.apache.axis2.description.OutInAxisOperation();


__operation.setName(new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor", "autenticar"));
_service.addOperation(__operation);




_operations[0]=__operation;


}

//populates the faults
private void populateFaults(){



}

/**
*Constructor that takes in a configContext
*/

public WsLoginSistemaRevendedorStub(org.apache.axis2.context.ConfigurationContext configurationContext,
java.lang.String targetEndpoint)
throws org.apache.axis2.AxisFault {
this(configurationContext,targetEndpoint,false);
}


/**
* Constructor that takes in a configContext and useseperate listner
*/
public WsLoginSistemaRevendedorStub(org.apache.axis2.context.ConfigurationContext configurationContext,
java.lang.String targetEndpoint, boolean useSeparateListener)
throws org.apache.axis2.AxisFault {
//To populate AxisService
populateAxisService();
populateFaults();

_serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service);


_serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference(
targetEndpoint));
_serviceClient.getOptions().setUseSeparateListener(useSeparateListener);


}

/**
* Default Constructor
*/
public WsLoginSistemaRevendedorStub(org.apache.axis2.context.ConfigurationContext configurationContext) throws org.apache.axis2.AxisFault {

this(configurationContext,"http://www.webmotors.com.br/IntegracaoRevendedor/wsLoginSistemaRevendedor.asmx" );

}

/**
* Default Constructor
*/
public WsLoginSistemaRevendedorStub() throws org.apache.axis2.AxisFault {

this("http://www.webmotors.com.br/IntegracaoRevendedor/wsLoginSistemaRevendedor.asmx" );

}

/**
* Constructor taking the target endpoint
*/
public WsLoginSistemaRevendedorStub(java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault {
this(null,targetEndpoint);
}




/**
* Auto generated method signature
*
* @see wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedor#autenticar
* @param autenticar0

*/



public wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.AutenticarResponse autenticar(

wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.Autenticar autenticar0)


throws java.rmi.RemoteException

{
org.apache.axis2.context.MessageContext _messageContext = null;
try{
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
_operationClient.getOptions().setAction("www.webmotors.com.br/wsLoginSistemaRevendedor/autenticar");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);



addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&");


// create a message context
_messageContext = new org.apache.axis2.context.MessageContext();



// create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env = null;


env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
autenticar0,
optimizeContent(new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor",
"autenticar")), new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor",
"autenticar"));

//adding SOAP soap_headers
_serviceClient.addHeadersToEnvelope(env);
// set the message context with that soap envelope
_messageContext.setEnvelope(env);

// add the message contxt to the operation client
_operationClient.addMessageContext(_messageContext);

//execute the operation client
_operationClient.execute(true);


org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(
org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();


java.lang.Object object = fromOM(
_returnEnv.getBody().getFirstElement() ,
wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.AutenticarResponse.class,
getEnvelopeNamespaces(_returnEnv));


return (wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.AutenticarResponse)object;

}catch(org.apache.axis2.AxisFault f){

org.apache.axiom.om.OMElement faultElt = f.getDetail();
if (faultElt!=null){
if (faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"autenticar"))){
//make the fault by reflection
try{
java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"autenticar"));
java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
java.lang.Exception ex = (java.lang.Exception) exceptionClass.newInstance();
//message class
java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"autenticar"));
java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
java.lang.Object messageObject = fromOM(faultElt,messageClass,null);
java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
new java.lang.Class[]{messageClass});
m.invoke(ex,new java.lang.Object[]{messageObject});


throw new java.rmi.RemoteException(ex.getMessage(), ex);
}catch(java.lang.ClassCastException e){
// we cannot intantiate the class - throw the original Axis fault
throw f;
} catch (java.lang.ClassNotFoundException e) {
// we cannot intantiate the class - throw the original Axis fault
throw f;
}catch (java.lang.NoSuchMethodException e) {
// we cannot intantiate the class - throw the original Axis fault
throw f;
} catch (java.lang.reflect.InvocationTargetException e) {
// we cannot intantiate the class - throw the original Axis fault
throw f;
} catch (java.lang.IllegalAccessException e) {
// we cannot intantiate the class - throw the original Axis fault
throw f;
} catch (java.lang.InstantiationException e) {
// we cannot intantiate the class - throw the original Axis fault
throw f;
}
}else{
throw f;
}
}else{
throw f;
}
} finally {
if (_messageContext.getTransportOut() != null) {
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
}
}
}

/**
* Auto generated method signature for Asynchronous Invocations
*
* @see wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedor#startautenticar
* @param autenticar0

*/
public void startautenticar(

wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.Autenticar autenticar0,

final wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorCallbackHandler callback)

throws java.rmi.RemoteException{

org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
_operationClient.getOptions().setAction("www.webmotors.com.br/wsLoginSistemaRevendedor/autenticar");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);



addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&");



// create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env=null;
final org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();


//Style is Doc.


env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
autenticar0,
optimizeContent(new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor",
"autenticar")), new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor",
"autenticar"));

// adding SOAP soap_headers
_serviceClient.addHeadersToEnvelope(env);
// create message context with that soap envelope
_messageContext.setEnvelope(env);

// add the message context to the operation client
_operationClient.addMessageContext(_messageContext);



_operationClient.setCallback(new org.apache.axis2.client.async.AxisCallback() {
public void onMessage(org.apache.axis2.context.MessageContext resultContext) {
try {
org.apache.axiom.soap.SOAPEnvelope resultEnv = resultContext.getEnvelope();

java.lang.Object object = fromOM(resultEnv.getBody().getFirstElement(),
wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.AutenticarResponse.class,
getEnvelopeNamespaces(resultEnv));
callback.receiveResultautenticar(
(wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.AutenticarResponse)object);

} catch (org.apache.axis2.AxisFault e) {
callback.receiveErrorautenticar(e);
}
}

public void onError(java.lang.Exception error) {
if (error instanceof org.apache.axis2.AxisFault) {
org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error;
org.apache.axiom.om.OMElement faultElt = f.getDetail();
if (faultElt!=null){
if (faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"autenticar"))){
//make the fault by reflection
try{
java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"autenticar"));
java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
java.lang.Exception ex = (java.lang.Exception) exceptionClass.newInstance();
//message class
java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"autenticar"));
java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
java.lang.Object messageObject = fromOM(faultElt,messageClass,null);
java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
new java.lang.Class[]{messageClass});
m.invoke(ex,new java.lang.Object[]{messageObject});


callback.receiveErrorautenticar(new java.rmi.RemoteException(ex.getMessage(), ex));
} catch(java.lang.ClassCastException e){
// we cannot intantiate the class - throw the original Axis fault
callback.receiveErrorautenticar(f);
} catch (java.lang.ClassNotFoundException e) {
// we cannot intantiate the class - throw the original Axis fault
callback.receiveErrorautenticar(f);
} catch (java.lang.NoSuchMethodException e) {
// we cannot intantiate the class - throw the original Axis fault
callback.receiveErrorautenticar(f);
} catch (java.lang.reflect.InvocationTargetException e) {
// we cannot intantiate the class - throw the original Axis fault
callback.receiveErrorautenticar(f);
} catch (java.lang.IllegalAccessException e) {
// we cannot intantiate the class - throw the original Axis fault
callback.receiveErrorautenticar(f);
} catch (java.lang.InstantiationException e) {
// we cannot intantiate the class - throw the original Axis fault
callback.receiveErrorautenticar(f);
} catch (org.apache.axis2.AxisFault e) {
// we cannot intantiate the class - throw the original Axis fault
callback.receiveErrorautenticar(f);
}
} else {
callback.receiveErrorautenticar(f);
}
} else {
callback.receiveErrorautenticar(f);
}
} else {
callback.receiveErrorautenticar(error);
}
}

public void onFault(org.apache.axis2.context.MessageContext faultContext) {
org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext);
onError(fault);
}

public void onComplete() {
try {
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
} catch (org.apache.axis2.AxisFault axisFault) {
callback.receiveErrorautenticar(axisFault);
}
}
});


org.apache.axis2.util.CallbackReceiver _callbackReceiver = null;
if ( _operations[0].getMessageReceiver()==null && _operationClient.getOptions().isUseSeparateListener()) {
_callbackReceiver = new org.apache.axis2.util.CallbackReceiver();
_operations[0].setMessageReceiver(
_callbackReceiver);
}

//execute the operation client
_operationClient.execute(false);

}



/**
* A utility method that copies the namepaces from the SOAPEnvelope
*/
private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){
java.util.Map returnMap = new java.util.HashMap();
java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
while (namespaceIterator.hasNext()) {
org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();
returnMap.put(ns.getPrefix(),ns.getNamespaceURI());
}
return returnMap;
}



private javax.xml.namespace.QName[] opNameArray = null;
private boolean optimizeContent(javax.xml.namespace.QName opName) {


if (opNameArray == null) {
return false;
}
for (int i = 0; i < opNameArray.length; i++) {
if (opName.equals(opNameArray[i])) {
return true;
}
}
return false;
}
//http://www.webmotors.com.br/IntegracaoRevendedor/wsLoginSistemaRevendedor.asmx
public static class ExtensionMapper{

public static java.lang.Object getTypeObject(java.lang.String namespaceURI,
java.lang.String typeName,
javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{


if (
"www.webmotors.com.br/wsLoginSistemaRevendedor".equals(namespaceURI) &&
"AutenticacaoSistemaRevendedorWM".equals(typeName)){

return AutenticacaoSistemaRevendedorWM.Factory.parse(reader);


}


throw new org.apache.axis2.databinding.ADBException("Unsupported type " + namespaceURI + " " + typeName);
}

}

public static class Autenticar
implements org.apache.axis2.databinding.ADBBean{

public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
"www.webmotors.com.br/wsLoginSistemaRevendedor",
"autenticar",
"ns1");



/**
* field for Cnpj
*/


protected java.lang.String localCnpj ;

/* This tracker boolean wil be used to detect whether the user called the set method
* for this attribute. It will be used to determine whether to include this field
* in the serialized XML
*/
protected boolean localCnpjTracker = false ;

public boolean isCnpjSpecified(){
return localCnpjTracker;
}



/**
* Auto generated getter method
* @return java.lang.String
*/
public java.lang.String getCnpj(){
return localCnpj;
}



/**
* Auto generated setter method
* @param param Cnpj
*/
public void setCnpj(java.lang.String param){
localCnpjTracker = param != null;

this.localCnpj=param;


}


/**
* field for Email
*/


protected java.lang.String localEmail ;

/* This tracker boolean wil be used to detect whether the user called the set method
* for this attribute. It will be used to determine whether to include this field
* in the serialized XML
*/
protected boolean localEmailTracker = false ;

public boolean isEmailSpecified(){
return localEmailTracker;
}



/**
* Auto generated getter method
* @return java.lang.String
*/
public java.lang.String getEmail(){
return localEmail;
}



/**
* Auto generated setter method
* @param param Email
*/
public void setEmail(java.lang.String param){
localEmailTracker = param != null;

this.localEmail=param;


}


/**
* field for Senha
*/


protected java.lang.String localSenha ;

/* This tracker boolean wil be used to detect whether the user called the set method
* for this attribute. It will be used to determine whether to include this field
* in the serialized XML
*/
protected boolean localSenhaTracker = false ;

public boolean isSenhaSpecified(){
return localSenhaTracker;
}



/**
* Auto generated getter method
* @return java.lang.String
*/
public java.lang.String getSenha(){
return localSenha;
}



/**
* Auto generated setter method
* @param param Senha
*/
public void setSenha(java.lang.String param){
localSenhaTracker = param != null;

this.localSenha=param;


}




/**
*
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getOMElement (
final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{



org.apache.axiom.om.OMDataSource dataSource =
new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME);
return factory.createOMElement(dataSource,MY_QNAME);

}

public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
serialize(parentQName,xmlWriter,false);
}

public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter,
boolean serializeType)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{




java.lang.String prefix = null;
java.lang.String namespace = null;


prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter);

if (serializeType){


java.lang.String namespacePrefix = registerPrefix(xmlWriter,"www.webmotors.com.br/wsLoginSistemaRevendedor");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
namespacePrefix+":autenticar",
xmlWriter);
} else {
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
"autenticar",
xmlWriter);
}


}
if (localCnpjTracker){
namespace = "www.webmotors.com.br/wsLoginSistemaRevendedor";
writeStartElement(null, namespace, "cnpj", xmlWriter);


if (localCnpj==null){
// write the nil attribute

throw new org.apache.axis2.databinding.ADBException("cnpj cannot be null!!");

}else{


xmlWriter.writeCharacters(localCnpj);

}

xmlWriter.writeEndElement();
} if (localEmailTracker){
namespace = "www.webmotors.com.br/wsLoginSistemaRevendedor";
writeStartElement(null, namespace, "email", xmlWriter);


if (localEmail==null){
// write the nil attribute

throw new org.apache.axis2.databinding.ADBException("email cannot be null!!");

}else{


xmlWriter.writeCharacters(localEmail);

}

xmlWriter.writeEndElement();
} if (localSenhaTracker){
namespace = "www.webmotors.com.br/wsLoginSistemaRevendedor";
writeStartElement(null, namespace, "senha", xmlWriter);


if (localSenha==null){
// write the nil attribute

throw new org.apache.axis2.databinding.ADBException("senha cannot be null!!");

}else{


xmlWriter.writeCharacters(localSenha);

}

xmlWriter.writeEndElement();
}
xmlWriter.writeEndElement();


}

private static java.lang.String generatePrefix(java.lang.String namespace) {
if(namespace.equals("www.webmotors.com.br/wsLoginSistemaRevendedor")){
return "ns1";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}

/**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = generatePrefix(namespace);
}

xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
}

/**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace,attName,attValue);
}

/**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace,attName,attValue);
}
}


/**
* Util method to write an attribute without the ns prefix
*/
private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName,
javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {

java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
}

if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/

private void writeQName(javax.xml.namespace.QName qname,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
}

if (prefix.trim().length() > 0){
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}

} else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
}

private void writeQNames(javax.xml.namespace.QName[] qnames,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {

if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
java.lang.String namespaceURI = null;
java.lang.String prefix = null;

for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
}

if (prefix.trim().length() > 0){
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
}

}


/**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
java.lang.String uri = nsContext.getNamespaceURI(prefix);
if (uri == null || uri.length() == 0) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
}



/**
* databinding method to get an XML representation of this object
*
*/
public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)
throws org.apache.axis2.databinding.ADBException{



java.util.ArrayList elementList = new java.util.ArrayList();
java.util.ArrayList attribList = new java.util.ArrayList();

if (localCnpjTracker){
elementList.add(new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor",
"cnpj"));

if (localCnpj != null){
elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localCnpj));
} else {
throw new org.apache.axis2.databinding.ADBException("cnpj cannot be null!!");
}
} if (localEmailTracker){
elementList.add(new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor",
"email"));

if (localEmail != null){
elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localEmail));
} else {
throw new org.apache.axis2.databinding.ADBException("email cannot be null!!");
}
} if (localSenhaTracker){
elementList.add(new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor",
"senha"));

if (localSenha != null){
elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localSenha));
} else {
throw new org.apache.axis2.databinding.ADBException("senha cannot be null!!");
}
}

return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());



}



/**
* Factory class that keeps the parse method
*/
public static class Factory{




/**
* static method to create the object
* Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
* If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
* Postcondition: If this object is an element, the reader is positioned at its end element
* If this object is a complex type, the reader is positioned at the end element of its outer element
*/
public static Autenticar parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
Autenticar object =
new Autenticar();

int event;
java.lang.String nillableValue = null;
java.lang.String prefix ="";
java.lang.String namespaceuri ="";
try {

while (!reader.isStartElement() && !reader.isEndElement())
reader.next();


if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"type");
if (fullTypeName!=null){
java.lang.String nsPrefix = null;
if (fullTypeName.indexOf(":") > -1){
nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix==null?"":nsPrefix;

java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1);

if (!"autenticar".equals(type)){
//find namespace for the prefix
java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return (Autenticar)ExtensionMapper.getTypeObject(
nsUri,type,reader);
}


}


}




// Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
java.util.Vector handledAttributes = new java.util.Vector();




reader.next();


while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

if (reader.isStartElement() && new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor","cnpj").equals(reader.getName())){

java.lang.String content = reader.getElementText();

object.setCnpj(
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));

reader.next();

} // End of if for expected property start element

else {

}


while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

if (reader.isStartElement() && new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor","email").equals(reader.getName())){

java.lang.String content = reader.getElementText();

object.setEmail(
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));

reader.next();

} // End of if for expected property start element

else {

}


while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

if (reader.isStartElement() && new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor","senha").equals(reader.getName())){

java.lang.String content = reader.getElementText();

object.setSenha(
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));

reader.next();

} // End of if for expected property start element

else {

}

while (!reader.isStartElement() && !reader.isEndElement())
reader.next();

if (reader.isStartElement())
// A start element we are not expecting indicates a trailing invalid property
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName());




} catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
}

return object;
}

}//end of factory class



}


public static class AutenticarResponse
implements org.apache.axis2.databinding.ADBBean{

public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
"www.webmotors.com.br/wsLoginSistemaRevendedor",
"autenticarResponse",
"ns1");



/**
* field for AutenticarResult
*/


protected AutenticacaoSistemaRevendedorWM localAutenticarResult ;

/* This tracker boolean wil be used to detect whether the user called the set method
* for this attribute. It will be used to determine whether to include this field
* in the serialized XML
*/
protected boolean localAutenticarResultTracker = false ;

public boolean isAutenticarResultSpecified(){
return localAutenticarResultTracker;
}



/**
* Auto generated getter method
* @return AutenticacaoSistemaRevendedorWM
*/
public AutenticacaoSistemaRevendedorWM getAutenticarResult(){
return localAutenticarResult;
}



/**
* Auto generated setter method
* @param param AutenticarResult
*/
public void setAutenticarResult(AutenticacaoSistemaRevendedorWM param){
localAutenticarResultTracker = param != null;

this.localAutenticarResult=param;


}




/**
*
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getOMElement (
final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{



org.apache.axiom.om.OMDataSource dataSource =
new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME);
return factory.createOMElement(dataSource,MY_QNAME);

}

public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
serialize(parentQName,xmlWriter,false);
}

public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter,
boolean serializeType)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{




java.lang.String prefix = null;
java.lang.String namespace = null;


prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter);

if (serializeType){


java.lang.String namespacePrefix = registerPrefix(xmlWriter,"www.webmotors.com.br/wsLoginSistemaRevendedor");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
namespacePrefix+":autenticarResponse",
xmlWriter);
} else {
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
"autenticarResponse",
xmlWriter);
}


}
if (localAutenticarResultTracker){
if (localAutenticarResult==null){
throw new org.apache.axis2.databinding.ADBException("autenticarResult cannot be null!!");
}
localAutenticarResult.serialize(new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor","autenticarResult"),
xmlWriter);
}
xmlWriter.writeEndElement();


}

private static java.lang.String generatePrefix(java.lang.String namespace) {
if(namespace.equals("www.webmotors.com.br/wsLoginSistemaRevendedor")){
return "ns1";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}

/**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = generatePrefix(namespace);
}

xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
}

/**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace,attName,attValue);
}

/**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace,attName,attValue);
}
}


/**
* Util method to write an attribute without the ns prefix
*/
private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName,
javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {

java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
}

if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/

private void writeQName(javax.xml.namespace.QName qname,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
}

if (prefix.trim().length() > 0){
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}

} else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
}

private void writeQNames(javax.xml.namespace.QName[] qnames,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {

if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
java.lang.String namespaceURI = null;
java.lang.String prefix = null;

for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
}

if (prefix.trim().length() > 0){
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
}

}


/**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
java.lang.String uri = nsContext.getNamespaceURI(prefix);
if (uri == null || uri.length() == 0) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
}



/**
* databinding method to get an XML representation of this object
*
*/
public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)
throws org.apache.axis2.databinding.ADBException{



java.util.ArrayList elementList = new java.util.ArrayList();
java.util.ArrayList attribList = new java.util.ArrayList();

if (localAutenticarResultTracker){
elementList.add(new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor",
"autenticarResult"));


if (localAutenticarResult==null){
throw new org.apache.axis2.databinding.ADBException("autenticarResult cannot be null!!");
}
elementList.add(localAutenticarResult);
}

return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());



}



/**
* Factory class that keeps the parse method
*/
public static class Factory{




/**
* static method to create the object
* Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
* If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
* Postcondition: If this object is an element, the reader is positioned at its end element
* If this object is a complex type, the reader is positioned at the end element of its outer element
*/
public static AutenticarResponse parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
AutenticarResponse object =
new AutenticarResponse();

int event;
java.lang.String nillableValue = null;
java.lang.String prefix ="";
java.lang.String namespaceuri ="";
try {

while (!reader.isStartElement() && !reader.isEndElement())
reader.next();


if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"type");
if (fullTypeName!=null){
java.lang.String nsPrefix = null;
if (fullTypeName.indexOf(":") > -1){
nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix==null?"":nsPrefix;

java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1);

if (!"autenticarResponse".equals(type)){
//find namespace for the prefix
java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return (AutenticarResponse)ExtensionMapper.getTypeObject(
nsUri,type,reader);
}


}


}




// Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
java.util.Vector handledAttributes = new java.util.Vector();




reader.next();


while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

if (reader.isStartElement() && new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor","autenticarResult").equals(reader.getName())){

object.setAutenticarResult(AutenticacaoSistemaRevendedorWM.Factory.parse(reader));

reader.next();

} // End of if for expected property start element

else {

}

while (!reader.isStartElement() && !reader.isEndElement())
reader.next();

if (reader.isStartElement())
// A start element we are not expecting indicates a trailing invalid property
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName());




} catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
}

return object;
}

}//end of factory class



}


public static class AutenticacaoSistemaRevendedorWM
implements org.apache.axis2.databinding.ADBBean{
/* This type was generated from the piece of schema that had
name = AutenticacaoSistemaRevendedorWM
Namespace URI = www.webmotors.com.br/wsLoginSistemaRevendedor
Namespace Prefix = ns1
*/


/**
* field for HashAutenticacao
*/


protected java.lang.String localHashAutenticacao ;

/* This tracker boolean wil be used to detect whether the user called the set method
* for this attribute. It will be used to determine whether to include this field
* in the serialized XML
*/
protected boolean localHashAutenticacaoTracker = false ;

public boolean isHashAutenticacaoSpecified(){
return localHashAutenticacaoTracker;
}



/**
* Auto generated getter method
* @return java.lang.String
*/
public java.lang.String getHashAutenticacao(){
return localHashAutenticacao;
}



/**
* Auto generated setter method
* @param param HashAutenticacao
*/
public void setHashAutenticacao(java.lang.String param){
localHashAutenticacaoTracker = param != null;

this.localHashAutenticacao=param;


}


/**
* field for CodigoRetorno
*/


protected java.lang.String localCodigoRetorno ;

/* This tracker boolean wil be used to detect whether the user called the set method
* for this attribute. It will be used to determine whether to include this field
* in the serialized XML
*/
protected boolean localCodigoRetornoTracker = false ;

public boolean isCodigoRetornoSpecified(){
return localCodigoRetornoTracker;
}



/**
* Auto generated getter method
* @return java.lang.String
*/
public java.lang.String getCodigoRetorno(){
return localCodigoRetorno;
}



/**
* Auto generated setter method
* @param param CodigoRetorno
*/
public void setCodigoRetorno(java.lang.String param){
localCodigoRetornoTracker = param != null;

this.localCodigoRetorno=param;


}




/**
*
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getOMElement (
final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{



org.apache.axiom.om.OMDataSource dataSource =
new org.apache.axis2.databinding.ADBDataSource(this,parentQName);
return factory.createOMElement(dataSource,parentQName);

}

public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
serialize(parentQName,xmlWriter,false);
}

public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter,
boolean serializeType)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{




java.lang.String prefix = null;
java.lang.String namespace = null;


prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter);

if (serializeType){


java.lang.String namespacePrefix = registerPrefix(xmlWriter,"www.webmotors.com.br/wsLoginSistemaRevendedor");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
namespacePrefix+":AutenticacaoSistemaRevendedorWM",
xmlWriter);
} else {
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
"AutenticacaoSistemaRevendedorWM",
xmlWriter);
}


}
if (localHashAutenticacaoTracker){
namespace = "www.webmotors.com.br/wsLoginSistemaRevendedor";
writeStartElement(null, namespace, "HashAutenticacao", xmlWriter);


if (localHashAutenticacao==null){
// write the nil attribute

throw new org.apache.axis2.databinding.ADBException("HashAutenticacao cannot be null!!");

}else{


xmlWriter.writeCharacters(localHashAutenticacao);

}

xmlWriter.writeEndElement();
} if (localCodigoRetornoTracker){
namespace = "www.webmotors.com.br/wsLoginSistemaRevendedor";
writeStartElement(null, namespace, "CodigoRetorno", xmlWriter);


if (localCodigoRetorno==null){
// write the nil attribute

throw new org.apache.axis2.databinding.ADBException("CodigoRetorno cannot be null!!");

}else{


xmlWriter.writeCharacters(localCodigoRetorno);

}

xmlWriter.writeEndElement();
}
xmlWriter.writeEndElement();


}

private static java.lang.String generatePrefix(java.lang.String namespace) {
if(namespace.equals("www.webmotors.com.br/wsLoginSistemaRevendedor")){
return "ns1";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}

/**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = generatePrefix(namespace);
}

xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
}

/**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace,attName,attValue);
}

/**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace,attName,attValue);
}
}


/**
* Util method to write an attribute without the ns prefix
*/
private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName,
javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {

java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
}

if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/

private void writeQName(javax.xml.namespace.QName qname,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
}

if (prefix.trim().length() > 0){
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}

} else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
}

private void writeQNames(javax.xml.namespace.QName[] qnames,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {

if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
java.lang.String namespaceURI = null;
java.lang.String prefix = null;

for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
}

if (prefix.trim().length() > 0){
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
}

}


/**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
java.lang.String uri = nsContext.getNamespaceURI(prefix);
if (uri == null || uri.length() == 0) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
}



/**
* databinding method to get an XML representation of this object
*
*/
public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)
throws org.apache.axis2.databinding.ADBException{



java.util.ArrayList elementList = new java.util.ArrayList();
java.util.ArrayList attribList = new java.util.ArrayList();

if (localHashAutenticacaoTracker){
elementList.add(new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor",
"HashAutenticacao"));

if (localHashAutenticacao != null){
elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localHashAutenticacao));
} else {
throw new org.apache.axis2.databinding.ADBException("HashAutenticacao cannot be null!!");
}
} if (localCodigoRetornoTracker){
elementList.add(new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor",
"CodigoRetorno"));

if (localCodigoRetorno != null){
elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localCodigoRetorno));
} else {
throw new org.apache.axis2.databinding.ADBException("CodigoRetorno cannot be null!!");
}
}

return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());



}



/**
* Factory class that keeps the parse method
*/
public static class Factory{




/**
* static method to create the object
* Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
* If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
* Postcondition: If this object is an element, the reader is positioned at its end element
* If this object is a complex type, the reader is positioned at the end element of its outer element
*/
public static AutenticacaoSistemaRevendedorWM parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
AutenticacaoSistemaRevendedorWM object =
new AutenticacaoSistemaRevendedorWM();

int event;
java.lang.String nillableValue = null;
java.lang.String prefix ="";
java.lang.String namespaceuri ="";
try {

while (!reader.isStartElement() && !reader.isEndElement())
reader.next();


if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"type");
if (fullTypeName!=null){
java.lang.String nsPrefix = null;
if (fullTypeName.indexOf(":") > -1){
nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix==null?"":nsPrefix;

java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1);

if (!"AutenticacaoSistemaRevendedorWM".equals(type)){
//find namespace for the prefix
java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return (AutenticacaoSistemaRevendedorWM)ExtensionMapper.getTypeObject(
nsUri,type,reader);
}


}


}




// Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
java.util.Vector handledAttributes = new java.util.Vector();




reader.next();


while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

if (reader.isStartElement() && new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor","HashAutenticacao").equals(reader.getName())){

java.lang.String content = reader.getElementText();

object.setHashAutenticacao(
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));

reader.next();

} // End of if for expected property start element

else {

}


while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

if (reader.isStartElement() && new javax.xml.namespace.QName("www.webmotors.com.br/wsLoginSistemaRevendedor","CodigoRetorno").equals(reader.getName())){

java.lang.String content = reader.getElementText();

object.setCodigoRetorno(
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));

reader.next();

} // End of if for expected property start element

else {

}

while (!reader.isStartElement() && !reader.isEndElement())
reader.next();

if (reader.isStartElement())
// A start element we are not expecting indicates a trailing invalid property
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName());




} catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
}

return object;
}

}//end of factory class



}


private org.apache.axiom.om.OMElement toOM(wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.Autenticar param, boolean optimizeContent)
throws org.apache.axis2.AxisFault {


try{
return param.getOMElement(wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.Autenticar.MY_QNAME,
org.apache.axiom.om.OMAbstractFactory.getOMFactory());
} catch(org.apache.axis2.databinding.ADBException e){
throw org.apache.axis2.AxisFault.makeFault(e);
}


}

private org.apache.axiom.om.OMElement toOM(wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.AutenticarResponse param, boolean optimizeContent)
throws org.apache.axis2.AxisFault {


try{
return param.getOMElement(wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.AutenticarResponse.MY_QNAME,
org.apache.axiom.om.OMAbstractFactory.getOMFactory());
} catch(org.apache.axis2.databinding.ADBException e){
throw org.apache.axis2.AxisFault.makeFault(e);
}


}


private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.Autenticar param, boolean optimizeContent, javax.xml.namespace.QName methodQName)
throws org.apache.axis2.AxisFault{


try{

org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
emptyEnvelope.getBody().addChild(param.getOMElement(wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.Autenticar.MY_QNAME,factory));
return emptyEnvelope;
} catch(org.apache.axis2.databinding.ADBException e){
throw org.apache.axis2.AxisFault.makeFault(e);
}


}


/* methods to provide back word compatibility */




/**
* get the default envelope
*/
private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory){
return factory.getDefaultEnvelope();
}


private java.lang.Object fromOM(
org.apache.axiom.om.OMElement param,
java.lang.Class type,
java.util.Map extraNamespaces) throws org.apache.axis2.AxisFault{

try {

if (wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.Autenticar.class.equals(type)){

return wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.Autenticar.Factory.parse(param.getXMLStreamReaderWithoutCaching());


}

if (wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.AutenticarResponse.class.equals(type)){

return wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.AutenticarResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching());


}

} catch (java.lang.Exception e) {
throw org.apache.axis2.AxisFault.makeFault(e);
}
return null;
}
}

Second is :

/**
* WsLoginSistemaRevendedorCallbackHandler.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.6.1 Built on : Aug 31, 2011 (12:22:40 CEST)
*/

package wsloginsistemarevendedor.br.com.webmotors.www;

/**
* WsLoginSistemaRevendedorCallbackHandler Callback class, Users can extend this class and implement
* their own receiveResult and receiveError methods.
*/
public abstract class WsLoginSistemaRevendedorCallbackHandler{



protected Object clientData;

/**
* User can pass in any object that needs to be accessed once the NonBlocking
* Web service call is finished and appropriate method of this CallBack is called.
* @param clientData Object mechanism by which the user can pass in user data
* that will be avilable at the time this callback is called.
*/
public WsLoginSistemaRevendedorCallbackHandler(Object clientData){
this.clientData = clientData;
}

/**
* Please use this constructor if you don't want to set any clientData
*/
public WsLoginSistemaRevendedorCallbackHandler(){
this.clientData = null;
}

/**
* Get the client data
*/

public Object getClientData() {
return clientData;
}


/**
* auto generated Axis2 call back method for autenticar method
* override this method for handling normal response from autenticar operation
*/
public void receiveResultautenticar(
wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.AutenticarResponse result
) {
}

/**
* auto generated Axis2 Error handler
* override this method for handling error response from autenticar operation
*/
public void receiveErrorautenticar(java.lang.Exception e) {
}
}

My Main class is :

package br.com.webmotors.servlet;

import src.wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub;
import wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.AutenticacaoSistemaRevendedorWM;
import wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.Autenticar;
import wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.AutenticarResponse;

public class WebwseMain {

/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {

WsLoginSistemaRevendedorStub stub = new WsLoginSistemaRevendedorStub();

Autenticar autenticar4 = new Autenticar();
autenticar4.setCnpj("XXX");
autenticar4.setEmail("XXX");
autenticar4.setSenha("XXX");

AutenticarResponse autenticarResponse = stub.autenticar(autenticar4);
AutenticacaoSistemaRevendedorWM aSRWM = autenticarResponse.getAutenticarResult();
String hashAutenticacao = aSRWM.getHashAutenticacao();
String codigoRetorno = aSRWM.getCodigoRetorno();

System.out.println(hashAutenticacao);
System.out.println(codigoRetorno);

}

}

I obtain this erro :
I need a help of yours.
Thank you
Mario Gomes


Exception in thread "main" org.apache.axis2.AxisFault: Transport error: 302 Error: Redirect
at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:310)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:194)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at src.wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.autenticar(WsLoginSistemaRevendedorStub.java:185)
at br.com.webmotors.servlet.WebwseMain.main(WebwseMain.java:23)
[INFO] Unable to sendViaPost to url[http://www.webmotors.com.br/IntegracaoRevendedor/wsLoginSistemaRevendedor.asmx]
org.apache.axis2.AxisFault: Transport error: 302 Error: Redirect
at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:310)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:194)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at src.wsloginsistemarevendedor.br.com.webmotors.www.WsLoginSistemaRevendedorStub.autenticar(WsLoginSistemaRevendedorStub.java:185)
at br.com.webmotors.servlet.WebwseMain.main(WebwseMain.java:23)




 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Axis2 Transport error calling stub