Помогите пожалуйста! Я реализовал клиент веб-службы, используя Axis2-wsdl2 java, чтобы генерировать классы java из wsdl, а затем объединить их в файл jar. Затем вставьте эту банку в другой проект java.
Однако произошла ошибка при вызове веб-службы. Ошибка, показанная ниже:
Caused by: org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxParsingException: Undeclared namespace prefix "soapenv"
at [row,col {unknown-source}]: [1,56]
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:508) ~[axis2-kernel-1.7.7.jar:1.7.7]
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:368) ~[axis2-kernel-1.7.7.jar:1.7.7]
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:414) ~[axis2-kernel-1.7.7.jar:1.7.7]
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225) ~[axis2-kernel-1.7.7.jar:1.7.7]
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:150) ~[axis2-kernel-1.7.7.jar:1.7.7]
Трассировка стека:
2020-05-08T14:56:49,304 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG StAXUtils - About to create XMLOutputFactory implementation with classloader=weblogic.utils.classloade
rs.ChangeAwareClassLoader@2e614a1e finder: weblogic.utils.classloaders.CodeGenClassFinder@22c29993 annotation: xxxx.war#xxxx@xxxx.war
2020-05-08T14:56:49,304 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG StAXUtils - The classloader for javax.xml.stream.XMLOutputFactory is: null
2020-05-08T14:56:49,313 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG StAXUtils - Created XMLOutputFactory = class org.apache.axiom.util.stax.wrapper.ImmutableXMLOutputFact
ory for classloader=weblogic.utils.classloaders.ChangeAwareClassLoader@2e614a1e finder: weblogic.utils.classloaders.CodeGenClassFinder@22c29993 annotation: xxxx.war#xxxx@xxxx.war
2020-05-08T14:56:49,313 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG StAXUtils - Configuration = DEFAULT
2020-05-08T14:56:49,313 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG StAXUtils - Size of XMLOutFactory map for this configuration = 1
2020-05-08T14:56:49,313 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG StAXUtils - Configurations for which factories have been cached = [DEFAULT]
2020-05-08T14:56:49,317 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG StAXUtils - XMLStreamWriter is weblogic.xml.stax.XMLWriterBase
2020-05-08T14:56:49,325 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG SOAPEnvelopeImpl - Could not close builder or parser due to:
2020-05-08T14:56:49,325 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG SOAPEnvelopeImpl - builder is null
2020-05-08T14:56:49,325 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG MTOMXMLStreamWriter - close
2020-05-08T14:56:49,325 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG MTOMXMLStreamWriter - Calling MTOMXMLStreamWriter.flush
2020-05-08T14:56:49,325 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG MTOMXMLStreamWriter - The XML writing is completed. Now the attachments are written
2020-05-08T14:56:49,327 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG SOAPMessageFormatter - end writeTo()
2020-05-08T14:56:49,328 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG Wire - >> "6cf[\r][\n]"
2020-05-08T14:56:49,328 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG Wire - >> "--MIMEBoundary_a6f6616dfa4a4e02ee5b5898c7552f014444c88a5dad3175[\r][\n]"
2020-05-08T14:56:49,328 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG Wire - >> "Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"[\r][\n]"
2020-05-08T14:56:49,328 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG Wire - >> "Content-Transfer-Encoding: binary[\r][\n]"
2020-05-08T14:56:49,328 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG Wire - >> "Content-ID: <0.96f6616dfa4a4e02ee5b5898c7552f014444c88a5dad3175@apache.org>[\r][\n]"
2020-05-08T14:56:49,329 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG Wire - >> "[\r][\n]"
2020-05-08T14:56:49,329 [ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)' DEBUG Wire - >> "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope><soapenv:Header><wsse:Security xmln
s:mustUnderstand="http://schemas.xmlsoap.org/soap/envelope/" mustUnderstand:mustUnderstand="0">
Я не знаю, почему отсутствует пространство имен soap envelop: DEBUG Wire - >> "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope><soapenv:Header>
Дополнительная информация:
Я использую Axiom 1.2.20 для создания soap xml:
ServiceClient sc = serviceStub._getServiceClient();
sc.getOptions().setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
Версия Axis2 - 1.7.7
Я также добавлена следующая зависимость, но она, похоже, не работает.
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>woodstox-core-asl</artifactId>
<version>4.4.1</version>
</dependency>
Weblogi c версия сервера: 12.2.1.4
Большое спасибо