[英]Problems with handling incoming SOAP message
I am trying to define a SOAP service that consumes OASIS WS-N notification messages.我正在尝试定义一个使用 OASIS WS-N 通知消息的 SOAP 服务。
I do 'WSDL-to-Java' approach but for some reason the incoming message is not being recognized.我采用“WSDL-to-Java”方法,但由于某种原因,无法识别传入消息。
Relevant fragments from WSDL:来自 WSDL 的相关片段:
<wsdl:definitions name="WSNBrokerNotification"
targetNamespace="http://docs.oasis-open.org/wsn/brw-2"
xmlns:tns="http://docs.oasis-open.org/wsn/brw-2"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsntw="http://docs.oasis-open.org/wsn/bw-2"
xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:wsrf-rw="http://docs.oasis-open.org/wsrf/rw-2"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsn-br="http://docs.oasis-open.org/wsn/br-2"
xmlns:wstop="http://docs.oasis-open.org/wsn/t-1"
xmlns:wsn-brw="http://docs.oasis-open.org/wsn/brw-2">
...
<wsdl:message name="Notify">
<wsdl:part name="Notify" element="wsnt:Notify"/>
</wsdl:message>
...
<!-- ========= NotificationConsumer PortType Definition =========== -->
<wsdl:portType name="NotificationConsumer">
<wsdl:operation name="Notify">
<wsdl:input message="tns:Notify"/>
</wsdl:operation>
</wsdl:portType>
...
<!-- ========= NotificationConsumer PortType Definition =========== -->
<wsdl:portType name="NotificationConsumer">
<wsdl:operation name="Notify">
<wsdl:input message="tns:Notify"/>
</wsdl:operation>
</wsdl:portType>
...
<wsdl:binding name="NotificationConsumer" type="tns:NotificationConsumer">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Notify">
<soap:operation soapAction="http://docs.oasis-open.org/wsn/bw-2/NotificationConsumer/Notify"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
...
<!-- =============== SERVICE ================= -->
<wsdl:service name="WSNBrokerNotification">
....
<wsdl:port name="NotificationConsumer" binding="tns:NotificationConsumer">
<soap:address location="http://localhost:19001"/>
</wsdl:port>
...
</wsdl:service>
</wsdl:definitions>
When the following SOAP message is arriving:当以下 SOAP 消息到达时:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://docs.oasis-open.org/wsn/bw-2/NotificationConsumer/Notify</a:Action>
<a:To s:mustUnderstand="1">http://jenkins.nu.majiic:50918/spsconsumerTest_f4bcbd26-8e96-45fe-b622-563d0e4a8edf</a:To>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Notify xmlns="http://docs.oasis-open.org/wsn/b-2">
<NotificationMessage>
<MyLittleMessage/>
</NotificationMessage>
</Notify>
</s:Body>
</s:Envelope>
my SOAP framework - Apache CXF - reports this:我的 SOAP 框架 - Apache CXF - 报告这个:
[qtp558404860-18] WARN org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for {http://consumer.wsn.foo.bar/}WSBrokerNotificationConsumerService has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Message part {http://docs.oasis-open.org/wsn/b-2}Notify was not recognized. (Does it exist in service WSDL?)
at org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor.validatePart(DocLiteralInInterceptor.java:252)
at org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:191)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:247)
at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:79)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1300)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:190)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1215)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.Server.handle(Server.java:500)
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
at java.lang.Thread.run(Thread.java:748)
[qtp558404860-18] INFO org.apache.cxf.services.WSBrokerNotificationConsumerService.WSBrokerNotificationConsumerPort.WSBrokerNotificationConsumer - Outbound Message
I am a bit confused, because I can clearly definition of <Notify>
elements with proper namespace, unless I am missing something?...我有点困惑,因为我可以用适当的命名空间清楚地定义
<Notify>
元素,除非我遗漏了什么?...
Any help will be greatly appreciated!任何帮助将不胜感激!
solved;解决了; the issue was due to the lack of
@WebService
annotation on the class that was implementing the web service.问题是由于在实现 web 服务的 class 上缺少
@WebService
注释。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.