我有一些 10 年前的 Java 代码用于调用旧版 SOAP 身份验证服务。WSDL 是 RPC:ENCODED 并且包含许多拼写错误。我希望轻松地将旧代码转换为 Axis 1.4 或其他东西,但遇到了障碍。我看到的所有东西都想使用 WSDL。有人可以帮助将其翻译成不需要错误 WSDL 的现代代码吗?
这是 SOAP 调用部分:
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();
...
}
非常感谢。