I am getting the following error when I get to the line that invokes a REALLY BASIC web service I have running on Tomcat/Axis.
Element or attribute do not match QName production: QName::=(NCName':')?NCName
Have I got something wrong with QName?- I can’t even find any useful information about it.
My client code is below:
import javax.xml.namespace.QName; import org.apache.axis.client.Call; import org.apache.axis.client.Service; public class TestClient { public static void main(String [] args) { try{ String endpoint = 'http://localhost:8080/TestWebService/services/DoesMagic'; Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress( new java.net.URL(endpoint) ); call.setOperationName( new QName('http://testPackage.fc.com/, doBasicStuff') ); String ret = (String) call.invoke( new Object[] {'some kind of message'} ); System.out.println(ret); }catch(Exception e){ System.err.println(e.toString()); } } }
My web serivce code is really basic – just a simple class that returns your input string with a bit of concat text:
public String doBasicStuff(String message) { return 'This is your message: ' + message; }
As the exception says, you call the QName constructor incorrectly:
is incorrect. I think you have to pass two strings, one containing the namespace, one the localname. The documentation will typically contain a description on how to use that class.