document/literal DII client does not work
luan Jan 31, 2006 2:23 PMHi,
I'm getting an error when running DII client for a document/literal webservice. It can not determine the parameter type. Static client works.
Any help would be greatly appreciated.
Luan
[java] the serializer/deserializer for parameter number: 0,named: "{http://www.w3.org/2001/XMLSchema}string", type: "{http://www.w3.org/2001/XMLSchema}str
ing", is ambiguous because its class could not be determined
The DII client code is as follows:
import java.net.*;
import javax.xml.rpc.*;
import javax.xml.namespace.*;
public class WSDIIClient {
private static String qnameService = "MgiParser";
private static String qnamePort = "MgiParserInterfacePort";
private static String endpoint_url = "http://localhost:8080/MgiParserServerJBoss/myParserService";
private static String wsdl_url = "http://localhost:8080/MgiParserServerJBoss/myParserService?wsdl";
private static String target_namespace = "http://com.mgiparser/MgiParser";
private static String NS_XSD =
"http://www.w3.org/2001/XMLSchema";
private static String part_name = "parameters";
private static String operation_name = "getParsingResult";
public static void main(String[] args) {
try {
ServiceFactory factory =
ServiceFactory.newInstance();
Service service =
factory.createService(new URL(wsdl_url),
new QName(target_namespace, qnameService));
QName port = new QName(target_namespace, qnamePort);
Call call = service.createCall(port);
call.setTargetEndpointAddress(endpoint_url);
call.setProperty(Call.SOAPACTION_USE_PROPERTY,
new Boolean(true));
call.setProperty(Call.SOAPACTION_URI_PROPERTY,
"http://com.mgiparser/MgiParser/getParsingResult");
call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY, "");
call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");
QName QNAME_TYPE_STRING =
new QName(NS_XSD, "string");
call.setReturnType(QNAME_TYPE_STRING);
call.setOperationName(
new QName(target_namespace, operation_name));
call.addParameter(part_name, QNAME_TYPE_STRING,
ParameterMode.IN);
Object[] params = new Object[] { "test string1","test string2" };
String result = (String)call.invoke(params);
System.out.println(result);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}