[jboss-user] [JBossWS] - Raw Style webservices

viniciuscarvalho do-not-reply at jboss.com
Mon Oct 1 13:42:16 EDT 2007


Hello there! As I've been reporting here [and getting good support]. I'm developing a rawstyle ws using @WSProvide annotation.

After getting things working (jboss WS 2.0.1, downgrading to jdk 5 because SAAJ version). Now things are starting to work, but I'm getting an exception:

NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.

Searching around I found out that some users have this issue due problems with Xalan version. All I'm trying to do is add a Document to the body of the SOAPMessage. I've been using almost the same example as the one on JEE tutorials. I'm wondering what's going wrong:


  | @ServiceMode(value=Service.Mode.MESSAGE)
  | public class CommandProcessor implements Provider<SOAPMessage> {
  | 	Source returnMessage;
  | 	public SOAPMessage invoke(SOAPMessage messge) {
  | 		SOAPMessage returnMessage = null;	
  | 		try{
  | 			MessageFactory mf = MessageFactory.newInstance();
  | 			returnMessage = mf.createMessage();
  | 			returnMessage.getSOAPBody().addDocument(createResponseContent());
  | 			returnMessage.saveChanges();
  | 		}catch (Exception e) {
  | 			e.printStackTrace();
  | 		}
  | 	
  | 		return returnMessage;
  | 	}
  | 	
  | 	private Document createResponseContent() throws Exception{
  | 		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  | 		dbf.setNamespaceAware(true);
  | 		DocumentBuilder db = dbf.newDocumentBuilder();
  | 		Document doc = db.newDocument();
  | 		Element responseCommand = doc.createElementNS("http://www.abc.com/sys/schemas", "sys:responseCommand");
  | 		
  | 		Element id = doc.createElement("id");
  | 		id.appendChild(doc.createTextNode("1"));
  | 		Element message = doc.createElement("message");
  | 		message.appendChild(doc.createTextNode("comando recebido"));
  | 		responseCommand.appendChild(id);
  | 		responseCommand.appendChild(message);
  | 		doc.appendChild(responseCommand);
  | 		return doc;
  | 	}
  | 

I was thinking that the problem should be related to my schema declaration, but Sun's example uses an document that does not even declare an schema its a simple xml with no schema. 

Any ideas?

Regards

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4090361#4090361

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4090361



More information about the jboss-user mailing list