I have 10 year old Java code to call an outdated SOAP authentication service. WSDL is RPC: ENCODED and contains many typos. I was hoping to easily convert the old code to Axis 1.4 or something like that, but ran into snags. All I watched wanted to use WSDL. Can someone help translate this into modern code that does not require faulty WSDL?
Here's the SOAP call section:
SOAPMappingRegistry soapmappingregistry = new SOAPMappingRegistry();
BeanSerializer beanserializer = new BeanSerializer();
soapmappingregistry.mapTypes(Constants.NS_URI_SOAP_ENC, new QName(
"urn:xml-soap-session-demo", "authenticationresult"),
AuthenticationResult.class, beanserializer, beanserializer);
Call call = new Call();
call.setSOAPMappingRegistry(soapmappingregistry);
call.setTargetObjectURI("urn:Security");
call.setMethodName("authenticate");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Vector<Object> vector = new Vector<Object>();
vector.addElement(new Parameter("app", String.class, "PHS", null));
vector.addElement(new Parameter("user", String.class, userName, null));
vector.addElement(new Parameter("password", String.class, password, null));
vector.addElement(new Parameter("encryption", Integer.class, new Integer(0), null));
call.setParams(vector);
Response response = null;
URL endpointURL = new URL(endpoint);
response = call.invoke(endpointURL, "");
if (!response.generatedFault()) {
Parameter parameter = response.getReturnValue();
Object obj = parameter.getValue();
...
}
Many thanks.
source
share