Web服务的问题 [英] Problems with a Web Service

查看:91
本文介绍了Web服务的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!早上好!



我在这里遇到问题。

我必须通过WebService发送XML。

此XML必须以ZLib格式压缩,然后以Base64格式压缩。



在此之前,一切正常。



当我发送这个XML并且结构和信息错误时,我收到一个小回报,说我出了什么问题,这很好。



我的问题是当我发送所有内容并且我应该收到另一个包含重要信息的XML时,我只收到部分XML。





但经过一些测试,我意识到当我收到答案时。我只得到了它的一部分。返回XML在随机位置切割。就像通信在结束之前结束一样。我收到的所有时间都在4-6ko左右。尺寸不是一成不变的。



我想到了一个网络问题。我在另一个网络上测试过,是一样的。



我在我身边添加了超时但没有任何变化。



我真的不知道还有什么可以尝试。



这里去我的代码:



  public   String  envioWs(字符串 msg){
尝试 {
字符串 urlWS = URL;
Object [] params = {geraMsgComp(msg)};

服务服务= 服务();
来电=(来电)service.createCall();

call.setTargetEndpointAddress(urlWS);
call.setOperationName( OPERATION);
// call.setTimeout(new Integer(999999999));

String ret =( String )call.invoke(params);

ret = geraString(ret.getBytes());

return ret;
}
catch (Exception ex){
ex.printStackTrace();
return null;
}
}





方法geraMsgComp刚刚压缩了ZLib格式的XML ,然后换上Base64格式,方法geraString完全回复。



任何想法???



感谢您的未来建议。

解决方案

Hello There !!



我有发现了错误。

这不是代码的这一部分,它是在ZLib类中,解压缩方法。

它设置了一个限制要解压缩的字符串大小。



感谢所有尝试过的人。



Ray

Hello There! Good Morning!

I''m with a problem here.
I have to send a XML through a WebService.
This XML must be compressed on a ZLib format, and then put on Base64 format.

Until here, everything is OK.

when I send this XML and the structure and the information is wrong I receive the a small return saying me what is wrong, and this is working fine.

My problem is when I send everything right and I should receive another XML that''s contains important information for me, I receive just part of the XML.


But after some tests, I realized that when I receive the answer. I got only a part of it. The return XML is cut in a random place. Like if the communication was ended before have finished. I receive all time around 4-6ko. The size is not constant.

I thought about a network problem. I have tested in another network, is the same.

I add a timeout on my side but nothing change.

I really don''t know what more to try.

Here go my codes:

public String envioWs(String msg){
    try{
        String urlWS = "URL";
        Object[] params = {geraMsgComp(msg)};

        Service service = new Service();
        Call call = (Call) service.createCall();

        call.setTargetEndpointAddress(urlWS);
        call.setOperationName("OPERATION");
        //call.setTimeout(new Integer(999999999));

        String ret = (String) call.invoke(params);

        ret = geraString(ret.getBytes());

        return ret;
    }
    catch(Exception ex){
        ex.printStackTrace();
        return null;
    }
}



The method "geraMsgComp" just compressed the XML on a ZLib format, and then put on Base64 format, the method "geraString" does exactly the reversion.

any ideas???

Thanks for your future advises.

解决方案

Hello There!!

I have found the error.
It wasn''t in this part of the code, it was in the ZLib class, the decompress method.
It was setting a limit to the size of the string to decompress.

Thanks for all who had tried.

Ray


这篇关于Web服务的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆