I have a few problems with the cxf + WSClient in soap.
I am writing a small tool in grails that must make SOAP calls to an existing service.
WSClient (groovyws-0.5.3-20100521.062225-1.jar) seemed like the perfect solution to my problem.
However when i tried to implement a call to one of the actions i get two problems.
Problem #1 NullPointerException when making a call to some of the actions.
I have tracked down the code that is throwing the exception inside of
AbstractCXFWSClient.invokeMethod(String methodName, Object args)
if (!operationToBeInvoked.isUnwrapped()){
//Operation uses document literal wrapped style.
inputMessageInfo = operationToBeInvoked.getWrappedOperation().getInput();
} else {
inputMessageInfo = operationToBeInvoked.getUnwrappedOperation().getInput();
}
specifically operationToBeInvoked.getWrappedOperation() I have isolated the code in a unit test and find that both operationToBeInvoked.getWrappedOperation() and operationToBeInvoked.getWrappedOperation() result in null objects. I have tried to figure out what is causing it however i think i have gotten to the end of my knowledge.
Problem #2 WSClient.create(String classname) is eating a ClassNotFoundException (and then throwing a NullPointerException)
Basicly when I make the following call
def event = client.create("com.mypackage.MyBean");
Same bean that i can see by browsing the services from the browser.
<xs:complexType name="myBean">
<xs:sequence>
<xs:element minOccurs="0" name="id" type="xs:long"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="facets" nillable="true" type="tns:beanBean"/>
<xs:element minOccurs="0" name="sortId" type="xs:string"/>
<xs:element minOccurs="0" name="itemId" type="xs:string"/>
<xs:element minOccurs="0" name="preview" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
I get a NPE. When i drill down to figure out why i get an NPE, I find that its because the classloader on the WSClient can’t find “com.mypackage.MyBean” eats the ClassNotFoundException and then inevitably throws an NPE.
Edit: Should I be using a different client the WSClient/cxf ? I really wanted to avoid having to roll my own…..
Basicly I didn’t find the answer. I basicly was forced to uninstall the two plugins and cxf and not using the groovy WSClient.
What i did was install the ws-client plugin for grails and that worked.
http://www.grails.org/plugin/ws-client