急~~~求解soap 问题~

holilyboy 2007-03-30 02:44:53
public class SampleCode {

/** Creates a new instance of SampleCode */
public SampleCode() {
}

public static void main(String []vs) {
URL url = null;
try {
url = new URL("http://127.0.0.1/services/test?wsdl");
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
if(null==url){
System.out.println("___________service地址错误");
return ;
}

SOAPMappingRegistry smr = new SOAPMappingRegistry();
StringDeserializer sd = new StringDeserializer();
smr.mapTypes(Constants.NS_URI_SOAP_ENC, new QName("", "Result"), null, null, sd);
// 创建传输路径和参数
SOAPHTTPConnection st = new SOAPHTTPConnection();

// 创建调用
Call call = new Call();
call.setSOAPTransport(st);
call.setSOAPMappingRegistry(smr);

call.setTargetObjectURI("http://127.0.0.1/services/test");
call.setMethodName("webServicesTest");

call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

Response resp = null;
try {
resp = call.invoke(url, "");
}catch (SOAPException e) {
System.err.println("Caught SOAPException (" + e.getFaultCode() + "): " + e.getMessage());
System.out.println(e.toString());
return ;
}
// 检查返回值
if (resp != null && !resp.generatedFault()){
Parameter ret = resp.getReturnValue();
Object value = ret.getValue();

System.out.println("Answer-----> " + value);
return ;
}else{
Fault fault = resp.getFault();
System.err.println("Generated fault: ");
System.out.println(" Fault Code = " + fault.getFaultCode());
System.out.println(" Fault String = " + fault.getFaultString());
return ;
}

}
}



运行后报错:
[SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to deserialize a 'http://schemas.xmlsoap.org/soap/encoding/:string' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.; targetException=java.lang.IllegalArgumentException: No Deserializer found to deserialize a 'http://schemas.xmlsoap.org/soap/encoding/:string' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.]


如何解决?
报的是string的反序列化问题???还是其它问题啊~~
...全文
191 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧