SOAP 1.2 메시지를받는 서버를 작성하고 있습니다. 내가 가진 문제는 SOAP 1.1 메시지를 SOAPUI를 통해 전송할 때 메시지가 올바르게 처리되지만 SOAP 1.2 메시지가 아닌 경우입니다. 나는 axis2를 사용한다. SOAP 1.2에서 Axis 2가 파싱되지 않았습니다.
<dependencies>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-saaj</artifactId>
<version>1.4.1</version>
</dependency>
</dependencies>
가 여기에 서버를 실행하는 내 주요 루틴 :
여기 내 POM 의존성이다. 이것은 실제 서버 (스레드 없음)가 아니며, 그 목적은 문제를 보여주는 것입니다.
public class App {
public static void main(String[] args) {
try {
ServerSocket server = new ServerSocket(3400);
Socket socket = server.accept();
BasicHttpParams params = new BasicHttpParams();
DefaultHttpServerConnection conn = new DefaultHttpServerConnection();
conn.bind(socket, params);
HttpRequest request = conn.receiveRequestHeader();
if (request instanceof HttpEntityEnclosingRequest) {
conn.receiveRequestEntity((HttpEntityEnclosingRequest) request);
HttpEntity entity = ((HttpEntityEnclosingRequest) request).getEntity();
if (entity != null) {
MessageFactory soapMessageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
SOAPMessage soapMessage = soapMessageFactory.createMessage(
new MimeHeaders(), entity.getContent());
SOAPBody soapBody = soapMessage.getSOAPBody();
entity.consumeContent();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
SOAP 1.1 메시지
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
</soapenv:Body>
</soapenv:Envelope>
SOAP 1.2 메시지
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
</soapenv:Body>
</soapenv:Envelope>
내가
javax.xml.soap.SOAPException: org.apache.axiom.soap.SOAPProcessingException: Disallowed element found inside Envelope : {http://www.w3.org/2003/05/soap-envelope}Body
at org.apache.axis2.saaj.SOAPPartImpl.<init>(SOAPPartImpl.java:228)
at org.apache.axis2.saaj.SOAPPartImpl.<init>(SOAPPartImpl.java:246)
at org.apache.axis2.saaj.SOAPMessageImpl.<init>(SOAPMessageImpl.java:99)
at org.apache.axis2.saaj.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:131)
at lolissimo.xhiara.App.main(App.java:33)