Retrofit进行WebService请求遇到的问题总结
发布时间:2020-12-16 22:07:46 所属栏目:安全 来源:网络整理
导读:前面写了一篇利用Retrofit进行WebService请求的文章,地址是:http://blog.csdn.net/smileiam/article/details/51957232,下面说说自己在调试过程中,遇到的一些问题及解决办法。给其他遇到类似问题的小伙伴,一些参考。 1.? soapaction header missing,no S
前面写了一篇利用Retrofit进行WebService请求的文章,地址是:http://blog.csdn.net/smileiam/article/details/51957232,下面说说自己在调试过程中,遇到的一些问题及解决办法。给其他遇到类似问题的小伙伴,一些参考。 1.?soapaction header missing,no SOAPAction header 这个一般是请求的方法,请求头中没有添加SOAPAction,只需要在写请求方法的头上添加上相应的Action @Headers({"Content-Type: text/xml;charset=UTF-8","SOAPAction: http://WebXml.com.cn/getWeatherbyCityName"})//请求的Action
2. soapenv:VersionMismatch
这个在stackoverflow上有人给出解释:The faulting node found an invalid element information item instead of the expected Envelope element information item. The namespace,local name or both did not match the Envelope element information item required by this recommendation
大意是因为命名空间写的不对,或是结点元素无效,不是期望的Envelope元素等。
像我是因为粗心,命名空间忘记写最后面的反斜杠。下面是错误的写法:@Namespace(reference = "http://schemas.xmlsoap.org/soap/envelope",prefix = "env") (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |