I created a service implementation class from the attached wsdl and used that to build a web service:
<wsgen outputDirectory="${build.src}"
wsdl="../${admin.etc}/TestService.wsdl"
package="test.ws"
overwrite="true"/>
(On a side note, the wsdl attribute doesn't take into account the "basedir" attribute)
I initialized the service in the servlet init method:
public class MyServlet extends XFireServlet {
public void init() throws ServletException
{
super.init();
ObjectServiceFactory factory = new ObjectServiceFactory(xfire.getTransportManager());
URL url = null;
try {
url = new URL("file://\\WebService\\etc\\TestService.wsdl");
} catch (Exception e) {
e.printStackTrace();
}
QName qn = new QName("http://ws.test", "TestServiceService");
Properties props = new Properties();
props.put(ObjectServiceFactory.PORT_TYPE, new QName("http://ws.test", "TestService"));
Service service = factory.create(TestService.class, qn, url, props);
service.setProperty(ObjectInvoker.SERVICE_IMPL_CLASS, TestServiceServiceImpl.class);
getController().getServiceRegistry().register(service);
}
}
I then called the release method using the following soap message which is valid according to the wsdl:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns3="http://xml.test.com/ws/session" xmlns:tns1="http://TestService.ws.test.com">
<soap:Header>
<tns3:sessionID>0</tns3:sessionID>
</soap:Header>
<soap:Body>
<tns1:release>
</tns1:release>
</soap:Body>
</soap:Envelope>
I get the error below...
Looking at the fillInHolders method at the top of the stack trace below. It appears that it is counting the operation's soap body and header elements and then comparing that to just the the actual soap message's body only. There's also a part in the list for releaseRequest when there is no such part. I would think that it should be creating a holder for the header element sessionId since it is in both the input and output of the operation but the generated skeleton method has only an in parameter.
INFO: Fault occurred!
org.codehaus.xfire.fault.XFireFault: Not enough message parts were received for the operation.
at org.codehaus.xfire.service.binding.ServiceInvocationHandler.fillInHolders(ServiceInvocationHandler.java:226)
at org.codehaus.xfire.service.binding.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:71)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java:64)
at org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:38)
at org.codehaus.xfire.transport.http.XFireServletController.invoke(XFireServletController.java:301)
at org.codehaus.xfire.transport.http.XFireServletController.doService(XFireServletController.java:130)
at org.codehaus.xfire.transport.http.XFireServlet.doPost(XFireServlet.java:116)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)