Re: relative path to WSDL in CXF
Finally worked with: @WebServiceClient(name = "SalesService", targetNamespace = "urn:sales.test.au/schema/common", wsdlLocation = "classpath:SalesService.wsdl") public class SalesService extends Service { private final static URL SalesSERVICE_WSDL_LOCATION; private final static WebServiceException SalesSERVICE_EXCEPTION; private final static QName SalesSERVICE_QNAME = new QName("urn:sales.test.au/schema/common", "SalesService"); static { //URL url = SalesService.class.getClassLoader().getResource("SalesService.wsdl"); URL url = null; WebServiceException e = null; try { url = SalesService.class.getClassLoader().getResource("SalesService.wsdl"); //new URL("SalesService.wsdl"); } catch (Exception ex) { e = new WebServiceException(ex); } SalesSERVICE_WSDL_LOCATION = url; SalesSERVICE_EXCEPTION = e; } Note I had to use : getClassLoader().getResource() -- Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html
Re: relative path to WSDL in CXF
Hi, This is getting very frustrating trying to get the project to find relative paths to the WDSL. Environment: Java 7 Build Tool: gradle IDE: Intellij The WSDL file runs fine in the IDE with : @WebServiceClient(name = "SalesService", targetNamespace = "urn:Sales.test.au/schema/common", wsdlLocation = "file:SalesService.wsdl") public class SalesService extends Service { private final static URL SalesSERVICE_WSDL_LOCATION; private final static WebServiceException SalesSERVICE_EXCEPTION; private final static QName SalesSERVICE_QNAME = new QName("urn:Sales.test.au/schema/common", "SalesService"); static { URL url = null; WebServiceException e = null; try { url = new URL("file:SalesService.wsdl"); } catch (MalformedURLException ex) { e = new WebServiceException(ex); } But try that same code in a packaged jar and it results in a file not found (even though the file is present in the JAR). This post seemed to be relevant: https://stackoverflow.com/questions/4455195/how-to-avoid-the-need-to-specify-the-wsdl-location-in-a-cxf-or-jax-ws-generated They modified the URL in the WDSL - and found that the parameter needed to be passed as : @WebServiceClient(name = "SalesService", targetNamespace = "urn:sales.test.au/schema/common", wsdlLocation = "classpath:src/main/resources/SalesService.wsdl") ... URL url = null; WebServiceException e = null; try { url = new URL("SalesService.wsdl"); but that also fails for me (in particular on the line url = new URL("SalesService.wsdl");). I also wondered if this is relevant: https://stackoverflow.com/questions/20389255/reading-a-resource-file-from-within-jar Surely this is not a new issue? What is the solution? I have tried several "paths" now and am at a loss. Cheers AG -- Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html
Re: relative path to WSDL in CXF
Yes, for example: https://github.com/apache/cxf/blob/master/systests/ws-security/src/test/resources/alice.properties Colm. On Sat, Feb 3, 2018 at 6:50 AM, Al Grant wrote: > Can the crypto properties file use relative paths. Instead of: > > org.apache.ws.security.crypto.merlin.truststore.file=C:\\ > Users\\Owner\\IdeaProjects\\project1\\src\\main\\resources\\truststore.jks > > Something like: > > org.apache.ws.security.crypto.merlin.truststore.file=src\\ > main\\resources\\truststore.jks > > Thanks > > > > -- > Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html > -- Colm O hEigeartaigh Talend Community Coder http://coders.talend.com
Re: relative path to WSDL in CXF
Can the crypto properties file use relative paths. Instead of: org.apache.ws.security.crypto.merlin.truststore.file=C:\\Users\\Owner\\IdeaProjects\\project1\\src\\main\\resources\\truststore.jks Something like: org.apache.ws.security.crypto.merlin.truststore.file=src\\main\\resources\\truststore.jks Thanks -- Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html
Re: relative path to WSDL in CXF
This worked: @WebServiceClient(name = "SalesService", targetNamespace = "urn:sales.com.au/schema/common", wsdlLocation = "file:src/main/resources/SalesService.wsdl") public class SalesService extends Service { -- Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html
Re: relative path to WSDL in CXF
I tried : wsdlLocation = ("file:/Service.wsdl") wsdlLocation = ("file:Service.wsdl") wsdlLocation = ("/Service.wsdl") wsdlLocation = ("Service.wsdl") Always file not found? -- Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html
Re: relative path to WSDL in CXF
Better than in plain text!! On Fri, Feb 2, 2018 at 11:14 PM, Colm O hEigeartaigh wrote: > Well it can be, I think, but that's not buying you much security. > > Colm. > > On Fri, Feb 2, 2018 at 10:03 AM, Al Grant wrote: > > > So the crypto properties file cant be hidden in the jar file? > > > > > > > > -- > > Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html > > > > > > -- > Colm O hEigeartaigh > > Talend Community Coder > http://coders.talend.com > -- "Beat it punk!" - Clint Eastwood
Re: relative path to WSDL in CXF
Well it can be, I think, but that's not buying you much security. Colm. On Fri, Feb 2, 2018 at 10:03 AM, Al Grant wrote: > So the crypto properties file cant be hidden in the jar file? > > > > -- > Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html > -- Colm O hEigeartaigh Talend Community Coder http://coders.talend.com
Re: relative path to WSDL in CXF
So the crypto properties file cant be hidden in the jar file? -- Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html
Re: relative path to WSDL in CXF
You can encrypt the password in the Crypto properties file, but you still need to supply a password somehow to decrypt the encrypted password. See here: http://coheigea.blogspot.ie/2014/02/apache-wss4j-200-part-iv.html Colm. On Fri, Feb 2, 2018 at 5:00 AM, Al Grant wrote: > Similar to last post : > > > ((BindingProvider)iisrService).getRequestContext().put( > SecurityConstants.ENCRYPT_PROPERTIES, > "client_sign.properties"); > > ((BindingProvider)iisrService).getRequestContext().put( > SecurityConstants.SIGNATURE_PROPERTIES, > "client_sign.properties"); > > ((BindingProvider)iisrService).getRequestContext().put( > SecurityConstants.SIGNATURE_USERNAME, > "signingonly"); > > ((BindingProvider)iisrService).getRequestContext().put( > SecurityConstants.CALLBACK_HANDLER, > ClientCallbackHandler.class.getName()); > > Is there a way to avoid having the client_sign.properties file storing the > username and password for the certificate alias in clear text on the hard > disk? > > > > > > -- > Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html > -- Colm O hEigeartaigh Talend Community Coder http://coders.talend.com
Re: relative path to WSDL in CXF
Instead of wsdlLocation = "src/main/resources/SalesService.wsdl" try either: a) wsdlLocation = "SalesService.wsdl" b) wsdlLocation = "/SalesService.wsdl" Colm. On Fri, Feb 2, 2018 at 4:58 AM, Al Grant wrote: > Hello, > > is there a way to get a relative path to the WSDL file? This code works: > > @WebServiceClient(name = "SalesService", targetNamespace = > "urn:sales.com.au/schema/common", wsdlLocation = > "file:/H:/Desktop/cmd/importer/src/main/resources/SalesService.wsdl") > public class SalesService extends Service { > > This code doesn't: > > @WebServiceClient(name = "SalesService", targetNamespace = > "urn:sales.com.au/schema/common", wsdlLocation = > "src/main/resources/SalesService.wsdl") > public class SalesService extends Service { > > Thanks in advance > > Al > > > > > -- > Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html > -- Colm O hEigeartaigh Talend Community Coder http://coders.talend.com
Re: relative path to WSDL in CXF
Similar to last post : ((BindingProvider)iisrService).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, "client_sign.properties"); ((BindingProvider)iisrService).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES, "client_sign.properties"); ((BindingProvider)iisrService).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME, "signingonly"); ((BindingProvider)iisrService).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, ClientCallbackHandler.class.getName()); Is there a way to avoid having the client_sign.properties file storing the username and password for the certificate alias in clear text on the hard disk? -- Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html