解决方案 »

  1.   

    不能用JaxWsProxyFactoryBean方式获取service,只能通过
                    ImagService iss=new ImagService();
    iss.getImageServiceImplPort().update(arg0, arg1, arg2, arg3);
    的方式获取这是 什么意思?
      

  2.   

    楼主确定地址对吗?
    你在浏览器里输入http://192.168.1.142:9000/TestServices/HelloWorldImplService?wsdl
    能看到XML格式的说明吗?
    程序太多了没法看,不过感觉地址有点问题,一般WebService的WSDL地址都是工程名后边会有个services
    http://192.168.1.142:9000/TestServices/services/HelloWorldImplService?wsdl类似于这种的
      

  3.   

    2013-11-27 16:58:12 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
    信息: Creating Service {http://test.wj.com/}IHelloWorldService from class com.wj.test.IHelloWorld
    2013-11-27 16:58:12 org.apache.cxf.interceptor.AbstractLoggingInterceptor log
    信息: Outbound Message
    ---------------------------
    ID: 1
    Address: http://192.168.1.142:9000/TestServices/HelloWorldImplService?wsdl
    Encoding: UTF-8
    Content-Type: text/xml
    Headers: {SOAPAction=[""], Accept=[*/*]}
    Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns1:getHelloWorld xmlns:ns1="http://test.wj.com/" /></soap:Body></soap:Envelope>
    --------------------------------------
    2013-11-27 16:58:12 org.apache.cxf.interceptor.AbstractLoggingInterceptor log
    信息: Inbound Message
    ----------------------------
    ID: 1
    Response-Code: 200
    Encoding: ISO-8859-1
    Content-Type: text/xml
    Headers: {content-type=[text/xml], transfer-encoding=[chunked], Server=[Jetty(7.3.1.v20110307)]}
    Payload: <?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name="HelloWorldImplService" targetNamespace="http://test.wj.com/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://test.wj.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <wsdl:types>
    <xsd:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://test.wj.com/" xmlns:tns="http://test.wj.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:element name="sayHi" type="tns:sayHi" />
      <xsd:complexType name="sayHi">
        <xsd:sequence>这里的数据都出来了,,路径 应该是对的吧,不然应该是访问不到的错误
      

  4.   

    package com.wj.test;import org.apache.cxf.interceptor.LoggingInInterceptor;
    import org.apache.cxf.interceptor.LoggingOutInterceptor;
    import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;/**
     * 客户端
     * @author Administrator
     *
     */
    public class Client {   
      
    private Client(){};   
      
    public static void main(String[] args){   
    //创建WebService客户端代理工厂   
        JaxWsProxyFactoryBean jaxFactory = new JaxWsProxyFactoryBean();  
        jaxFactory.getInInterceptors().add(new LoggingInInterceptor());
        jaxFactory.getOutInterceptors().add(new LoggingOutInterceptor());
        //注册WebService接口   
        jaxFactory.setServiceClass(IHelloWorld.class);  
        //设置WebService地址   
        jaxFactory.setAddress("http://192.168.1.142:9000/TestServices/service/TestService");  
            
        IHelloWorld test = (IHelloWorld)jaxFactory.create();  
        boolean returnxml = test.sayHi("text");  
        System.out.println("结果:"+returnxml);  
    }   
       }   
    package com.wj.test;import javax.xml.ws.Endpoint;import org.apache.cxf.jaxws.JaxWsServerFactoryBean;/**
     * 服务端
     * 
     * @author Administrator
     * 
     */
    public class Server { private Server() {
    IHelloWorld helloWorld = new HelloWorldImpl();
    // 创建WebService服务工厂
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    // 注册WebService接口
    factory.setServiceClass(IHelloWorld.class);
    // 发布接口
    factory.setAddress("http://192.168.1.142:9000/TestServices/service/TestService?wsdl");
    factory.setServiceBean(helloWorld);
    // 创建WebService
    System.out.println("Server start...");
    factory.create();
    }; public static void main(String[] args) throws InterruptedException {
    // 启动服务端
    // System.out.println("web service start");
    // IHelloWorld implementor= new HelloWorldImpl();
    // http://192.168.1.142:9000/TestServices?wsdl
    // String address="http://192.168.1.142:9000/TestServices?wsdl";
    // Endpoint.publish(address, implementor);
    // System.out.println("web service started");

    new Server();
    }
    }自己看看解决
      

  5.   


    你把客户端那个setAdress的 “.wsdl” 去掉就行了,具体原因,在查。