我正在查看我正在开发的 Web 服务的 SOAP 输出,我注意到一些奇怪的事情:
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns1:CreateEntityTypesResponse xmlns:ns1="http://somedomain.com/wsinterface">
<newKeys>
<value>1234</value>
</newKeys>
<newKeys>
<value>2345</value>
</newKeys>
<newKeys>
<value>3456</value>
</newKeys>
<newKeys xsi:nil="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<newKeys xsi:nil="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<errors>Error1</errors>
<errors>Error2</errors>
</ns1:CreateEntityTypesResponse>
</soapenv:Body>
</soapenv:Envelope>
我有两个 nil 的 newKeys 元素,并且两个元素都为 xsi 插入了一个命名空间引用。我想将该命名空间包含在 soapenv:Envelope 元素中,以便命名空间引用只发送一次。
我正在使用 WSDL2Java 生成服务框架,因此我无法直接访问 Axis2 API。