Barry,

Could you retry this with a more recent release of ServiceMix? I see there were some similar problems being fixed after 3.1-incubating (e.g. https://issues.apache.org/activemq/browse/SM-960). If you are doing new web service development, newer versions of ServiceMix also come with the new CXF component for building those.

Regards,

Gert


baryzhongzsd wrote:
Hello, Everybody! I have a very urgent question to ask.
I use apache-servicemix-3.1-incubating to deploy a "Hello" web service.
Generally speaking, i just want to imitate the example of following webPage:
http://www.topoint.com.cn/html/soa/2008/02/204385.html
it's a static deployment use servicemix.xml as follow: <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xbean.org/schemas/spring/1.0";
 xmlns:spring="http://xbean.org/schemas/spring/1.0";
 xmlns:sm="http://servicemix.apache.org/config/1.0";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0";
 xmlns:http="http://servicemix.apache.org/http/1.0";
 xmlns:hello="hello"
 xsi:schemaLocation="http://xbean.org/schemas/spring/1.0
../../conf/spring-beans.xsd
                     http://servicemix.org/config/1.0
../../conf/servicemix.xsd"
xmlns:foo="http://servicemix.org/demo";> <!-- the JBI container -->
  <!-- <sm:container spring:id="jbi"
    useMBeanServer="true"
    createMBeanServer="true"
    dumpStats="true"
statsInterval="10"> --> <!-- the above is 3.0 , the following two is 3.1 servicemix-http-3.1-incubating-installer.zip
  servicemix-jsr181-3.1-incubating-installer.zip
servicemix-shared-3.1-incubating-installer.zip echotest.jar, echo.jar need to unzip the above to lib/optional endpoint="echoHttpPort" must onsistant with --> <bean id="jndi" class="org.apache.xbean.spring.jndi.SpringInitialContextFactory" factory-method="makeInitialContext" singleton="true" /> <sm:container id="jbi" useMBeanServer="true" createMBeanServer="true"> <sm:activationSpecs> <!-- Create a http server binding on port 8912 and have it forward to the foo:stockQuote --> <sm:activationSpec>
  <sm:component>
    <http:component>
      <http:endpoints>
        <http:endpoint service="hello:hello"
                       endpoint="helloHttpPort"
                       role="consumer"
                       locationURI="http://localhost:8192/hello/";
defaultMep="http://www.w3.org/2004/08/wsdl/in-out"; soap="true"
                       soapAction="getHello" />
      </http:endpoints>
    </http:component>
  </sm:component>
</sm:activationSpec> <!-- wsdlResource is must, otherwise, will have the urlconnect error -->
 <!-- main.wsdl not accessible after deploying WSDL to servicemix-http
component --><sm:activationSpec>
 <sm:component>
      <jsr181:component>
       <jsr181:endpoints>
        <jsr181:endpoint pojoClass="server.HelloService"
                         wsdlResource="classpath:hello_xfire.wsdl"
                         style="document"
serviceInterface="server.Hello" annotations="none" />
       </jsr181:endpoints>
      </jsr181:component>
  </sm:component>
</sm:activationSpec> </sm:activationSpecs>
  </sm:container>
</beans>


The WSDL is in attachment which name is hello_xfire.wsdl. It is encapulated
with the hello implemented class and hello interface which is in
helloServer.jar.

The client code is as follow:

import hello.helloClient;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;

 public static void main(String[] args) throws Exception {

        URLConnection connection = new
URL("http://localhost:8192/hello/";).openConnection();
        connection.setDoOutput(true);
        OutputStream os = connection.getOutputStream();

        // Post the request file.
        FileInputStream fis = new FileInputStream("request.xml");
        int c;
        while ((c = fis.read()) >= 0) {
         System.out.println(c);
            os.write(c);
        }
        os.close();
        fis.close();
        System.out.println("request send finished!");

        // Read the response.
        BufferedReader in = new BufferedReader(new
InputStreamReader(connection.getInputStream()));
        System.out.println("BufferedReader created!");
        String inputLine;
        while ((inputLine = in.readLine()) != null) {
            System.out.println(inputLine);
        }
        System.out.println("reading success!");
        in.close();
    }
}

the reques.xml is as follow:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"; >
  <env:Body>
      <getHello xmlns="hello">
         <in0 xmlns="hello">Aihu</in0>
      </getHello>
  </env:Body>
</env:Envelope>

When i start the servicemix and i can test the webservice is right by
explorer:"http://localhost:8192/hello/main.wsdl"; but when i run the client
in eclipse, it shows me with such exception in server:
Nested exception is org.codehaus.xfire.fault.XFireFault: Could not read XML
stream.. Nested exception is com.ctc.wstx.exc.WstxParsingException:Expected a text
token, got START_ELEMENT.
at[row,col<unknown-source>]:[2,28]
I have try all my way to kill the bug, including to check these exception on
web or on forum,still have no good answer.
I hope that you can help me with some clues or advise, thanks in advance! Barry http://www.nabble.com/file/p17876511/hello_xfire.wsdl hello_xfire.wsdl http://www.nabble.com/file/p17876511/helloServer.jar helloServer.jar

Reply via email to