+ Start a Discussion
plpl 

what is the return datatype from login ? I need a java class acting as deserializer.

I am using APache soap v2 API , here is the piece of code

I got exception - need deseriablizer for a "salesforec:map"

 

Could you help me out

String endPointURL = "http://www.salesforce.com/servlet/servlet.SoapApi";

//build soap call object
String encodingStyleURI
= Constants.NS_URI_SOAP_ENC; //should get from propperties
try {
url
= new URL(endPointURL);
}
catch (Exception e){};

System.out.println(
"url "+url);
SOAPMappingRegistry smr
= new SOAPMappingRegistry ();
//MapSerializer sd = new MapSerializer ();
MapEntrySerializer sd
= new MapEntrySerializer ();

smr.mapTypes (Constants.NS_URI_SOAP_ENC,
new QName ("", "return"),MapEntry.class, sd, sd);


// Build the call.
Call call
= new Call();

call.setTargetObjectURI(
"sfconnector:SalesforceConnector");
call.setMethodName(
"login");
call.setEncodingStyleURI(encodingStyleURI);
call.setSOAPMappingRegistry (smr);


Vector params
= new Vector();
params.addElement(
new Parameter("version", String.class,
"1.9", null));
params.addElement(
new Parameter("username", String.class,
"rthurston@aptsoft.com", null));
params.addElement(
new Parameter("password", String.class,
"Aptsoft", null));
params.addElement(
new Parameter("secure", java.lang.Boolean.class,
(Boolean)(
new Boolean(false)),null));
params.addElement(
new Parameter("remoteApplication", String.class,
"myApp", null));


call.setParams(params);
System.out.println(
"params set "+call.toString());


// Invoke the call.
Response resp;
try {
resp
= call.invoke(url, "");
MapEntry me
= (MapEntry)resp.getReturnValue().getValue();
String sid
= (String)me.getValue();
}
catch (SOAPException e){
System.out.println(
"Caught SOAPException (" +
e.getFaultCode()
+ "): " +
e.getMessage());
return false;
}

// Check the response.
if (!resp.generatedFault()) {
return true;

}
else {

Fault fault
= resp.getFault();

System.out.println(
"Generated fault: ");
System.out.println(
" Fault Code = " + fault.getFaultCode());
System.out.println(
" Fault String = " + fault.getFaultString());
return true;

}