Hi,

HTTP 401 is Unauthorized error, which means the URL 
"http://bg4ws0099:7047/DynamicsNAV/WS/Services"; you try to access need 
auth(username/password), You need configure http conduit with username/password 
for JaxWsDynamicClientFactory to access that URL, take a look at related 
discussion[1] to know how
[1]http://cxf.547215.n5.nabble.com/Retrive-WSDL-using-basic-authentication-td5724416.html
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: @Freeman小屋

On 2013-3-13, at 下午8:51, Shafi_WS wrote:

> Hi, 
> 
> I am getting the error when generating Client. 
> 
> following  is the code, appreciate if anyone help quickly. 
> 
>       URL url = new URL("http://bg4ws0099:7047/DynamicsNAV/WS/Services";);
> 
>               JaxWsDynamicClientFactory clientFactory = 
> JaxWsDynamicClientFactory
>                               .newInstance();
> 
>               Client client = 
> clientFactory.createClient(url.toExternalForm());
> 
> 
> Exception: 
> 
> 
> Exception in thread "main"
> org.apache.cxf.service.factory.ServiceConstructionException: Failed to
> create service.
>       at
> org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:86)
>       at
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:292)
>       at
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:235)
>       at
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:228)
>       at
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:183)
>       at com.test.DemoWebService.main(DemoWebService.java:21)
> Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR:
> Problem parsing 'http://bg4ws0099:7047/DynamicsNAV/WS/Services'.:
> java.io.IOException: Server returned HTTP response code: 401 for URL:
> http://bg4ws0099:7047/DynamicsNAV/WS/Services
>       at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source)
>       at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
>       at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
>       at
> org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:262)
>       at
> org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:205)
>       at
> org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:84)
>       ... 5 more
> Caused by: java.io.IOException: Server returned HTTP response code: 401 for
> URL: http://bg4ws0099:7047/DynamicsNAV/WS/Services
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://cxf.547215.n5.nabble.com/Error-When-Generating-Client-tp5724501.html
> Sent from the cxf-dev mailing list archive at Nabble.com.

Reply via email to