[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
17 years, 3 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
17 years, 3 months
[JBossWS] - ws samples not working on jboss-eap-4.2
by manny88
I'm running the samples that come with the jboss-eap-doc.zip for server-config-guide. This is the basic Hello World sample run from ws directory etc.
I installed a fresh copy of jboss-eap-4.2. I build, deploy and run the sample as follows and get the following error msg. Looks like xerces is missing or something. Question is, should this sample work out of the box or do I need to install the jbossWS package on top of jboss-eap-4.2 before I can get WS working?
C:\cygwind\home\Manny\jboss-eap-4.2\doc\examples\server-config-guide>ant -Dchap=
ws -Dex=1 run-example
Buildfile: build.xml
....
....
....
run-example1:
[copy] Copying 1 file to C:\cygwind\home\Manny\jboss-eap-4.2\jboss-as\serve
r\default\deploy
[echo] Waiting for 15 seconds for deploy...
[java] Contacting webservice at http://localhost:8080/hello-servlet/Hello?w
sdl
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org/apach
e/xerces/xs/XSModel
[java] at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuil
der.buildMetaData(JAXRPCClientMetaDataBuilder.java:110)
[java] at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuil
der.buildMetaData(JAXRPCClientMetaDataBuilder.java:85)
[java] at org.jboss.ws.core.jaxrpc.client.ServiceImpl.(ServiceImp
l.java:111)
[java] at org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl.createServ
ice(ServiceFactoryImpl.java:157)
[java] at org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl.createServ
ice(ServiceFactoryImpl.java:128)
[java] at org.jboss.ws.client.HelloClient.main(HelloClient.java:28)
BUILD FAILED
C:\cygwind\home\Manny\jboss-eap-4.2\doc\examples\server-config-guide\build.xml:1
08: The following error occurred while executing this line:
C:\cygwind\home\Manny\jboss-eap-4.2\doc\examples\server-config-guide\build-ws.xm
l:121: Java returned: 1
Total time: 23 seconds
C:\cygwind\home\Manny\jboss-eap-4.2\doc\examples\server-config-guide>
Thanks
Manny
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4090322#4090322
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4090322
17 years, 3 months