Hi,
I am trying to write a simple web service. I am using
JBoss 4.2.2 and have implemented a simple stateless session bean that acts as my web service. The method call is getAllMetaData (sorry if its confusing but my application involves meta data which should have nothing to do with the error I am seeing) and it returns a long
String. I have seen others on this message board (under JBoss and Web Service topic) have this error, but no one answered the topic. Plus, most examples have
servlet endpoints, but mine is an
EJB endpoint, if that matters much.
Before my client tries to use the web service, I print out the
SOAP message it is sending using the writeTo() method. Below is what it is printing, I assume that this is where the problem is, that my outgoing SOAP request message is missing something:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body><m:getAllMetaData xmlns:m="http://alex.com"/></SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The client code snippet that generates this message is this:
SOAPConnectionFactory soapConnectionFactory =
SOAPConnectionFactory.newInstance();
SOAPConnection connection = soapConnectionFactory.createConnection();
SOAPFactory soapFactory = SOAPFactory.newInstance();
MessageFactory factory = MessageFactory.newInstance();
SOAPMessage message = factory.createMessage();
SOAPHeader header = message.getSOAPHeader();
SOAPBody body = message.getSOAPBody();
header.detachNode();
Name bodyName = soapFactory.createName( "getAllMetaData",
"m",
"http://alex.com" );
SOAPBodyElement bodyElement = body.addBodyElement( bodyName );
message.writeTo( System.out );
URL endpoint = new URL( "http://localhost:8080/AlexTry-alexws-ejb/WebServiceBean?wsdl" );
SOAPMessage response = connection.call( message, endpoint );
connection.close();
}
catch ( Exception ex )
{
ex.printStackTrace();
}
And here is my WSDL file, which I generated using the wscompile tool from J2EE:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="AlexWebService" targetNamespace="http://alex.com/" xmlns:tns="http://alex.com/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types/>
<message name="WebServiceEndpoint_getAllMetaData"/>
<message name="WebServiceEndpoint_getAllMetaDataResponse">
<part name="result" type="xsd:string"/></message>
<portType name="WebServiceEndpoint">
<operation name="getAllMetaData">
<input message="tns:WebServiceEndpoint_getAllMetaData"/>
<output message="tns:WebServiceEndpoint_getAllMetaDataResponse"/></operation></portType>
<binding name="WebServiceEndpointBinding" type="tns:WebServiceEndpoint">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
<operation name="getAllMetaData">
<soap
peration soapAction=""/>
<input>
<soap:body use="literal" namespace="http://alex.com/"/></input>
<output>
<soap:body use="literal" namespace="http://alex.com/"/></output></operation></binding>
<service name="AlexWebService">
<port name="WebServiceEndpointPort" binding="tns:WebServiceEndpointBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/></port></service></definitions>
And here is the full exception I am getting:
11:05:48,203 ERROR [SOAPFaultHelperJAXRPC] SOAP request exception
javax.xml.rpc.soap.SOAPFaultException: Endpoint {http://alex.com/}WebServiceEndpointPort does not contain operation meta data for: {http://alex.com}getAllMetaData
at org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC.exceptionToFaultMessage(SOAPFaultHelperJAXRPC.java:189)
at org.jboss.ws.core.jaxrpc.SOAP11BindingJAXRPC.createFaultMessageFromException(SOAP11BindingJAXRPC.java:63)
at org.jboss.ws.core.CommonSOAPBinding.bindFaultMessage(CommonSOAPBinding.java:645)
at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:277)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:408)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:272)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:189)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:122)
at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:595)
Any help really appreciated!
Thanks,
Alex
[ June 16, 2008: Message edited by: Alex Mbatra ]