There is a soap web service and a client. Uses the Apache CXF / Spring bundle.
Client:
public class MyWebServiceClientFactoryCXF {
public MyWebServiceAPI getMyWebServiceClient(String URI, String username, String password) throws MalformedURLException {
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(MyWebServiceAPI.class);
factory.setAddress(URI);
factory.setUsername(username);
factory.setPassword(password);
factory.setDataBinding(new AegisDatabinding());
return (MyWebServiceAPI) factory.create();
}
}
Spring context:
<bean id="myWebServiceClientFactory" class="mypakg.MyWebServiceClientFactoryCXF"/>
<bean id="myWebServiceClient" factory-bean="myWebServiceClientFactory" factory-method="getMyWebServiceClient">
<constructor-arg index="0" type="java.lang.String" value="${ws.url}"/>
<constructor-arg index="1" type="java.lang.String" value="${ws.login}"/>
<constructor-arg index="2" type="java.lang.String" value="${ws.pwd}"/>
</bean>
Uses:
public class App {
@Autowired
private MyWebServiceAPI wsClient;
public void someMethod() {
wsClient.getSomeInfo();
// Need to know http response code from `wsClient.getSomeInfo()`
}
}
How can I get the response code from the soap web service?
I can specify an interceptor for JaxWsProxyFactoryBean
, but how can I pass the value from interceptor to the App.someMethod()
method?
Consider the following piece of code:
See also:
ClientProxy javadoc
Client javadoc