用soap做的webservice,參數爲null的問題

1.普通的參數服務端接收不到,爲null解決辦法:

@WebParam(name="strUserid",targetNamespace="http://certSynchronous.controller.monitorWeb.business.site.bjca.org.cn/") String strUserid

參數前邊需要加上@WebParam和targetNamespace兩個註解。

2服務端接收對象,爲null解決辦法:

這種問題實際是由於報文格式不對導致的,如下報文,用info對象接收沒有問題

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:con="http://controller.demo.com/">
    <soapenv:Header/>
    <soapenv:Body>
        <con:testBjca>
            <strUserid>7654322</strUserid><strGuid>?</strGuid>
            <info>
                <encCert>4444444444</encCert>
                <encCertSN>FFFFFFFFFF</encCertSN>
                <envsn>111</envsn>
                <errorCode>1</errorCode>
                <signCert>REWRW</signCert>
                <signCertSN>ERWEREWW</signCertSN>
                <userUniqueID>oiuytrewqjhgfdsa</userUniqueID>
            </info>
        </con:testBjca>
    </soapenv:Body>
</soapenv:Envelope>


完整例子如https://download.csdn.net/download/yuxiaoshuangshuang/10462154




發佈了29 篇原創文章 · 獲贊 45 · 訪問量 10萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章