Hi,
Where the "blah" in your message come from?
It shouldn't be there according to your pojo and the wsdl generated
from your pojo.
I recall you said you didn't set "blah" in your pojo annotation, right?
Freeman
Apologies for the blah. It should not be there. I'll post everything
again here for the sake of clarity.
my wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="ExampleService"
targetNamespace="http://example.com" xmlns:tns="http://example.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://example.com"
attributeFormDefault="unqualified"
elementFormDefault="unqualified"
targetNamespace="http://example.com">
<xs:element name="sayHello" type="tns:sayHello" />
<xs:element name="sayHelloResponse"
type="tns:sayHelloResponse" />
<xs:complexType name="sayHello">
<xs:sequence>
<xs:element minOccurs="0" name="arg0"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="sayHelloResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return"
type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="sayHello">
<wsdl:part name="parameters" element="tns:sayHello"></wsdl:part>
</wsdl:message>
<wsdl:message name="sayHelloResponse">
<wsdl:part name="parameters" element="tns:sayHelloResponse">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="ExampleService">
<wsdl:operation name="sayHello">
<wsdl:input name="sayHello" message="tns:sayHello">
</wsdl:input>
<wsdl:output name="sayHelloResponse"
message="tns:sayHelloResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ExampleServiceSoapBinding"
type="tns:ExampleService">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="sayHello">
<soap:operation soapAction="" style="document" />
<wsdl:input name="sayHello">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="sayHelloResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ExampleService">
<wsdl:port name="ExampleServicePort"
binding="tns:ExampleServiceSoapBinding">
<soap:address
location="http://localhost:9090/ExampleServicePort" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
my BC-xbean
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance"
xmlns:myservice="http://example.com"
xsi:schemaLocation="http://servicemix.apache.org/cxfbc/1.0
http://servicemix.apache.org/schema/servicemix-cxfbc-3.2.3.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<cxfbc:consumer wsdl="classpath:service.wsdl"
targetService="myservice:ExampleService" />
</beans>
my SE xbean
<beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://servicemix.apache.org/cxfse/1.0
http://servicemix.apache.org/schema/servicemix-cxfse-3.2.3.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<cxfse:endpoint>
<cxfse:pojo>
<bean class="org.CXF.SE.ExampleService" />
</cxfse:pojo>
</cxfse:endpoint>
</beans>
my pojo:
package org.CXF.SE;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService(serviceName = "ExampleService", targetNamespace =
"http://example.com",portName="ExampleServicePort",name="ExampleService",wsdlLocation="http://localhost:9090/ExampleServicePort")
public class ExampleService {
@WebMethod
public String sayHello(String name) {
System.out.println("INVOKED!");
return "Hello "+name;
}
}
It builds and deploys fine, but when I send a soap message I get an
error.
soap request:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:exam="http://example.com">
<soapenv:Header/>
<soapenv:Body>
<exam:sayHello>
<!--Optional:-->
<arg0>12</arg0>
</exam:sayHello>
</soapenv:Body>
</soapenv:Envelope>
soap response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Unmarshalling Error: unexpected element
(uri:"http://example.com", local:"sayHello"). Expected elements are
(none)</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
I get no error in the servicemix.log file, but on the screen I see:
INFO: Could not determine bean name for instance of class
org.apache.cxf.transpo
rt.jbi.JBIDestination.
Feb 4, 2009 11:57:57 AM org.apache.cxf.endpoint.ServerImpl
initDestination
INFO: Setting the server's publish address to be
jbi://ID-192-168-2-79-11f3ff866
62-21-1
Feb 4, 2009 11:59:39 AM
org.apache.cxf.transport.jbi.JBITransportFactory setDeli
veryChannel
INFO: configuring DeliveryChannel:
org.apache.servicemix.common.EndpointDel
iverychan...@1f3bb61
Feb 4, 2009 11:59:39 AM org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected
element (uri:"
http://example.com", local:"sayHello"). Expected elements are (none)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.
java:593)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.
java:498)
at
org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:40)
at
org.apache.cxf.binding.jbi.interceptor.JBIWrapperInInterceptor.handle
Message(JBIWrapperInInterceptor.java:124)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept
orChain.java:221)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainIniti
ationObserver.java:77)
at
org.apache.cxf.transport.jbi.JBIDispatcherUtil.dispatch(JBIDispatcher
Util.java:156)
at
org.apache.servicemix.cxfse.CxfSeEndpoint.process(CxfSeEndpoint.java:
223)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLi
feCycle.java:538)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(Async
BaseLifeCycle.java:490)
at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLife
Cycle.java:46)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun
d(DeliveryChannelImpl.java:610)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo
w.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j
ava:167)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav
a:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:675)
at java.lang.Thread.run(Thread.java:595)
Caused by: javax.xml.bind.UnmarshalException
- with linked exception:
[javax.xml.bind.UnmarshalException: unexpected element
(uri:"http://example.com"
, local:"sayHello"). Expected elements are (none)]
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStrea
mException(UnmarshallerImpl.java:400)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(
UnmarshallerImpl.java:339)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(U
nmarshallerImpl.java:309)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.
java:578)
... 17 more
Caused by: javax.xml.bind.UnmarshalException: unexpected element
(uri:"http://ex
ample.com", local:"sayHello"). Expected elements are (none)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleE
vent(UnmarshallingContext.java:525)
at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.ja
va:199)
at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.ja
va:194)
at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChild
Element(Loader.java:71)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$Default
RootLoader.childElement(UnmarshallingContext.java:922)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startE
lement(UnmarshallingContext.java:366)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startEl
ement(UnmarshallingContext.java:347)
at
com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startEle
ment(InterningXmlVisitor.java:35)
at
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleSt
artElement(StAXStreamConnector.java:201)
at
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(S
tAXStreamConnector.java:135)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(
UnmarshallerImpl.java:337)
... 19 more
Caused by: javax.xml.bind.UnmarshalException: unexpected element
(uri:"http://ex
ample.com", local:"sayHello"). Expected elements are (none)
... 30 more
Feb 4, 2009 11:59:39 AM org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected
element (uri:"
http://example.com", local:"sayHello"). Expected elements are (none)
at
org.apache.servicemix.cxfbc.CxfBcConsumer$JbiPostInvokerInterceptor.h
andleMessage(CxfBcConsumer.java:554)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept
orChain.java:221)
at
org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorCha
in.java:198)
at
org.apache.servicemix.cxfbc.CxfBcConsumer.process(CxfBcConsumer.java:
202)
at
org.apache.servicemix.cxfbc.CxfBcConsumer$JbiInvokerInterceptor.handl
eMessage(CxfBcConsumer.java:530)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept
orChain.java:221)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainIniti
ationObserver.java:77)
at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceReque
st(JettyHTTPDestination.java:278)
at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(Je
ttyHTTPDestination.java:252)
at
org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTP
Handler.java:70)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:7
22)
at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHand
lerCollection.java:206)
at
org.mortbay.jetty.handler.HandlerList.handle(HandlerList.java:49)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:1
39)
at org.mortbay.jetty.Server.handle(Server.java:324)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:50
5)
at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnectio
n.java:842)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
at
org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at
org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.ja
va:395)
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool
.java:450)
Caused by: org.apache.cxf.interceptor.Fault: Unmarshalling Error:
unexpected ele
ment (uri:"http://example.com", local:"sayHello"). Expected elements
are (none)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.
java:593)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.
java:498)
at
org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:40)
at
org.apache.cxf.binding.jbi.interceptor.JBIWrapperInInterceptor.handle
Message(JBIWrapperInInterceptor.java:124)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept
orChain.java:221)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainIniti
ationObserver.java:77)
at
org.apache.cxf.transport.jbi.JBIDispatcherUtil.dispatch(JBIDispatcher
Util.java:156)
at
org.apache.servicemix.cxfse.CxfSeEndpoint.process(CxfSeEndpoint.java:
223)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLi
feCycle.java:538)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(Async
BaseLifeCycle.java:490)
at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLife
Cycle.java:46)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun
d(DeliveryChannelImpl.java:610)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo
w.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j
ava:167)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav
a:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:675)
at java.lang.Thread.run(Thread.java:595)
Caused by: javax.xml.bind.UnmarshalException
- with linked exception:
[javax.xml.bind.UnmarshalException: unexpected element
(uri:"http://example.com"
, local:"sayHello"). Expected elements are (none)]
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStrea
mException(UnmarshallerImpl.java:400)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(
UnmarshallerImpl.java:339)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(U
nmarshallerImpl.java:309)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.
java:578)
... 17 more
Caused by: javax.xml.bind.UnmarshalException: unexpected element
(uri:"http://ex
ample.com", local:"sayHello"). Expected elements are (none)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleE
vent(UnmarshallingContext.java:525)
at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.ja
va:199)
at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.ja
va:194)
at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChild
Element(Loader.java:71)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$Default
RootLoader.childElement(UnmarshallingContext.java:922)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startE
lement(UnmarshallingContext.java:366)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startEl
ement(UnmarshallingContext.java:347)
at
com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startEle
ment(InterningXmlVisitor.java:35)
at
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleSt
artElement(StAXStreamConnector.java:201)
at
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(S
tAXStreamConnector.java:135)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(
UnmarshallerImpl.java:337)
... 19 more
Caused by: javax.xml.bind.UnmarshalException: unexpected element
(uri:"http://ex
ample.com", local:"sayHello"). Expected elements are (none)
... 30 more
NOTE: entries in this post my differ slightly from earlier ones
because I've been trying various things to get rid of this error.
I am using servicemix 3.2.2 and soapui to send the messages.
Hope that clarifies.
Sylvester