0
我遇到的問題是Apache CXF將名稱空間放在元素中而不是soap信封中。Apache CXF客戶端命名空間位於元素內而不是信封
我使用codegen maven插件從WSDL生成客戶端代碼。
這裏是WSDL中的命名空間:
當我火了SOAP請求,我可以在日誌中看到下面的消息已發送:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:userRegistrationRequest xmlns:ns1="http://some.com/namespace1">
<InputParameter xmlns:ns2="http://some.com/namespace1">
<ns2:Message>
<ns2:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<ns2:HashTable>
<ns2:Item key="action">
<ns2:Value>some_action</ns2:Value>
</ns2:Item>
</ns2:HashTable>
</ns2:Message>
</InputParameter>
</ns1:userRegistrationRequest>
</soap:Body>
的問題是當我構造消息時,我的代碼中的Value元素爲null,但在這裏它與XSI命名空間一起出現。
我所期待得到的是這樣的事情(Value元素不應該存在和XSI應在信封元素):
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<ns1:userRegistrationRequest xmlns:ns1="http://some.com/namespace1">
<InputParameter xmlns:ns2="http://some.com/namespace1">
<ns2:Message>
<ns2:HashTable>
<ns2:Item key="action">
<ns2:Value>some_action</ns2:Value>
</ns2:Item>
</ns2:HashTable>
</ns2:Message>
</InputParameter>
</ns1:userRegistrationRequest>
</soap:Body>
有沒有人有一個想法如何預防CXF生成空的Value元素並將該名稱空間放在soap envelope元素中?