-2

if the wsdl is protected by http basic authentication, how to generate client code by cxf wsdl2java, I have read the documentation of wsdl2java, but I didn't find any useful option.

boner
  • 11
  • 1
  • the wsimport tool has a extended option named 'Xauthfile'. is there any way of wsdl2java ? – boner Oct 31 '16 at 00:50

2 Answers2

0

Basic auth has no impact on generated code. You just need to configure CXF for basic auth on both sides.

Isukthar
  • 185
  • 8
0

You can try the following code:

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(webServiceClass);
factory.setWsdlLocation(wsdlLocation);
factory.setUsername(serviceUserName);
factory.setPassword(servicePassword);

T webServiceClassImpl = (T) factory.create();
Floern
  • 33,559
  • 24
  • 104
  • 119
theMind
  • 194
  • 1
  • 10