Any exception you get from the log also?
Freeman
Sylvester wrote:
Hi,
Well I managed to figure this one out. In the @Webservice tag I was
using (maven generated this, but it doesn't work) name= "blah" I just
changed it to serviceName= "blah" and this error went away. However I
am still stuck. I can deploy the service etc. but when I send a
message I get:
<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/exampleService", local:"sayHello"). Expected
elements are (none)</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
and the class which gets invoked is:
@WebService(serviceName = "ExampleService", targetNamespace =
"http://example.com/exampleService")
public class ExampleService {
@WebMethod
public String sayHello(String name) {
return "Hello "+name;
}
}
I generated the wsdl using the java2ws tool that comes with cxf. The
wsdl is:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="ExampleService"
targetNamespace="http://example.com/exampleService"
xmlns:tns="http://example.com/exampleService"
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/exampleService"
attributeFormDefault="unqualified"
elementFormDefault="unqualified"
targetNamespace="http://example.com/exampleService">
<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="sayHelloResponse">
<wsdl:part name="parameters" element="tns:sayHelloResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="sayHello">
<wsdl:part name="parameters" element="tns:sayHello"></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>
Adding operation name or web param etc didn't help either.
Thanks,
Sylvester
Freeman Fang wrote:
Hi,
Would you append your wsdl also?
Freeman
Sylvester wrote:
Hi,
I've run into a problem with CXF today. I have a CXF BC
communicating with a CXF SE. No problem building and deploying. I
can see the wsdl in the browser as well. I am using smx 3.2.3 for this.
My cxf bc xbean is:
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/exampleService"
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>
CXF 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="com.ExampleService" />
</cxfse:pojo>
</cxfse:endpoint>
</beans>
and com.ExampleService is annotated as:
@WebService(name = "ExampleService", targetNamespace =
"http://example.com/exampleService")
public class ExampleService {
@WebMethod
public String getHighLevelBusinessFlow (String CIId, String
StateId){
...
}
I generated the wsdl using the .class file from the target folder of
my SE with the java2ws utility that came with my CXF 2.1.3.
The response to my soap request is like:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring><![CDATA[Could not find route for exchange: InOut[
id: ID:blah-blah-
status: Active
role: provider
service: {http://example.com/exampleService}ExampleService
operation: {http://example.com/exampleService}getHighLevelBusinessFlow
in: <?xml version="1.0" encoding="UTF-8"?><jbi:message
xmlns:jbi="http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper"
xmlns:msg="http://example.com/exampleService"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="getHighLevelBusinessFlow" type="msg:getHighLevelBusinessFlow"
version="1.0"><jbi:part><exam:getHighLevelBusinessFlow
xmlns:exam="http://example.com/exampleService">
<!--Optional:-->
<arg0 xmlns="">1</arg0>
<!--Optional:-->
<arg1 xmlns="">2</arg1>
</exam:getHighLevelBusinessFlow></jbi:part></jbi:message>
] for service: {http://example.com/exampleService}ExampleService and
interface: null]]></faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
I see:
] for service: {http://example.com/exampleService}ExampleService and
interface:
null
at
org.apache.servicemix.cxfbc.CxfBcConsumer$JbiInvokerInterceptor.handl
eMessage(CxfBcConsumer.java:608)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept
orChain.java:220)
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)
and the log has:
qtp0-0 | DefaultBroker |
rvicemix.jbi.nmr.DefaultBroker 344 | ServiceName
({http://example.com/exampleService}ExampleService) specified for
routing, but can't find it registered
I tried changing the targetNamespace and the name but that didn't
work either. What could be going wrong?
Thanks,
Sylvester