[JBossWS] - Raw Style webservices
by viniciuscarvalho
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
16Â years, 9Â months
[JBossWS] - Re: Sample application
by manny88
Thomas,
The "ant tests" is failing here as below. I'm on jboss-eap-4.2. I think it needs some package for junit.framework.Testcase. Where would this be?
C:\cygwind\home\Manny\jboss-eap-4.2\jbossws-native-2.0.1.GA>ant tests
Buildfile: build.xml
prepare:
tests-prepare:
[echo] -----------------------------------------------
[echo] jboss.home = /cygwind/home/manny/jboss-eap-4.2/jboss-as
[echo] excludesfile = C:\cygwind\home\Manny\jboss-eap-4.2\jbossws-native-2.
0.1.GA/tests/resources/test-excludes-jboss42.txt
[echo] java.home = C:\Java\jdk1.5.0_11\jre
[echo] jboss.bind = localhost
[echo] -----------------------------------------------
tests-classpath-jboss50:
tests-classpath-jboss42:
tests-classpath-jboss40:
tests-classpath:
tests-init:
tests-compile:
[javac] Compiling 2 source files to C:\cygwind\home\Manny\jboss-eap-4.2\jbos
sws-native-2.0.1.GA\output\classes
[javac] C:\cygwind\home\Manny\jboss-eap-4.2\jbossws-native-2.0.1.GA\tests\ja
va\org\jboss\test\ws\jaxws\smoke\tools\WSConsumerTestCase.java:45: cannot find s
ymbol
[javac] symbol : constructor TestCase()
[javac] location: class junit.framework.TestCase
[javac] public class WSConsumerTestCase extends TestCase
[javac] ^
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 error
BUILD FAILED
C:\cygwind\home\Manny\jboss-eap-4.2\jbossws-native-2.0.1.GA\build.xml:117: The f
ollowing error occurred while executing this line:
C:\cygwind\home\Manny\jboss-eap-4.2\jbossws-native-2.0.1.GA\tests\ant-import\bui
ld-testsuite.xml:274: Compile failed; see the compiler error output for details.
Total time: 3 seconds
C:\cygwind\home\Manny\jboss-eap-4.2\jbossws-native-2.0.1.GA>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4090359#4090359
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4090359
16Â years, 9Â months