Create SOAP client from WSDL URL that is secured with headers

740 Views Asked by At

I want to generate SOAP client from WSDL URL. The WSDL is secured with some header.

The required header is like:

headerKey=auth
headerValue=authValue

I have already tried wsimport like:

wsimport -s C:/generated -keep -p com.service.generated "https://myServiceURL?wsdl"

and I get the error:

[ERROR] Server returned HTTP response code: 401 for URL: https://blabla?
wsdl,  "https://blabla?wsdl" needs authorization, please provide 
authorization file with read access at C:\ or use -Xauthfile to give the 
authorization file and on each line provide authorization information 
using this format : http[s]://user:password@host:port//<url-path>

I have also tried to use -Xauthfile in my command but I guess this used to provide username and password for URLs that are protected with username and password as far as I looked at the docs? https://docs.oracle.com/javase/8/docs/technotes/tools/unix/wsimport.html

My question is, how can I generate client from an WSDL url that is secured with a header with wsimport or any other tool?

0

There are 0 best solutions below