Hi,
In the organization where I work, there is a SOAP server implemented
in Perl (through SOAPLite).
A Java client exists, which uses the old Apache SOAP package. This
client works perfectly.
I have now orders to migrate to AXIS 1.4. Although I am not able to do
it, I always get an exception when I invoke my Call's class instance
"invoke" method.
The exception and its details are:
SAXParseException: Content is not allowed in trailing section
My client code is:
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;
public class UserAuthentication
{
public static final String AUTH_SERVER = "cdbserv02.cern.ch";
public static final String END_POINT = "https://" + AUTH_SERVER +
"/cgi-bin/cdbweb.fcgi";;
public static boolean isValidUser(String userName, String passwd)
throws Exception
{
Service service = new Service();
Call call = null;
try
{
call = (Call) service.createCall();
}
catch( ServiceException ex )
{
log.error("Error creating SOAP call: " + ex.getMessage());
throw ex;
}
call.setTargetEndpointAddress(END_POINT);
call.setSOAPActionURI("cdbsoap");
call.setOperationName("cdb_login");
call.addParameter("username", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("password", XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);
String ret = null;
try
{
ret = (String) call.invoke(new Object[] { userName, passwd });
}
catch( Exception ex )
{
log.error("SOAP call error: " + ex.getMessage());
throw ex;
}
if ( log.isDebugEnabled() )
{
log.debug("Message received from CDB SOAPinterface: " + ret);
}
if ( ret.contains("authentication failed") )
{
log.warn("Invalid login attempt by user '" + userName + "'");
return false;
}
return true;
}
}
The code of the client using the old SOAP package is:
import oracle.soap.transport.http.OracleSOAPHTTPConnection;
import org.apache.soap.encoding.SOAPMappingRegistry;
import org.apache.soap.Constants;
import org.apache.soap.Fault;
import org.apache.soap.SOAPException;
import org.apache.soap.rpc.Call;
import org.apache.soap.rpc.Parameter;
import org.apache.soap.rpc.Response;
import java.net.URL;
import java.util.Vector;
import java.util.Properties;
public class CDBSoapStub {
public String endpoint = null;
private String targetObjectURI = "cdbsoap";
private OracleSOAPHTTPConnection m_httpConnection = null;
private SOAPMappingRegistry m_smr = null;
public CDBSoapStub(String server) {
endpoint = "https://" + server + "/cgi-bin/cdbweb.fcgi";
m_httpConnection = new OracleSOAPHTTPConnection();
m_smr = new SOAPMappingRegistry();
}
public String login(String username, String password) throws Exception {
String returnVal = null;
System.setProperty("java.protocol.handler.pkgs",
"sun.net.www.protocol | HTTPClient");
URL endpointURL = new URL(endpoint);
Call call = new Call();
call.setSOAPTransport(m_httpConnection);
call.setTargetObjectURI(targetObjectURI);
call.setMethodName("cdb_login");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Vector params = new Vector();
params.addElement(new Parameter("username", java.lang.String.class,
username, null));
params.addElement(new Parameter("password", java.lang.String.class,
password, null));
call.setParams(params);
call.setSOAPMappingRegistry(m_smr);
Response response = call.invoke(endpointURL, "");
if (!response.generatedFault()) {
Parameter result = response.getReturnValue();
returnVal = "Value = " + result.getValue().toString();
}
else {
Fault fault = response.getFault();
returnVal = fault.getFaultString();
throw new SOAPException(fault.getFaultCode(), fault.getFaultString());
}
return returnVal;
}
}
Any suggestion?
Thank you
--
Filipe David Manana,
[EMAIL PROTECTED]
Obvious facts are like secrets to those not trained to see them.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]