1
这是在SOAPUI中显示的WSDL中使用的XML。如何在java中将值传递给xsd:string RPC编码的SOAP xml参数?
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bran="BDetail">
<soapenv:Header/>
<soapenv:Body>
<bran:sentIbBTyp soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<pBnCode xsi:type="xsd:string">234</pBnCode>
</bran:sentIbBTyp>
</soapenv:Body>
</soapenv:Envelope>
我用这个Java代码来传递值
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
soapEnvelope.addNamespaceDeclaration("xsd",
"http://www.w3.org/2001/XMLSchema");
soapEnvelope.addNamespaceDeclaration("xsi",
"http://www.w3.org/2001/XMLSchema-instance");
soapEnvelope.addNamespaceDeclaration("bran", "BDetail");
SOAPBody soapBody = soapEnvelope.getBody();
SOAPElement soapElement = soapBody.addChildElement(
"sentIbBTyp", "bran");
soapElement
.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/");
SOAPElement elementBankCode = soapElement.addChildElement("pBnCode");
elementBankCode.setValue("234");
我得到这个错误。请帮我...
SOAP error No Deserializer found to deserialize a ':pBnCode' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'. [java.lang.IllegalArgumentException]
非常感谢。它的效果很好。 – Thushara