"http://schemas.xmlsoap.org/wsdl/", the namespace on the "definitions" element, javacxf 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不能用JaxWsProxyFactoryBean方式获取service,只能通过 ImagService iss=new ImagService(); iss.getImageServiceImplPort().update(arg0, arg1, arg2, arg3);的方式获取这是 什么意思? 楼主确定地址对吗?你在浏览器里输入http://192.168.1.142:9000/TestServices/HelloWorldImplService?wsdl能看到XML格式的说明吗?程序太多了没法看,不过感觉地址有点问题,一般WebService的WSDL地址都是工程名后边会有个serviceshttp://192.168.1.142:9000/TestServices/services/HelloWorldImplService?wsdl类似于这种的 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.IHelloWorld2013-11-27 16:58:12 org.apache.cxf.interceptor.AbstractLoggingInterceptor log信息: Outbound Message---------------------------ID: 1Address: http://192.168.1.142:9000/TestServices/HelloWorldImplService?wsdlEncoding: UTF-8Content-Type: text/xmlHeaders: {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: 1Response-Code: 200Encoding: ISO-8859-1Content-Type: text/xmlHeaders: {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>这里的数据都出来了,,路径 应该是对的吧,不然应该是访问不到的错误 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(); }}自己看看解决 你把客户端那个setAdress的 “.wsdl” 去掉就行了,具体原因,在查。 请问java如何判断一个文件类型 求一正则 Hibernate session 缓存问题 远程关闭resin 关于Openfire插件开发的问题,紧急求助! Java文件路径的问题 struts1一个很奇葩的情况 同一个应用连多个数据库的问题 找工作的朋友请进。 B/S 关机 重起 编写 ajax与struts2 上传文件 Spring+mybaits集成问题
ImagService iss=new ImagService();
iss.getImageServiceImplPort().update(arg0, arg1, arg2, arg3);
的方式获取这是 什么意思?
你在浏览器里输入http://192.168.1.142:9000/TestServices/HelloWorldImplService?wsdl
能看到XML格式的说明吗?
程序太多了没法看,不过感觉地址有点问题,一般WebService的WSDL地址都是工程名后边会有个services
http://192.168.1.142:9000/TestServices/services/HelloWorldImplService?wsdl类似于这种的
信息: 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>这里的数据都出来了,,路径 应该是对的吧,不然应该是访问不到的错误
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();
}
}自己看看解决
你把客户端那个setAdress的 “.wsdl” 去掉就行了,具体原因,在查。