WebService 访问问题

hycowboy
07-08-21 3 1564

最近采用 JBOSS-4.2.1 GA 和 JDK1.6 结合实现WebService应用,在客户端访问WebService时抛出下面的错误

javax.xml.ws.WebServiceException: java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage

经多方查证,获悉是 jboss 尚未完全支持jdk1.6 造成的,但没有提供解决办法. 由于我客户端是用swing 的,用了一些比较新的东西是jdk1.5 所没有的. 在此恳请各位大侠给出良方啊,在此先谢过啦!

banq
2007-08-22 09:19

客户端是JDK1.6 客户端与服务器端是使用XML字符串通讯,服务器端和客户端是没有关系的啊,服务器端可以用JDK1.5

打个比喻,你的浏览器所在客户端是windows操作系统,难道你访问所有网站的所有服务器都必须是windows的?

需要对webservice进一步了解。

hycowboy
2007-08-22 17:30

首先多谢! banq 百忙之中抽时间指点! 但情况不是这样的。由于客户端要引用 jboss 提供的jar中的 org.jboss.ws.core.soap.SOAPMessageImpl 类,而这个类是基于 jdk1.5 的。我的客户端源码是

/*
* WSClient.java
*
* Created on 2007年8月11日, 下午3:17
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package test;

import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPException;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.Service;
import testapp.TestAppSessionRemote;

/**
*
* @author hwz
*/

@WebServiceClient(name="TestAppSessionBeanService",targetNamespace="http://testapp/",wsdlLocation="http://127.0.0.1:8080/TestAppSessionBeanService/TestAppSessionBean?wsdl")
public class WSClient extends javax.xml.ws.Service {

private static String nameSpace = "http://127.0.0.1:8080/";

/** Creates a new instance of WSClient */
public WSClient() throws MalformedURLException {
super(new URL("http://127.0.0.1:8080/TestAppSessionBeanService/TestAppSessionBean?wsdl"), new QName("http://testapp/","TestAppSessionBeanService"));
}

public WSClient(URL url,QName qname) {
super(url,qname);
}

public static void main(String[] args) {
try {

WSClient wsclient = new WSClient();

testapp.TestAppSessionRemote testAppSessionRemote = (testapp.TestAppSessionRemote)wsclient.getPort(testapp.TestAppSessionRemote.class);

System.out.println(testAppSessionRemote.add(1,2));

} catch (Exception ex) {
ex.printStackTrace();
}
}
}

出错信息是

javax.xml.ws.WebServiceException: java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
at org.jboss.ws.core.jaxws.client.ClientImpl.handleRemoteException(ClientImpl.java:304)
at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:242)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:164)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
at $Proxy11.add(Unknown Source)
at test.WSClient.main(WSClient.java:46)
Caused by: java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
at javax.xml.soap.SOAPMessage.setProperty(SOAPMessage.java:424)
at org.jboss.ws.core.soap.SOAPMessageImpl.<init>(SOAPMessageImpl.java:67)
at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:155)
at org.jboss.ws.core.CommonSOAP11Binding.createMessage(CommonSOAP11Binding.java:58)
at org.jboss.ws.core.CommonSOAPBinding.bindRequestMessage(CommonSOAPBinding.java:153)
at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:274)
at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:230)
... 4 more

[该贴被hycowboy于2007年08月22日 17:32修改过]

yingxing007
2007-09-25 14:34

关注中.....................