-
1. Re: Webservice Authentifaction from jsf app
ctomc Feb 4, 2015 2:04 PM (in response to suikast42)Start by marking dependency as provided
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
-
2. Re: Webservice Authentifaction from jsf app
suikast42 Feb 4, 2015 4:08 PM (in response to ctomc)Hı tomaz. Thanks for quick reply. I have this dependency not in my war project. I separate it in another jar project. But this dependency is transitive of course. I'll try it tomorrow. Thanks again.
-
3. Re: Webservice Authentifaction from jsf app
suikast42 Feb 5, 2015 2:55 AM (in response to ctomc)Hi Tomaz,
that depependency is the plugin dependency and not project. The webserivce project has therefore no transitive dependencies.
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<executions>
<execution>
<id>Generate CustomerList</id>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<!-- The name of your generated source package -->
<packageName>foo.bar</packageName>
<wsdlFiles>
<wsdlFile>
${project.basedir}/src/main/resources/wsdl/MyWsdl.wsdl
</wsdlFile>
</wsdlFiles>
<encoding>${project.build.sourceEncoding}</encoding>
<verbose>true</verbose>
<wsdlLocation>
my url
</wsdlLocation>
<xdisableAuthenticator>false</xdisableAuthenticator>
<xauthFile>auth.txt</xauthFile>
</configuration>
</execution>
<executions>
<!-- if you want to use a specific version of JAX-WS, you can do so like this -->
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.2.10</version>
</dependency>
</dependencies>
</plugin>
-
4. Re: Webservice Authentifaction from jsf app
suikast42 Feb 9, 2015 6:50 AM (in response to suikast42)If I authentifacate the WS from Java SE then the Authenticator.getPasswordAuthentication is alled for every ws request. But in wildfly it called only once. Any ideas?
Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication( "user", "pass".toCharArray()); } }); URL url = new URL("http://server:7047/DynamicsNAV/WS/S%20I%20E%20M%20A%20G/Page/CustomerList"); QName qNamePort = new QName("urn:microsoft-dynamics-schemas/page/customerlist", "CustomerList_Port"); QName qnameService = new QName("urn:microsoft-dynamics-schemas/page/customerlist", "CustomerList_Service"); Service service = Service.create(url,qnameService); CustomerListPort port = service.getPort(qNamePort, CustomerListPort.class); //
// BindingProvider prov = (BindingProvider) port; // prov.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, // "user"); // prov.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, // "passwd"); CustomerListFilter customerListFilter = new CustomerListFilter(); customerListFilter.setField(CustomerListFields.NO); customerListFilter.setCriteria(">0"); List<CustomerListFilter> filters = new ArrayList<>(); filters.add(customerListFilter); CustomerListList customerListList = port.readMultiple(filters, null, 0); customerListList.getCustomerList().forEach(System.err::println);