cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Reise <janre...@yahoo.de>
Subject RPC/Literal vs. Encoded
Date Thu, 13 Dec 2007 12:06:01 GMT
Hi,


I am trying to implement a web service prototype using CFX. I have implemented a junit test
basically following the CFX how-to (test class code included below).


Now I am getting an unexpected error (stacktrace included below). From an earlier message
(www.mail-archive.com/cxf-user@incubator.apache.org/msg03561.html) I understand that CFX is
treating my service as RPC/Encoded but supports only RPC/Literal. I'd be grateful for any
pointers to how to make my service non-encoded.


Thanks in advance
Jan




Stack trace:


13.12.2007 11:13:43 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element (uri:"", local:"return").
Expected elements are (none)
	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:559)
	at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:465)
	at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:40)
	at org.apache.cxf.interceptor.DocLiteralInInterceptor.getPara(DocLiteralInInterceptor.java:234)
	at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:120)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:402)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1948)
	at org..apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1791)
	at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
	at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:157)
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:575)
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
	at org.apache..cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
	at org.apache.cxf..endpoint.ClientImpl.invoke(ClientImpl.java:205)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
	at $Proxy22.getStartpageToolItem(Unknown Source)
	at com.aperto.wj2008.ws.prototype.StartpageToolControllerTest.testGetStartpageToolItem(StartpageToolControllerTest.java:27)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:164)
	at junit.framework.TestCase.runBare(TestCase.java:130)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:120)
	at junit.framework.TestSuite.runTest(TestSuite.java:230)
	at junit.framework.TestSuite.run(TestSuite.java:225)
	at junit.textui.TestRunner.doRun(TestRunner.java:121)
	at com.intellij.rt.execution.junit.IdeaTestRunner.doRun(IdeaTestRunner.java:65)
	at junit.textui.TestRunner.doRun(TestRunner.java:114)
	at com.intellij.rt.execution.junit.IdeaTestRunner.startRunnerWithArgs(IdeaTestRunner.java:24)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:118)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)


---


java code:


---


public class StartpageToolControllerTest extends TestCase {


    private static final String ADDRESS = "http://localhost:9000/startpageTool";


    private StartpageTool _client;


    @Override
    protected void setUp() throws Exception {
        createServer();
        createClient();
    }


    public void testGetStartpageToolItem() {
        int id = 1;
        StartpageToolItem item = _client.getStartpageToolItem(id);
        assertNotNull("item must not be null", item);
        assertEquals("copy text must be 'I am text.'", "I am text.", item.getCopyText());


        id = 2;
        item = _client.getStartpageToolItem(id);
        assertNull("item must be null", item);
    }


    private void createServer() {
        Runnable server = new Runnable() {
            public void run() {
                StartpageToolController controller = new StartpageToolController();
                Endpoint.publish(ADDRESS, controller);
            }
        };
        server.run();
    }


    private void createClient() {
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.getInInterceptors().add(new LoggingInInterceptor());
        factory.getOutInterceptors().add(new LoggingOutInterceptor());
        factory.setServiceClass(StartpageTool.class);
        factory.setAddress(ADDRESS);
        _client = (StartpageTool) factory.create();
    }


--




      Jetzt Mails schnell in einem Vorschaufenster ├╝berfliegen. Dies und viel mehr bietet
das neue Yahoo! Mail - www.yahoo.de/mail


Mime
View raw message