我有一个JAX-RPCWeb服务,我正试图使用Spring使用它。这是我第一次使用Spring来使用web服务,所以现在我只是想让它作为测试与JAX-RPCWeb服务集成。
public interface WSClient {
public boolean userExists(int userid);
}
public interface WSService {
//this method matches the method signature of the Web Service
public com.company.data.User getUser(int userid);
}
<bean id="WSClient" class="com.company.ws.test.WSClientImpl">
<property name="service" ref="myWebService"></property>
</bean>
<bean id="myWebService" class="org.springframework.remoting.jaxrpc.JaxRpcPortProxyFactoryBean">
<property name="serviceInterface" value="com.company.ws.test.WSService"/>
<property name="endpointAddress" value="http://1.2.3.4/web-service/data"/>
<property name="namespaceUri" value="http://www.company.com/wdsl"/>
<property name="serviceName" value="CompanyWebService"/>
<property name="username" value="username"/>
<property name="password" value="password"/>
<property name="maintainSession" value="true"/>
</bean>
使用此配置的
JaxRpcPortProxyFactoryBean
,调用该服务将返回以下异常:
org.springframework.remoting.RemoteProxyFailureException:无效的JAX-RPC调用配置;嵌套异常是操作样式:“不支持rpc”
JaxRpcPortProxyFactoryBean
:
-
如果我设定
wsdlDocumentUrl
属性,我最终得到一个HTTP401错误,因为此web服务位于HTTP基本身份验证之后,而且Spring在获取WSDL时似乎不使用用户名/密码属性。
-
如果我指定
PortInterface
属性(值为
CompanyWebServiceInterfacePort
),然后我得到一个不同的异常,说明:
未能初始化JAX-RPC端口的服务[{
http://www.company.com/wdsl
}公司WebServiceInterfacePort];嵌套异常缺少WSDL数据,此操作不可用
换句话说,它告诉我WSDL丢失了——我无法设置它,因为Spring不会使用用户名/密码从服务器获取它!
我不确定这些是否有意义,但本质上我不确定的是:
-
对于JAX-RPC服务,是否需要设置PortInterface属性?这是我应该走的路吗?
-
同样地,春天需要我来设定温度吗
wsdlDocumentUrl
所有物如果是这样的话,我有没有办法告诉Spring是哪个WSDL,并绕过身份验证问题?