Question about using CXF stand-alone
All: I have a very, very simple web service that I am developing in Eclipse. In Eclipse, it runs beautifully. The server (Jetty) starts right up and runs as long as I tell it to. Unfortunately, when I try exactly the same service in a Windows 7 command window, I get this error: INFO: Creating Service {http://testws.peopletrack.datasourceinc.com/}TestWebServ ice from class com.datasourceinc.peopletrack.testws.TestWebService Aug 11, 2014 9:52:16 AM org.apache.cxf.transport.http.HTTPTransportFactory getDe stination SEVERE: Cannot find any registered HttpDestinationFactory from the Bus. Exception in thread main javax.xml.ws.WebServiceException: org.apache.cxf.serv ice.factory.ServiceConstructionException at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:371) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:251) at org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(Provid erImpl.java:155) at javax.xml.ws.Endpoint.publish(Unknown Source) at com.datasourceinc.peopletrack.testws.Main.init(Main.java:15) at com.datasourceinc.peopletrack.testws.Main.main(Main.java:41) Caused by: org.apache.cxf.service.factory.ServiceConstructionException at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.ja va:188) at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactory Bean.java:211) at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:456) at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:334) ... 5 more Caused by: java.io.IOException: Cannot find any registered HttpDestinationFactor y from the Bus. at org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(HTT PTransportFactory.java:296) at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapT ransportFactory.java:142) at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:83 ) at org.apache.cxf.endpoint.ServerImpl.init(ServerImpl.java:62) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.ja va:170) ... 8 more I have printed out the classloader URLs that are used in running the service in Eclipse and replicated them in my JAR file manifest exactly (and , of course, put the JAR files in the appropriate directory). I have added (and also removed) the JAR file itself from the manifest Class-List (though I don't believe this is necessary). I always get the same result, whatever I try. Can anyone help me figure out what is going on and why? Thanks! David Sills
RE: Question about using CXF stand-alone
Never mind. It turned out the maven repository sent me the javadoc for Jetty, not the classes. Once fixed, everything worked fine. Thanks! David Sills -Original Message- From: David Sills [mailto:dsi...@datasourceinc.com] Sent: Monday, August 11, 2014 10:00 AM To: users@cxf.apache.org Subject: Question about using CXF stand-alone All: I have a very, very simple web service that I am developing in Eclipse. In Eclipse, it runs beautifully. The server (Jetty) starts right up and runs as long as I tell it to. Unfortunately, when I try exactly the same service in a Windows 7 command window, I get this error: INFO: Creating Service {http://testws.peopletrack.datasourceinc.com/}TestWebServ ice from class com.datasourceinc.peopletrack.testws.TestWebService Aug 11, 2014 9:52:16 AM org.apache.cxf.transport.http.HTTPTransportFactory getDe stination SEVERE: Cannot find any registered HttpDestinationFactory from the Bus. Exception in thread main javax.xml.ws.WebServiceException: org.apache.cxf.serv ice.factory.ServiceConstructionException at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:371) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:251) at org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(Provid erImpl.java:155) at javax.xml.ws.Endpoint.publish(Unknown Source) at com.datasourceinc.peopletrack.testws.Main.init(Main.java:15) at com.datasourceinc.peopletrack.testws.Main.main(Main.java:41) Caused by: org.apache.cxf.service.factory.ServiceConstructionException at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.ja va:188) at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactory Bean.java:211) at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:456) at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:334) ... 5 more Caused by: java.io.IOException: Cannot find any registered HttpDestinationFactor y from the Bus. at org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(HTT PTransportFactory.java:296) at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapT ransportFactory.java:142) at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:83 ) at org.apache.cxf.endpoint.ServerImpl.init(ServerImpl.java:62) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.ja va:170) ... 8 more I have printed out the classloader URLs that are used in running the service in Eclipse and replicated them in my JAR file manifest exactly (and , of course, put the JAR files in the appropriate directory). I have added (and also removed) the JAR file itself from the manifest Class-List (though I don't believe this is necessary). I always get the same result, whatever I try. Can anyone help me figure out what is going on and why? Thanks! David Sills
FW: HTTPS client configuration using JaxWsProxyFactoryBean
Sorry, this got replied to the wrong address. -Original Message- From: David Sills Sent: Wednesday, October 19, 2011 7:06 AM To: 'Daniel Kulp' Subject: RE: HTTPS client configuration using JaxWsProxyFactoryBean Daniel: Many thanks for the suggestions. I have tried using factory.setEndpointName(new QName(http://of306.ws.abis.datasourceinc.com/;, Of306ServerPort)); Given the configuration below, does that seem right? It did not work correctly. I also tried several variations on your idea of calling the setAddress method and naming conventions, none of which have yet worked. Further ideas? I have probably missed something David -Original Message- From: Daniel Kulp [mailto:dk...@apache.org] Sent: Tuesday, October 18, 2011 1:35 PM To: users@cxf.apache.org Cc: David Sills Subject: Re: HTTPS client configuration using JaxWsProxyFactoryBean I think if you add a factory.setEndpointName() call to the appropriate qname used in the http:conduit, it should work. Alternatively, if you setup the address on the factory prior to calling create (factory.setAddress(...)), you can configure the http conduit via something like: http:conduit name=https://blah.com:9000/.*; (note the .* at the end to match all tails) Dan On Tuesday, October 18, 2011 11:18:24 AM David Sills wrote: All: Is it possible to configure the JaxWsProxyFactoryBean to use HTTPS? It looks as though it should be, but I can't quite figure out how to connect up the bits. I have added this to the Spring configuration file: http:conduit name={http://of306.ws.abis.datasourceinc.com/}Of306ServerPort.http-cond uit http:tlsClientParameters secureSocketProtocol=SSL sec:keyManagers sec:keyStore type=JKS password=0ftobp8ssw0rd file=C:/Java/jks/of306-truststore.jks/ /sec:keyManagers sec:trustManagers sec:keyStore type=JKS password=0ftobp8ssw0rd file=C:/Java/jks/of306-truststore.jks/ /sec:trustManagers sec:cipherSuitesFilter !-- these filters ensure that a ciphersuite with export-suitable or null encryption is used, but exclude anonymous Diffie-Hellman key change as this is vulnerable to man-in-the-middle attacks -- sec:include.*_EXPORT_.*/sec:include sec:include.*_EXPORT1024_.*/sec:include sec:include.*_WITH_DES_.*/sec:include sec:include.*_WITH_NULL_.*/sec:include sec:exclude.*_DH_anon_.*/sec:exclude /sec:cipherSuitesFilter /http:tlsClientParameters http:client AutoRedirect=true Connection=Keep-Alive/ /http:conduit The name is (appropriately, I think) the namespace + port name + .http-conduit. (I have also tried using sec:certStore file=C:/Java/jks/of306-truststore.jks/ under sec:trustManagers) However, when I try this: JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); LoggingInInterceptor inInterceptor = new LoggingInInterceptor(); inInterceptor.setLimit(-1); factory.getInInterceptors().add(inInterceptor); LoggingOutInterceptor outInterceptor = new LoggingOutInterceptor(); outInterceptor.setLimit(-1); factory.getOutInterceptors().add(outInterceptor); factory.setServiceClass(Of306Service.class); factory.setAddress(applicationConfig.getMessage(of306.service.url)); ** ConduitSelector conduitSelector = factory.getConduitSelector(); Of306Service client = (Of306Service) factory.create(); PinValidationDataImpl data = new PinValidationDataImpl(); Of306 of306 = (Of306) command; data.setPin(of306.getPin()); data.setSsn(of306.getSsn()); data.setDateOfBirth(formatter.format(of306.getDateOfBirth().getDate())); ValidationOutcome outcome = client.validatePin(data); The ConduitSelector is null (which didn't surprise me too much, though it certainly looks in the HTTPS setup that it should just work, as so much in Spring does). Do I need to set the ConduitSelector? Is it even possible to do so? Which type should be used? This is what the logging looks like - it looks as though it's possible it is getting the idea, in fact (and yes, the appropriate exported self-signed certificate is imported into the trust-store, before anyone asks): 2011-10-18 10:53:36,398 DEBUG [org.apache.cxf.phase.PhaseInterceptorChain] - Invoking handleMessage on interceptor org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingI nterceptor@1a85a3b0 2011-10-18 10:53:36,400 INFO [org.apache.cxf.interceptor.LoggingOutInterceptor] - Outbound Message
Question about XML payload
All: I have a web service that must send a single XML string as its only payload. Is there anything special about this case? Or can I treat it just as any other string? Thanks! David Sills
HTTPS client configuration using JaxWsProxyFactoryBean
All: Is it possible to configure the JaxWsProxyFactoryBean to use HTTPS? It looks as though it should be, but I can't quite figure out how to connect up the bits. I have added this to the Spring configuration file: http:conduit name={http://of306.ws.abis.datasourceinc.com/}Of306ServerPort.http-cond uit http:tlsClientParameters secureSocketProtocol=SSL sec:keyManagers sec:keyStore type=JKS password=0ftobp8ssw0rd file=C:/Java/jks/of306-truststore.jks/ /sec:keyManagers sec:trustManagers sec:keyStore type=JKS password=0ftobp8ssw0rd file=C:/Java/jks/of306-truststore.jks/ /sec:trustManagers sec:cipherSuitesFilter !-- these filters ensure that a ciphersuite with export-suitable or null encryption is used, but exclude anonymous Diffie-Hellman key change as this is vulnerable to man-in-the-middle attacks -- sec:include.*_EXPORT_.*/sec:include sec:include.*_EXPORT1024_.*/sec:include sec:include.*_WITH_DES_.*/sec:include sec:include.*_WITH_NULL_.*/sec:include sec:exclude.*_DH_anon_.*/sec:exclude /sec:cipherSuitesFilter /http:tlsClientParameters http:client AutoRedirect=true Connection=Keep-Alive/ /http:conduit The name is (appropriately, I think) the namespace + port name + .http-conduit. (I have also tried using sec:certStore file=C:/Java/jks/of306-truststore.jks/ under sec:trustManagers) However, when I try this: JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); LoggingInInterceptor inInterceptor = new LoggingInInterceptor(); inInterceptor.setLimit(-1); factory.getInInterceptors().add(inInterceptor); LoggingOutInterceptor outInterceptor = new LoggingOutInterceptor(); outInterceptor.setLimit(-1); factory.getOutInterceptors().add(outInterceptor); factory.setServiceClass(Of306Service.class); factory.setAddress(applicationConfig.getMessage(of306.service.url)); ** ConduitSelector conduitSelector = factory.getConduitSelector(); Of306Service client = (Of306Service) factory.create(); PinValidationDataImpl data = new PinValidationDataImpl(); Of306 of306 = (Of306) command; data.setPin(of306.getPin()); data.setSsn(of306.getSsn()); data.setDateOfBirth(formatter.format(of306.getDateOfBirth().getDate())); ValidationOutcome outcome = client.validatePin(data); The ConduitSelector is null (which didn't surprise me too much, though it certainly looks in the HTTPS setup that it should just work, as so much in Spring does). Do I need to set the ConduitSelector? Is it even possible to do so? Which type should be used? This is what the logging looks like - it looks as though it's possible it is getting the idea, in fact (and yes, the appropriate exported self-signed certificate is imported into the trust-store, before anyone asks): 2011-10-18 10:53:36,398 DEBUG [org.apache.cxf.phase.PhaseInterceptorChain] - Invoking handleMessage on interceptor org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingI nterceptor@1a85a3b0 2011-10-18 10:53:36,400 INFO [org.apache.cxf.interceptor.LoggingOutInterceptor] - Outbound Message --- ID: 1 Address: https://dsills-t1500:8300/dsi-services/secure/Of306Service Encoding: UTF-8 Content-Type: text/xml Headers: {Accept=[*/*], SOAPAction=[]} Messages: (message truncated to -1 bytes) Payload: soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/;soap:Bodyns1:v alidatePin xmlns:ns1=http://of306.ws.abis.datasourceinc.com/;validationDatapin 33/pinssn555827444/ssndateOfBirth11/01/1953/dateOfBirth/ validationData/ns1:validatePin/soap:Body/soap:Envelope -- 2011-10-18 10:53:36,402 DEBUG [org.apache.cxf.transport.http.Headers] - Accept: */* 2011-10-18 10:53:36,402 DEBUG [org.apache.cxf.transport.http.Headers] - SOAPAction: 2011-10-18 10:53:36,404 DEBUG [org.apache.cxf.transport.http.TrustDecisionUtil] - No Trust Decider for Conduit '{http://of306.ws.abis.datasourceinc.com/}Of306ServicePort.http-conduit' . An afirmative Trust Decision is assumed. 2011-10-18 10:53:36,430 DEBUG [org.apache.cxf.phase.PhaseInterceptorChain] - Invoking handleFault on interceptor org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingI nterceptor@1a85a3b0 2011-10-18 10:53:36,430 DEBUG [org.apache.cxf.phase.PhaseInterceptorChain] - Invoking handleFault on interceptor org.apache.cxf.interceptor.StaxOutEndingInterceptor@553d26fd 2011-10-18 10:53:36,430 DEBUG [org.apache.cxf.phase.PhaseInterceptorChain] - Invoking handleFault on interceptor
Tomcat session invalidation
All: I'm a little confused about something. I'm using Tomcat as my servlet (web-service) container with CXF and want to ensure that web service requests do not create HTTP sessions. I cannot seem to find documentation about this, even on the Tomcat site - maybe there isn't a way to do it? Does anyone have any suggestions? David Sills
RE: Tomcat session invalidation
The real question is, does the Tomcat container know that? It's just another request to it, I would have thought. I'm trying to avoid the overhead, as my application may have very heavy load initially. -Original Message- From: Glen Mazza [mailto:gma...@talend.com] Sent: Monday, October 10, 2011 12:16 PM To: users@cxf.apache.org Subject: Re: Tomcat session invalidation That shouldn't be a concern, as SOAP requests are all stateless by default (have REQUEST scope). Glen On 10/10/2011 10:39 AM, David Sills wrote: All: I'm a little confused about something. I'm using Tomcat as my servlet (web-service) container with CXF and want to ensure that web service requests do not create HTTP sessions. I cannot seem to find documentation about this, even on the Tomcat site - maybe there isn't a way to do it? Does anyone have any suggestions? David Sills -- Glen Mazza Talend - http://www.talend.com/apache Blog - http://www.jroller.com/gmazza Twitter - glenmazza
RE: Published endpoint URL
Thanks for the comments, all. I hacked the source code for 2.4.2, putting in the fix in the method getAbsoluteAddress that was already in the source code in the repository (and will presumably be there for 2.4.3). This made the problems disappear. Good job! David Sills -Original Message- From: David Sills [mailto:dsi...@datasourceinc.com] Sent: Wednesday, October 05, 2011 12:43 PM To: users@cxf.apache.org Subject: Published endpoint URL All: I'm not sure how to move forward on this or whether I'm doing this all wrong and could use a suggestion. Ideas? The code in FormattedServiceListWriter seems to have an issue. I am specifying in my Spring configuration the property publishedEndpointUrl: jaxws:endpoint id=fingerprintService implementor=#fingerprintServiceBean address=/FingerprintService publishedEndpointUrl=https://dsills-t1500:8300/dsi-services/secure/Fing erprintService / I so this because I want it clear how the service is to be addressed. The code in the list writer, however, doesn't work for me: private String getAbsoluteAddress(String basePath, AbstractDestination d) { String endpointAddress = (String)d.getEndpointInfo().getProperty(publishedEndpointUrl); if (endpointAddress != null) { return endpointAddress; } endpointAddress = d.getEndpointInfo().getAddress(); *** if (basePath == null || endpointAddress.startsWith(basePath)) { return endpointAddress; } else { return basePath + endpointAddress; } } This produces: http://dsills-t1500:9090/dsi-serviceshttps://dsills-t1500:8300/dsi-servi ces/secure/FingerprintService which is obviously nonsense. Perhaps this might help?: *** if (basePath == null || endpointAddress.startsWith(basePath) || isValidURL(endpointAddress)) { ... where isValidURL is something like: private boolean isValidURL(String endpointAddress) { if (endpointAddress.indexOf(://) != -1) { try { URL url = new URL(endpointAddress); } catch (MalformedURLException e) { } } return false; } Of course, you may already have a utility that can do this as well - I don't know the whole codebase, but it's just an idea. David Sills
RE: Non CFX clients for CFX web services
Tim: I would strongly suggest you try doing the code generation using wsdl2java; your code should work then. If that's true, then you can try narrowing the issues. You don't necessarily have to continue to use the generated code (though I do so) but it should help you center in on the problems. David Sills -Original Message- From: Tim [mailto:s...@mail.ru] Sent: Friday, September 30, 2011 12:50 AM To: users@cxf.apache.org Subject: RE: Non CFX clients for CFX web services David Sills, thank you for your answer. No. I don't generate client from wsdl. I don't use wsdl at all. For better understanding the problem here is client code. *Axis client* --- package com.na.clients; import java.io.IOException; import java.net.MalformedURLException; import java.rmi.RemoteException; import javax.xml.namespace.QName; import javax.xml.rpc.ServiceException; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.jdom.JDOMException; public class AxisClient { private static String URL=http://localhost:8080/;; private static String SERVICE=trainCFX/HelloWorld; private static String METHOD=sayHi; public Call getCall(String strEndpoint, String strNamespace, String strMetodName) throws MalformedURLException { Service svcService = new Service(); Call clCall = null; try {clCall = (Call)svcService.createCall();} catch (ServiceException e) {e.printStackTrace();} clCall.setTargetEndpointAddress( new java.net.URL(strEndpoint) ); clCall.setOperationName(new QName(strNamespace, strMetodName)); return clCall; } public static void main(String[] args) throws JDOMException { AxisClient ac=new AxisClient(); Call clCall = null; try { clCall = ac.getCall(URL+SERVICE, http://na.com/;, METHOD); } catch (IOException e) { e.printStackTrace(); } String strResponse=; try { * //pass param Tim * *strResponse = (String)clCall.invoke(new Object[] {Tim} );* } catch (RemoteException e) { e.printStackTrace(); } *System.out.println(strResponse);* } } --- *CXF client *(it's the simple client from CXF examples) -- package com.na.clients; import org.springframework.context.support.ClassPathXmlApplicationContext; public class CFXClient { private CFXClient() { } public static void main(String args[]) throws Exception { System.out.println(--); // START SNIPPET: client ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {com/na/clients/client-beans.xml}); HelloWorld client = (HelloWorld)context.getBean(client); * //pass param Tim * *String response = client.sayHi(Tim);* *System.out.println(Response: + response);* System.exit(0); // END SNIPPET: client } } --- *client-bean.xml (for spring)* ?xml version=1.0 encoding=UTF-8? beans xmlns=http://www.springframework.org/schema/beans; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:jaxws=http://cxf.apache.org/jaxws; xsi:schemaLocation= http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.xsd; bean id=client class=com.na.clients.HelloWorld factory-bean=clientFactory factory-method=create/ bean id=clientFactory class=org.apache.cxf.jaxws.JaxWsProxyFactoryBean property name=serviceClass value=com.na.clients.HelloWorld/ property name=address value=http://localhost:8080/trainCFX/HelloWorld/ /bean /beans *And the difference beteen clients* Axis print: hi null cxf print: Response: hi, Tim -- View this message in context: http://cxf.547215.n5.nabble.com/Non-CXF-clients-for-CXF-web-services-tp4 851892p4855793.html Sent from the cxf-user mailing list archive at Nabble.com.
RE: Question about web services
All: I didn't get an answer to my original question, but still need one - just asking. The documentation for how to make a web service that is only accessible using HTTPS is, in any case, pretty thin. I'm happy to add to it if someone can point me in the right direction. One thing I'm also confused about, does the soap:address location attribute have to specify https as the protocol? If so, how can I do this with CXF annotations? I can find nothing in the documentation about this, though perhaps I'm just missing something. David Sills -Original Message- From: David Sills [mailto:dsi...@datasourceinc.com] Sent: Wednesday, September 28, 2011 12:04 PM To: users@cxf.apache.org Subject: Question about web services All: I have a question I can't seem to get a ready answer to. I see some potentially useful attributes on the jaxws:endpoint element, but I'm not sure how to use them. I have a report-writing service implemented on a Tomcat server in Windows using the CXF Spring configuration. While doing this, however, I left myself room to easily implement other web services on the same server by simply dropping in a JAR file into WEB-INF/lib with a Spring configuration in a known location within the JAR file and adding a single line to the master Spring configuration file. Happy to share if that sounds interesting to anyone. However, now I'm faced with a new challenge. My services up till now have been and need to remain HTTP. A new service has been requested, however, that must use HTTPS. Setting up Tomcat for HTTPS is its own problem, of course, but that's not what I'm asking. How do I mark a particular service to use HTTPS, even though other services may be using HTTP? Many, many thanks for any advice and ideas. David Sills
RE: Non CFX clients for CFX web services
Tim: I regularly develop Axis 1.4 clients for my CXF web services (I have to, because any batch processes that use the services have to work from Java 1.4.2) and have never encountered any problems. I assume you are generating your client code from your WSDL? Does everything look as you would expect it there? David Sills -Original Message- From: Tim [mailto:s...@mail.ru] Sent: Thursday, September 29, 2011 2:09 AM To: users@cxf.apache.org Subject: Non CFX clients for CFX web services Hi! I try to use CFX in first time. Before I develop web services using other framworks and tools. I make a simple project like Writing a service with Spring (Server and client sides). These are no any problems. But when I try to use my service by other clients it does not work correctly. Clients can connect to the service, they can make service method, but method* don't get passed parameters*. Does it mean that CFX can work only with clients developed by CFX? Why does it occure with other clients? *Additional information.* Our clients are developed by using different environments: 1. Java using Apache-Axis. 2. Delphi using their native components. Using tools: 1. IDE- Eclipse Indigo 2. Java - JDK 1.6.0_16 3. Axis 1.4. 4. CFX 2.4.2. Here is wsdl: ?xml version='1.0' encoding='UTF-8'?wsdl:definitions name=HelloWorldImplService targetNamespace=http://cfxhello.na.com/; xmlns:ns1=http://schemas.xmlsoap.org/soap/http; xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/; xmlns:tns=http://cfxhello.na.com/; xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; wsdl:types xsd:schema attributeFormDefault=unqualified elementFormDefault=unqualified targetNamespace=http://cfxhello.na.com/; xmlns:tns=http://cfxhello.na.com/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xsd:element name=sayHi type=tns:sayHi/ xsd:complexType name=sayHi xsd:sequence xsd:element minOccurs=0 name=text type=xsd:string/ /xsd:sequence /xsd:complexType xsd:element name=sayHiResponse type=tns:sayHiResponse/ xsd:complexType name=sayHiResponse xsd:sequence xsd:element minOccurs=0 name=return type=xsd:string/ /xsd:sequence /xsd:complexType /xsd:schema /wsdl:types wsdl:message name=sayHiResponse wsdl:part element=tns:sayHiResponse name=parameters /wsdl:part /wsdl:message wsdl:message name=sayHi wsdl:part element=tns:sayHi name=parameters /wsdl:part /wsdl:message wsdl:portType name=HelloWorld wsdl:operation name=sayHi wsdl:input message=tns:sayHi name=sayHi /wsdl:input wsdl:output message=tns:sayHiResponse name=sayHiResponse /wsdl:output /wsdl:operation /wsdl:portType wsdl:binding name=HelloWorldImplServiceSoapBinding type=tns:HelloWorld soap:binding style=document transport=http://schemas.xmlsoap.org/soap/http/ wsdl:operation name=sayHi soap:operation soapAction= style=document/ wsdl:input name=sayHi soap:body use=literal/ /wsdl:input wsdl:output name=sayHiResponse soap:body use=literal/ /wsdl:output /wsdl:operation /wsdl:binding wsdl:service name=HelloWorldImplService wsdl:port binding=tns:HelloWorldImplServiceSoapBinding name=HelloWorldImplPort soap:address location=http://localhost:8080/trainCFX/HelloWorld/ /wsdl:port /wsdl:service /wsdl:definitions If you would like any other information I can give it. -- View this message in context: http://cxf.547215.n5.nabble.com/Non-CFX-clients-for-CFX-web-services-tp4 851892p4851892.html Sent from the cxf-user mailing list archive at Nabble.com.
Question about web services
All: I have a question I can't seem to get a ready answer to. I see some potentially useful attributes on the jaxws:endpoint element, but I'm not sure how to use them. I have a report-writing service implemented on a Tomcat server in Windows using the CXF Spring configuration. While doing this, however, I left myself room to easily implement other web services on the same server by simply dropping in a JAR file into WEB-INF/lib with a Spring configuration in a known location within the JAR file and adding a single line to the master Spring configuration file. Happy to share if that sounds interesting to anyone. However, now I'm faced with a new challenge. My services up till now have been and need to remain HTTP. A new service has been requested, however, that must use HTTPS. Setting up Tomcat for HTTPS is its own problem, of course, but that's not what I'm asking. How do I mark a particular service to use HTTPS, even though other services may be using HTTP? Many, many thanks for any advice and ideas. David Sills
RE: Web service style/use
See the SOAPBinding class-level annotation, example: @SOAPBinding(parameterStyle = ParameterStyle.WRAPPED, style = Style.DOCUMENT, use = Use.LITERAL) -Original Message- From: Raj Floyd [mailto:rajfl...@gmail.com] Sent: Wednesday, August 31, 2011 8:51 AM To: users@cxf.apache.org Subject: Web service style/use Hi, It seems CXF uses document/literal by default. Is there any other style/use that CXF offers? If so, what is the api? Thanks Raj
Null strings
All: I'm having a peculiar problem and can't seem to find an easy solution using the CXF documentation. When a value passed via SOAP is empty (say, the middle name if it's an optional value), the JavaBean is filled in with an empty string, not null. This conflicts with JSR 303, which mostly only returns valid values for null strings, at least out of box (for instance, the Pattern validator in the RI returns true if the value is null but not if it's an empty string). Is there a straightforward way to configure the data binding to use null rather than empty strings? Or do I need to write my own validators to test for empty strings and throw out the RI exemplars? David Sills
RE: A question of choice
Thanks, Sergey, I'll give these suggestions some thought. I agree there is probably some refactoring involved, but for the moment the client is happy with the performance of the service and with the simplicity of the API from their client code's point of view (of course, that simply means the service has to do more with parameters). The tradeoffs between more thoroughly refactored API (and happier developers) and greater complexity in the application client don't for the present appear to appeal, but that's a stone at which I can continue to chip. Warmly, David --- If one have so many input parameters that they can't fit into GET query then it's a sign the refactoring of the service URI space is really needed.
A question of choice
All: A question for designers out there who wish to opine on best practices or advise me about an upcoming issue: we have an essentially RPC web service being considered for conversion to a RESTful one. Apologies for the length of the post before it even begins: The current SOAP web service, among other things, generates PDF reports (using BIRT behind the scenes, although of course that could be swapped out, which was the idea). A report can have arbitrarily many parameters (and many have quite a few) that must be supplied. In addition, the service performs a number of other functions are currently executed within a single service call. For instance, the service may print the generated document, keep it for later retrieval, or save it to a database. It may retrieve a document from the database rather than generating it. At the moment, what the service does is governed by a DocumentMetadata object: public interface DocumentMetadata { String getDesignFilename(); String getAssociatedCaseId(); String getDocumentItemPageId(); String getTitleToSaveAs(); boolean isKeepAfterProcessing(); } This allows the client to specify the name of the report file to use in generation, the case to which the document should be associated (a one-to-many relationship), the database ID of the document, the title to save the document as, and whether or not to keep it available. Another object (PrintJob) sent along details print parameters (printer to use, number of copies, orientation, etc.). The service uses these to decide what to do: 1. If the designFilename is supplied, a report is generated. 2. If the documentItemPageId is supplied, the report is retrieved from the database. 3. If the titleToSaveAs is supplied, the report is saved to the database with the appropriate title in addition to the bytes of the report itself (all saved documents require titles). 4. If the report is saved to the database and the associatedCaseId is supplied, a foreign-key reference to the case is inserted along with the document record (documents may relate to cases or not [e.g., summaries of daily activity relate to no specific case]). 5. If the keepAfterProcessing is set to true, the document is saved and information about how to retrieve it is returned to the client. 6. If the print object is supplied (non-null), the document (however obtained) is printed following the supplied parameters or sensible defaults. What is returned to the client is a ProcessingOutcome object: public interface ProcessingOutcome { boolean isReportCreationSuccessful(); String getDocumentId(); String getDocumentItemId(); String getDocumentItemPageId(); boolean isPrintingSuccessful(); String getUrl(); String getUnc(); } Most of this is obvious: 1. Whether report creation was successful (false if the report was retrieved from the database) 2. The various database IDs associated with the document (don't even ask - I didn't design the database, obviously) 3. Whether or not printing was successful (false if it was not requested) 4. If the document was kept, a URL for retrieving it via HTTP and a UNC reference for retrieving it via Windows Explorer et alia So now the questions: 1. Can or should this service be converted to REST? 2. Can it be converted to REST as is, or should it be broken up into smaller pieces (not sure the client would agree to that)? 3. Can REST handle the amount of data a GET request would necessarily have to include? Any ideas? Any tales of converting something like this and the ups and downs you encountered? Thanks in advance! David Sills
Spring autowiring
All: I have been using the CXF non-Spring servlet and am now moving to the CXF Spring servlet. I'm not completely familiar with Spring's autowiring capabilities, but is there a way of adding a new web service to my server without explicitly modifying the Spring configuration? In other words, I'd like to be able to add a new web service by simply dropping it in, either reading configuration information from an XML in the JAR file or by reading annotations. Has anyone tried something like this and gotten it to work? Thanks! David Sills
RE: Spring autowiring
Christian: Thanks, I wasn't looking for hot deploy, however. I was simply looking to be able to auto-discover web services when the server starts up, so that I could 1. Drop a JAR file into WEB-INF/lib 2. Restart the server without having to modify the Spring configuration file. Can this be done? I could include additional Spring configuration in an XML file in the META-INF directory of the JAR, or perhaps annotate the classes in some way, or so I was thinking. David -Original Message- From: Christian Schneider [mailto:cschnei...@talend.com] Sent: Friday, June 03, 2011 9:12 AM To: users@cxf.apache.org Subject: AW: Spring autowiring You can drop a war file in a Servlet Container or a bundle jar into Karaf. This will make it execute without restarting the server. Spring or CXF do are no containers so they do not offer direct support for hot deploy. Christian -Ursprüngliche Nachricht- Von: David Sills [mailto:dsi...@datasourceinc.com] Gesendet: Freitag, 3. Juni 2011 13:20 An: users@cxf.apache.org Betreff: Spring autowiring All: I have been using the CXF non-Spring servlet and am now moving to the CXF Spring servlet. I'm not completely familiar with Spring's autowiring capabilities, but is there a way of adding a new web service to my server without explicitly modifying the Spring configuration? In other words, I'd like to be able to add a new web service by simply dropping it in, either reading configuration information from an XML in the JAR file or by reading annotations. Has anyone tried something like this and gotten it to work? Thanks! David Sills
Schemas inside WSDL
I'm having some trouble understanding exactly how to relate XSD types I already have to WSDL, where I want to reuse them. If someone could point me in a good direction, I'd be very grateful. I have, for instance, a schema in which I define: xs:simpleType name=ssn-type xs:restriction base=xs:string xs:pattern value=[1-8][0-9]{8}|(?:0(?!0{8}))[0-9]{8}|(?:9(?!9{8}))[0-9]{8}/ /xs:restriction /xs:simpleType (a standard SSN but not all 0s or all 9s - this is the customer's requirement) I would like to use this to validate the SSN (in the WSDL, in other words) for this class: @XmlType(name = Identity) public class IdentityImpl implements Identity { private String ssn; // a bunch of other properties /** * @see com.datasourceinc.abis.ws.fingerprint.Identity#getSsn() */ @Override public String getSsn() { return ssn; } public void setSsn(String ssn) { this.ssn = ssn; } // the rest of the getters and setters I have tried a variety of annotations on the getSsn() method and the entire class without success. Can anyone suggest anything that will do what I want? Thanks! David Sills
RE: Schemas inside WSDL
Benson: I take your point that perhaps I'm asking more than the tools can do, but am left wondering why you might discourage the use of reusable elements within a web service. Is it not typically done? I was thinking that it would simplify data validation - by the time you made it through a schema-aware parser, you would know that the data would be valid as well as correctly formatted. Ah well, at least apples and coconuts does seem like a tasty combo to me personally... :-) David -Original Message- From: Benson Margulies [mailto:bimargul...@gmail.com] Sent: Tuesday, May 31, 2011 12:41 PM To: users@cxf.apache.org Subject: Re: Schemas inside WSDL David, I think you are mixing apples and coconuts a bit here. The schema in a WSDL is XSD. What you are looking at it the process of auto-generating XSD from Java with annotations, apparently with JAX-B. JAX-B supports only a subset of XSD. Many restrictions and other refinements that you can express in XSD have no representation in plain JAX-B. In some cases you can add JAX-B plugins that get you more. If you use the JAX-B tool to generate Java from your XSD, you can see just how much gets thrown away. If you really need to use a highly-specialized schema to express your web service (which I might discourage), you can't use JAX-B in Java-first mode. You can use schema-first, and then enable schema validation. On Tue, May 31, 2011 at 11:21 AM, David Sills dsi...@datasourceinc.com wrote: I'm having some trouble understanding exactly how to relate XSD types I already have to WSDL, where I want to reuse them. If someone could point me in a good direction, I'd be very grateful. I have, for instance, a schema in which I define: xs:simpleType name=ssn-type xs:restriction base=xs:string xs:pattern value=[1-8][0-9]{8}|(?:0(?!0{8}))[0-9]{8}|(?:9(?!9{8}))[0-9]{8}/ /xs:restriction /xs:simpleType (a standard SSN but not all 0s or all 9s - this is the customer's requirement) I would like to use this to validate the SSN (in the WSDL, in other words) for this class: @XmlType(name = Identity) public class IdentityImpl implements Identity { private String ssn; // a bunch of other properties /** * @see com.datasourceinc.abis.ws.fingerprint.Identity#getSsn() */ @Override public String getSsn() { return ssn; } public void setSsn(String ssn) { this.ssn = ssn; } // the rest of the getters and setters I have tried a variety of annotations on the getSsn() method and the entire class without success. Can anyone suggest anything that will do what I want? Thanks! David Sills
RE: Schemas inside WSDL
Benson: Oh, maybe I see what you mean. Are you suggesting that the purpose of XML Schema and WSDL are orthogonal: that schemas are there for data definition/validation and WSDL is really concerned with data transport, so importing a schema into the WSDL isn't really going to work the way I naively thought it might? Did I get the general sense of the objection? David -Original Message- From: David Sills [mailto:dsi...@datasourceinc.com] Sent: Tuesday, May 31, 2011 2:03 PM To: users@cxf.apache.org Subject: RE: Schemas inside WSDL Benson: I take your point that perhaps I'm asking more than the tools can do, but am left wondering why you might discourage the use of reusable elements within a web service. Is it not typically done? I was thinking that it would simplify data validation - by the time you made it through a schema-aware parser, you would know that the data would be valid as well as correctly formatted. Ah well, at least apples and coconuts does seem like a tasty combo to me personally... :-) David -Original Message- From: Benson Margulies [mailto:bimargul...@gmail.com] Sent: Tuesday, May 31, 2011 12:41 PM To: users@cxf.apache.org Subject: Re: Schemas inside WSDL David, I think you are mixing apples and coconuts a bit here. The schema in a WSDL is XSD. What you are looking at it the process of auto-generating XSD from Java with annotations, apparently with JAX-B. JAX-B supports only a subset of XSD. Many restrictions and other refinements that you can express in XSD have no representation in plain JAX-B. In some cases you can add JAX-B plugins that get you more. If you use the JAX-B tool to generate Java from your XSD, you can see just how much gets thrown away. If you really need to use a highly-specialized schema to express your web service (which I might discourage), you can't use JAX-B in Java-first mode. You can use schema-first, and then enable schema validation. On Tue, May 31, 2011 at 11:21 AM, David Sills dsi...@datasourceinc.com wrote: I'm having some trouble understanding exactly how to relate XSD types I already have to WSDL, where I want to reuse them. If someone could point me in a good direction, I'd be very grateful. I have, for instance, a schema in which I define: xs:simpleType name=ssn-type xs:restriction base=xs:string xs:pattern value=[1-8][0-9]{8}|(?:0(?!0{8}))[0-9]{8}|(?:9(?!9{8}))[0-9]{8}/ /xs:restriction /xs:simpleType (a standard SSN but not all 0s or all 9s - this is the customer's requirement) I would like to use this to validate the SSN (in the WSDL, in other words) for this class: @XmlType(name = Identity) public class IdentityImpl implements Identity { private String ssn; // a bunch of other properties /** * @see com.datasourceinc.abis.ws.fingerprint.Identity#getSsn() */ @Override public String getSsn() { return ssn; } public void setSsn(String ssn) { this.ssn = ssn; } // the rest of the getters and setters I have tried a variety of annotations on the getSsn() method and the entire class without success. Can anyone suggest anything that will do what I want? Thanks! David Sills
RE: Schemas inside WSDL
Benson: It would seem that I sort-of did follow you (assuming I follow you now), though my email wasn't quite fast enough (or my brain wasn't, take your pick). However, I'm a little perplexed about why it is that using a schema type that guarantees data validation would be a bad idea. I'm not concerned with my data's structure so much as its content. I'd like the failure to occur at the earliest possible moment in the web service process, as I anticipate a heavy load for this application. That was why I thought that if the original parser that got the WSDL could fail while loading the XML document (ignoring for the moment that it is a WSDL and has other responsibilities) that it might help me: no Java objects and less processing time. Still, I take your notion of separation of concerns (assuming that's actually what you meant). Let the WSDL just get the data to me and then worry about whether it is valid or not. David -Original Message- From: Benson Margulies [mailto:bimargul...@gmail.com] Sent: Tuesday, May 31, 2011 2:17 PM To: users@cxf.apache.org Subject: Re: Schemas inside WSDL Let me be clear about what I'm discouraging versus merely describing. Once upon a time, SOAP had these two models: RPC and Document. The idea was that RPC would be used a mapping for procedure calls, and Document was about passing XML documents around. As things have evolved, however, the RPC format is pretty completely dead. However, the vast majority of what people do with web services is, in fact, RPC. They are just doing it with Document/Literal services. As a result, what most people are doing most of the time is passing data structures around, often between disparate programming languages. This works best when the XML used is the simplest possible XML that carries the semantics. So, while an XML Schema can talk about attributes, and facets, and regexp restrictions, and all sorts of peanut-butter hoola-hoops, I think I am not alone in discouraging the use of complex schemata in web services. If your actual purpose is to ship complex chunks of XML around the landscape, I'd recommend sending them at attachments. So, OK, let's imagine that you think that I'm making sense. What about reuse? you ask. Reuse is a good thing. However, it's very hard to achieve reuse if you define your schema by asking JAX-B to derive it from an infestation of @nnotation sn@ils in your Java code. If you want reuse, I personally think you are better off defining your service as a WSDL that includes XML schema(s) that you can maintain and share, and then generating the Java code from the schema, instead of the other way around. On Tue, May 31, 2011 at 2:02 PM, David Sills dsi...@datasourceinc.com wrote: Benson: I take your point that perhaps I'm asking more than the tools can do, but am left wondering why you might discourage the use of reusable elements within a web service. Is it not typically done? I was thinking that it would simplify data validation - by the time you made it through a schema-aware parser, you would know that the data would be valid as well as correctly formatted. Ah well, at least apples and coconuts does seem like a tasty combo to me personally... :-) David -Original Message- From: Benson Margulies [mailto:bimargul...@gmail.com] Sent: Tuesday, May 31, 2011 12:41 PM To: users@cxf.apache.org Subject: Re: Schemas inside WSDL David, I think you are mixing apples and coconuts a bit here. The schema in a WSDL is XSD. What you are looking at it the process of auto-generating XSD from Java with annotations, apparently with JAX-B. JAX-B supports only a subset of XSD. Many restrictions and other refinements that you can express in XSD have no representation in plain JAX-B. In some cases you can add JAX-B plugins that get you more. If you use the JAX-B tool to generate Java from your XSD, you can see just how much gets thrown away. If you really need to use a highly-specialized schema to express your web service (which I might discourage), you can't use JAX-B in Java-first mode. You can use schema-first, and then enable schema validation. On Tue, May 31, 2011 at 11:21 AM, David Sills dsi...@datasourceinc.com wrote: I'm having some trouble understanding exactly how to relate XSD types I already have to WSDL, where I want to reuse them. If someone could point me in a good direction, I'd be very grateful. I have, for instance, a schema in which I define: xs:simpleType name=ssn-type xs:restriction base=xs:string xs:pattern value=[1-8][0-9]{8}|(?:0(?!0{8}))[0-9]{8}|(?:9(?!9{8}))[0-9]{8}/ /xs:restriction /xs:simpleType (a standard SSN but not all 0s or all 9s - this is the customer's requirement) I would like to use this to validate the SSN (in the WSDL, in other words) for this class: @XmlType(name = Identity) public class IdentityImpl implements Identity { private String ssn; // a bunch of other properties
RE: Schemas inside WSDL
Benson: Oh, yes, I knew I'd have to hand-craft the schema. That wasn't a problem - it already exists and is available. However, enabling schema validation had a side effect I didn't foresee. The package schema for my classes was, of course, not available (since it doesn't exist, technically, at least not as a schema with the appropriate URL), and so the whole thing threw a hissy fit. In the end, I decided you were right and not to try to use schema validation. I'll just validate the old fashioned way on the other end. Many thanks for your help and the clarifications. David Sills -Original Message- From: Benson Margulies [mailto:bimargul...@gmail.com] Sent: Tuesday, May 31, 2011 2:36 PM To: users@cxf.apache.org Subject: Re: Schemas inside WSDL David, There's some more underbrush that I see the need to clear away. Strictly speaking, a WSDL specifies the operations of a service. In specifying those operations, it specifies the types of the operands. The language in which it specifies those types is W3C XML Schema. A WSDL (and embedded or reference schema(s)) is either something you create, or something you generate from your code, using JAX-B or one of the alternatives. If you specify that, say, a parameter has to be a positive integer, JAX-B does not attempt to map this into your Java code at all. There is no corresponding @nnotation for it. However, if you enable schema validation, CXF (or some other lib) will validate your numbers against the schema. It might or might not be too slow for you. So, I want to draw a distinction between validation and structural complexity. If you use restrictions in a schema to tighten the contract, that's fine. JAX-B will (generally) map them to simple Java constructs, and then you can choose to enable schema validation at runtime and get exceptions thrown for transgressions. You might or might not like *when* they get thrown, or how slow the validation is. You will have to build them by typing your own XSD files that you reference in your WSDL files, not by adding @nnotations to Java. On the other hand, building up a very complex schema ('mixed', or attributes, or other things that are very specific to XML syntax and very far away from Java or other programming languages) is likely to give you unpleasant surprises. On Tue, May 31, 2011 at 2:26 PM, David Sills dsi...@datasourceinc.com wrote: Benson: It would seem that I sort-of did follow you (assuming I follow you now), though my email wasn't quite fast enough (or my brain wasn't, take your pick). However, I'm a little perplexed about why it is that using a schema type that guarantees data validation would be a bad idea. I'm not concerned with my data's structure so much as its content. I'd like the failure to occur at the earliest possible moment in the web service process, as I anticipate a heavy load for this application. That was why I thought that if the original parser that got the WSDL could fail while loading the XML document (ignoring for the moment that it is a WSDL and has other responsibilities) that it might help me: no Java objects and less processing time. Still, I take your notion of separation of concerns (assuming that's actually what you meant). Let the WSDL just get the data to me and then worry about whether it is valid or not. David -Original Message- From: Benson Margulies [mailto:bimargul...@gmail.com] Sent: Tuesday, May 31, 2011 2:17 PM To: users@cxf.apache.org Subject: Re: Schemas inside WSDL Let me be clear about what I'm discouraging versus merely describing. Once upon a time, SOAP had these two models: RPC and Document. The idea was that RPC would be used a mapping for procedure calls, and Document was about passing XML documents around. As things have evolved, however, the RPC format is pretty completely dead. However, the vast majority of what people do with web services is, in fact, RPC. They are just doing it with Document/Literal services. As a result, what most people are doing most of the time is passing data structures around, often between disparate programming languages. This works best when the XML used is the simplest possible XML that carries the semantics. So, while an XML Schema can talk about attributes, and facets, and regexp restrictions, and all sorts of peanut-butter hoola-hoops, I think I am not alone in discouraging the use of complex schemata in web services. If your actual purpose is to ship complex chunks of XML around the landscape, I'd recommend sending them at attachments. So, OK, let's imagine that you think that I'm making sense. What about reuse? you ask. Reuse is a good thing. However, it's very hard to achieve reuse if you define your schema by asking JAX-B to derive it from an infestation of @nnotation sn@ils in your Java code. If you want reuse, I personally think you are better off defining your service as a WSDL that includes XML schema(s) that you can
DestinationFactory with JAX-WS?
Hi! I'm a new user of CXF (though a long-time veteran of Java and other WS implementations) and have to admit I find the documentation very confusing. Of course, it's easy to write confusing documentation if the people who write it know what they are doing (they don't realize the things their readers won't know). On the other hand What's got me at the moment, is writing a standalone server. I need to add some static pages to the server programmatically and was thrilled to see that I could do so with the code at http://cxf.apache.org/docs/standalone-http-transport.html. However, there's a problem; the code is not complete. In particular, it uses a method on a DestinationFactory that simply appears (that is, the variable df is nowhere declared, so I don't know where it came from): Destination destination = df.getDestination(ei); // etc., other code I understand Fine, once I can get there I understand what's going on, but my service works very well with the JAX-WS frontend, which I am declaring simply with: Endpoint e = Endpoint.publish(http://localhost:9000/DsiServer;, new PRServiceImpl()); So my question: how do I locate the appropriate DestinationFactory if I am using the JAX-WS frontend in this way? There is some discussion about how the whole thing works also in http://cxf.apache.org/docs/jax-ws-configuration.html but about half of it I am having difficulty with the underlying assumptions about how to use it and the other half doesn't get me to where I need to go. Many thanks for your pity on a new user. David