我现在是java里面调用别人做的webservice接口,别的公司用的是.net做的接口,我这边java来调用,调用的方法如下:public String sendCardToGIS(String method,String xmlparam){
String result = "0";
try{
serviceClient = new Service( );
callClient = (Call) serviceClient.createCall( );
//GIS的webservice地址
callClient.setTargetEndpointAddress( new java.net.URL("http://134.224.1.121/JKsite091402/TelAssetWebService.asmx") );
//GIS的webservice方法
callClient.setOperationName(new QName("http://tempuri.org/", method));
callClient.addParameter(new QName("http://tempuri.org/","xmlparam"),org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
callClient.setUseSOAPAction(true);
callClient.setSOAPActionURI("http://tempuri.org/CardBack");
callClient.setReturnType(org.apache.axis.encoding.XMLType.SOAP_STRING);
String xmlResult = (String) callClient.invoke(new Object[]{xmlparam}); System.out.println("传的参数为:"+ xmlparam );
System.out.println("返回的结果为:" +xmlResult );
//解析调用返回的结果XML字符串
TIFResponse tifResponse=IFResponseUtility.buildEntityString( xmlResult );
result=tifResponse.getIfResult( );//这个result是对方返回的xml中的一个节点中的值
if(!result.equals( "0" ))
{
result="1";
if(tifResponse.getIfError( )!=null&&!tifResponse.getIfError( ).equals( "" ))
logger.error("调用GIS接口时发生错误:"+tifResponse.getIfError( ));
if(tifResponse.getIfErrorStack( )!=null&&!tifResponse.getIfErrorStack( ).equals( "" ))
logger.error("调用GIS接口时发生错误异常:"+tifResponse.getIfErrorStack( ));
}
}catch ( Exception e ){
System.out.println( "调用失败!" );
e.printStackTrace( );
logger.error( e.getCause( ).getMessage( ));
if( e.getCause( ).getMessage( ).equals("Connection timed out: connect")){
return "2";
}
return "1";
}
return result;
}调用完了结果发现那边返回报错:值不能为空。参数名: s
试了各种办法都没有结果,都解决不了问题,不知道是我这边调用方式有问题还是那边接口有问题,我这边传的参数是一个xml形式的String类型的参数,我自己这边打印出来是完整的xml格式的内容,但是通过接口传过去就变为空了,不知道是什么原因,各位大侠帮帮忙,很急的!!
String result = "0";
try{
serviceClient = new Service( );
callClient = (Call) serviceClient.createCall( );
//GIS的webservice地址
callClient.setTargetEndpointAddress( new java.net.URL("http://134.224.1.121/JKsite091402/TelAssetWebService.asmx") );
//GIS的webservice方法
callClient.setOperationName(new QName("http://tempuri.org/", method));
callClient.addParameter(new QName("http://tempuri.org/","xmlparam"),org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
callClient.setUseSOAPAction(true);
callClient.setSOAPActionURI("http://tempuri.org/CardBack");
callClient.setReturnType(org.apache.axis.encoding.XMLType.SOAP_STRING);
String xmlResult = (String) callClient.invoke(new Object[]{xmlparam}); System.out.println("传的参数为:"+ xmlparam );
System.out.println("返回的结果为:" +xmlResult );
//解析调用返回的结果XML字符串
TIFResponse tifResponse=IFResponseUtility.buildEntityString( xmlResult );
result=tifResponse.getIfResult( );//这个result是对方返回的xml中的一个节点中的值
if(!result.equals( "0" ))
{
result="1";
if(tifResponse.getIfError( )!=null&&!tifResponse.getIfError( ).equals( "" ))
logger.error("调用GIS接口时发生错误:"+tifResponse.getIfError( ));
if(tifResponse.getIfErrorStack( )!=null&&!tifResponse.getIfErrorStack( ).equals( "" ))
logger.error("调用GIS接口时发生错误异常:"+tifResponse.getIfErrorStack( ));
}
}catch ( Exception e ){
System.out.println( "调用失败!" );
e.printStackTrace( );
logger.error( e.getCause( ).getMessage( ));
if( e.getCause( ).getMessage( ).equals("Connection timed out: connect")){
return "2";
}
return "1";
}
return result;
}调用完了结果发现那边返回报错:值不能为空。参数名: s
试了各种办法都没有结果,都解决不了问题,不知道是我这边调用方式有问题还是那边接口有问题,我这边传的参数是一个xml形式的String类型的参数,我自己这边打印出来是完整的xml格式的内容,但是通过接口传过去就变为空了,不知道是什么原因,各位大侠帮帮忙,很急的!!
解决方案 »
- MyEclipse6.0异常问题:客户端能成功下载服务器的文件,但在控制台上显示一个异常
- 怎么把保质期预警消息保存到数据库中,然后再显示到页面上?
- 求教 :能用一个月时间初步掌握struts也就是javaee 初步的web开发方面
- 请教一个错误
- openamf 和 remoting的使用 求救急!!
- 关于cookie的同名问题,我想去的所有同名的cookie怎么做?帮帮忙
- response 输出为什么始终有一空行,怎么去掉它????
- 救命啊!!!!
- 非常奇怪的问题:href=question.jsp?a=&b=&c=123,当接收这些参数时,C的值为什么不是123,而是null!!!
- 我要code
- 求助struts2 配置的action路径找不到
- 怎么限制IP投票?
看下这个貌似java 调用webserveice的时候 不用addparam尤其是 参数本身就是string的时候
我看到很多地方都是用到了这个addparam,声明参数的,我没用也试过了,你给的连接地址里边的写法我也都试过了,结果都一样,没有解决问题,还是返回空。
ip查询接口 http://webservice.36wu.com/ipService.asmx
天气预报接口 http://webservice.36wu.com/weatherService.asmx
身份证查询接口 http://webservice.36wu.com/IdCardService.asmx
手机归属地接口 http://webservice.36wu.com/MobilePhoneService.asmx
翻译接口 http://webservice.36wu.com/TranslationService.asmx
火车时刻接口:http://webservice.36wu.com/TrainService.asmx
股票查询接口:http://webservice.36wu.com/StockService.asmx
邮编接口:http://webservice.36wu.com/ZipcodeService.asmx
二维码Web服务
http://webservice.36wu.com/DimensionalCodeService.asmx
公交查询Web服务
http://webservice.36wu.com/mapService.asmx
ISBN查询Web服务
http://webservice.36wu.com/ISBNService.asmx
ICP备案查询Web服务 http://webservice.36wu.com/ICPServic.asmx