WSS4J - Protection Order
Hi, Usually we use, Sign and then Encrypt action for any particular xml element. If I want to use Encrypt and then Sign for a particular xml element, then SignatureAction fails to find the xml element. The reason is it has been encrypted and hence corresponding EncryptedData element will be there. One way to achieve this, is to specify, URI of EncryptedData itself in the signature parts. (It should work, though I haven't tested it). But this is not a full proof solution if I want only specific element only to be encrypted and eventually signed. *Is there any mechanism to achieve this?* The only way I can think of achieving this is to maintain a list of wsu:id's of corresponding EncryptedData elements and add URI of them to Signature Parts during .SignatureAction. This may be performed in adding another interceptor which handles the message after encryption has been done. Please let me know your views/suggestions about this. Thanking in advance. :) With Regards, Mayank
StackOverflowError when resolving schemas with CXF 2.0.3
Hello, we are developing a webservice application with CXF, but with version 2.0.3 we get an endless loop creating the schema for our WSDL. The scenario is the following: Our web.wsdl ist importing a schema definition a.xsd and a.xsd is including b.xsd, so both definitions share the namespace. The new internal LSResourceResolver in org.apache.cxf.wsdl.EndpointReferenceUtils has this implementation code: 460factory.setResourceResolver(new LSResourceResolver() { 461 public LSInput resolveResource(String type, String namespaceURI, String publicId, 462 String systemId, String baseURI) { 463 for (XmlSchema sch : sc.getXmlSchemas()) { 464 if (namespaceURI.equals(sch.getTargetNamespace())) { 465 LSInputImpl impl = new LSInputImpl(); 466 InputStream ins = null; 467 try { 468 URL url = new URL(sch.getSourceURI()); 469 ins = url.openStream(); 470 } catch (Exception e) { 471 //ignore, we'll just use what we have. (though 472 //bugs in XmlSchema could make this less useful) 473 } 474 475 if (ins == null) { 476 LoadingByteArrayOutputStream out = new LoadingByteArrayOutputStream(); 477 sch.write(out); 478 ins = out.createInputStream(); 479 System.out.println(out.toString()); 480 } 481 impl.setByteStream(ins); 482 return impl; 483 } 484 } 485 return null; 486 } 487 488 }); The resolving order is: web.wsdl - a.xsd - b.xsd When resolving the definition of b.xsd the if statement in line 464 is already true if the analyzed schema is a.xsd because of the same namespace. And if the iterator provides a.xsd before b.xsd we are resolving in an endless loop (a.xsd-b.xsd-a.xsd...) My question is: Do we have to alter our schemas or is this a bug? The previous versions didn't show this behaviour. Regards, Andreas. -- View this message in context: http://www.nabble.com/StackOverflowError-when-resolving-schemas-with-CXF-2.0.3-tp14800936p14800936.html Sent from the cxf-user mailing list archive at Nabble.com.
cxf jar is empty
Hi, I downloaded the src zip of cxf 2.0.3. Did a mvn -Pfastinstall in the root folder. Then did a mvn in the distribution folder. But the cxf-2.0.3-incubator.jar file (inside the resulting apache-cxf-2.0.3-incubator.zip package) does not have any class files inside it ! Its just empty! Only 10KB size (META-INF folder is present). Though it should be about 2.5MB. Has anyone seen this before? If required I will post the build output. It showed all success. Thanks! Mayank
RE: New snapshot, new anyType
Great! We will give it a try today! -Tony From: Benson Margulies [mailto:[EMAIL PROTECTED] Sent: Sun 1/13/2008 9:59 PM To: Vespa, Anthony J Cc: cxf-user Subject: New snapshot, new anyType Anthony, I checked in and snapshotted the missing part of the anyType support. The JavaScript code will now try to turn the XML for an xs:anyType element into something useful. If it has a complex type in the schema, it will be unpacked into an object. If it is a basic type, it will be converted to the appropriate JavaScript type. Only if both of those fail will you find a DOM Node waiting for you.
RE: Issues with JSON based Service and Jettison
Hrm, could you explain a bit more please? I was under the impression from various examples that JSON would behave like REST, eg I pass a request in a URL and the response comes back as a JSON output (eg I have a method called getMessage and it takes 3 params) so I pass it message/1/2/3/ and the output is in JSON forma- by the request wrapper you mean that I would need to pass it one object (say, a hashmap) and unwrap that object, as that is how the JSON inbound request is represented, correct? I was under the perhaps mistaken impression that JSON was extracting the values from the inbound JSON array and matching them with the arguments via Jettison. From: Liu, Jervis [mailto:[EMAIL PROTECTED] Sent: Sun 1/13/2008 5:00 AM To: cxf-user@incubator.apache.org Subject: RE: Issues with JSON based Service and Jettison According to the stack trace, it looks like your service method has more than one parameters. The CXF HTTP binding requires that the service method can only have one input parameters. For example, following is invalid: @Put @HttpResource(location = /books/{id}) void updateBook(@WebParam(name = Book)Book c, int id); Hope this helps, Jervis -Original Message- From: Vespa, Anthony J [mailto:[EMAIL PROTECTED] Sent: 2008?1?13? 10:33 To: cxf-user@incubator.apache.org; cxf-user@incubator.apache.org Subject: RE: Issues with JSON based Service and Jettison I actually tried the jax_rs samples a week or two back and it caused quite a few issues with our codebase, as well as generally not working - it would also require re-writes of all services, but even just re-writing one I get exceptions and other issues - there was also some odd behavior, like not being able to pass any data type but a String, for example, as any arguement. Has anyone got a good detailed example of getting JSON to work from end to end, with submitting a JSON formatted input into a service, and getting appropriate output, with a configuration through beans.xml? I can get the simple examples to work with some futzing around, but I'm doing to send some complex input back and forth I've scanned through the mailing list and searched the web, but I haven't found much info - the docs for jettison tend to give the same general example and I need something specific - or at least a hard enough push to know if it is a configuration issue, or if I am trying to do something that is either crazy or not supported. From: Liu, Jervis [mailto:[EMAIL PROTECTED] Sent: Sat 1/12/2008 11:36 AM To: cxf-user@incubator.apache.org Subject: RE: Issues with JSON based Service and Jettison Grab a latest snapshot of CXF, check out the samples\jax_rs\content_negotiation demo. The spring configuration can be found in [1]. An example of using JSON to do post can be found in system test: trunk\systests\src\test\java\org\apache\cxf\systest\jaxrs\JAXRSClientServer BookTest.java [1]. http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html Cheers, Jervis -Original Message- From: Vespa, Anthony J [mailto:[EMAIL PROTECTED] Sent: 2008?1?12? 1:43 To: cxf-user@incubator.apache.org Subject: Issues with JSON based Service and Jettison Hello, I cannot seem to get a JSON based servive to work properly. Does anyone have a complete end to end example using the spring config to set up jettison? Ideally I want to be able to use a post or a get to a service using JSON both on request and response. I am accessing the service via /message/ABC123DEF456/4 I am using Jettison and am getting the following exceptions: Jan 11, 2008 12:36:27 PM org.apache.cxf.interceptor.AttachmentInInterceptor handleMessage INFO: AttachmentInInterceptor skipped in HTTP GET method Jan 11, 2008 12:36:27 PM org.apache.cxf.binding.http.interceptor.DispatchInterceptor handleMessage INFO: Invoking GET on /message/ABC123DEF456/4 Jan 11, 2008 12:36:27 PM org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor handleMessage INFO: URIParameterInterceptor handle message on path [/message/ABC123DEF456/4] with content-type [null] Jan 11, 2008 12:36:27 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept INFO: Interceptor has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: SINGLE_PART_REQUIRED at org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.handle Message(URIParameterInInterceptor.java:82) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC hain.java:207) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiati onObserver.java:78) at org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDes tination.java:79) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(Ser vletController.java:264) at
Crash in REST mode in CXF 2.0.3
I'm using Maven to get cxf-bundle-2.0.3 and I've been unable to get the REST mode to work properly. The error appears to be javax.xml.bind.JAXBException: property com.sun.xml.bind.defaultNamespaceRemap is not supported This is on java 1.6.0_03. Sample class that causes an error: import java.util.*; import org.apache.cxf.endpoint.Server; import org.apache.cxf.jaxws.JaxWsServerFactoryBean; import org.apache.cxf.service.invoker.BeanInvoker; public class Bob { public static void main(String... args) { try { JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(); sf.setServiceClass( Bob.class ); sf.setAddress( http://localhost:/; ); sf.getServiceFactory().setInvoker( new BeanInvoker( new Bob() ) ); Server server = sf.create(); server.start(); } catch (Throwable t) { dump(t); } } private static void dump(Throwable t) { System.err.println(t.toString()); for (StackTraceElement e : t.getStackTrace()) System.err.println(e); Throwable cause = t.getCause(); if (cause != null) { System.err.println(Caused by:); dump(cause); } } public String getGreeting() { return Hello!; } public ListString getColors() { String[] a = red,orange,yellow,green,blue,violet.split( , ); return Arrays.asList( a ); } } Sample error: 14-Jan-2008 13:26:19 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass INFO: Creating Service {http://unknown.namespace/}BobService from class Bob org.apache.cxf.service.factory.ServiceConstructionException org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:197) org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:293) org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:333) org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:151) org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:93) org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:74) org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:108) org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:147) Bob.main(Bob.java:18) Caused by: javax.xml.bind.JAXBException: property com.sun.xml.bind.defaultNamespaceRemap is not supported com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:52) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210) javax.xml.bind.ContextFinder.find(ContextFinder.java:381) javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574) org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContext(JAXBDataBinding.java:369) org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:180) org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:293) org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:333) org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:151) org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:93) org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:74) org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:108) org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:147) Bob.main(Bob.java:18) -- View this message in context: http://www.nabble.com/Crash-in-REST-mode-in-CXF-2.0.3-tp14802376p14802376.html Sent from the cxf-user mailing list archive at Nabble.com.
Does MtoM require SOAP 1.2?
RE: Does MtoM require SOAP 1.2?
Nah-- I'm using it with SOAP 1.1 on my CXF service. Didn't have to do anything special (other than normal config stuff). It mainly just worked. I've also got .NET clients and Metro clients using MTOM with my SOAP 1.1 service. -Chris -Original Message- From: Benson Margulies [mailto:[EMAIL PROTECTED] Sent: Monday, January 14, 2008 9:48 AM To: cxf-user Subject: Does MtoM require SOAP 1.2?
.NET client Web Reference can't find correct method
I need to test .NET client to connect to CXF web service. In VS, I add web reference, and input url. When my method is: String sayHi(String text) web reference can find the correct method: sayHi(textAs string) As string But when my method is: String sayHi(String text, Profile info) throws BusinessLogicException; still web reference can only find: sayHi(textAs string) As string It's not getting object Profile info and BusinessLogicException! Below is my wsdl file. Is there anything wrong? When VS is finding the correct method? ?xml version=1.0 encoding=utf-8? wsdl:definitions xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; xmlns:soap=http:// schemas.xmlsoap.org/wsdl/soap/ xmlns:tns=http://spring.demo/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; name=HelloWorldService targetNamespace=http://spring.demo/; wsdl:types xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema; attributeFormDefault=unqualified elementFormDefault=unqualified targetNamespace=http:// spring.demo/ xmlns:tns=http://spring.demo/; xs:element name=BusinessLogicFaultDetail nillable=true type=tns:BusinessLogicFaultDetail/ xs:element name=sayHi nillable=true type=tns:sayHi/ xs:element name=sayHiResponse nillable=true type=tns:sayHiResponse/ xs:complexType name=sayHi xs:sequence xs:element minOccurs=0 name=text type=xs:string/ xs:element minOccurs=0 name=info type=tns:profileInfo/ /xs:sequence /xs:complexType xs:complexType name=profileInfo xs:sequence xs:element minOccurs=0 name=addressLine1 type=xs:string/ xs:element minOccurs=0 name=addressLine2 type=xs:string/ xs:element minOccurs=0 name=city type=xs:string/ xs:element minOccurs=0 name=companyName type=xs:string/ xs:element minOccurs=0 name=email type=xs:string/ xs:element minOccurs=0 name=fax type=xs:string/ xs:element minOccurs=0 name=firstName type=xs:string/ xs:element minOccurs=0 name=lastName type=xs:string/ xs:element minOccurs=0 name=middleName type=xs:string/ xs:element minOccurs=0 name=mobile type=xs:string/ xs:element minOccurs=0 name=phone type=xs:string/ xs:element minOccurs=0 name=state type=xs:string/ xs:element minOccurs=0 name=status type=xs:string/ xs:element minOccurs=0 name=zip type=xs:string/ /xs:sequence /xs:complexType xs:complexType name=sayHiResponse xs:sequence xs:element minOccurs=0 name=return type=xs:string/ /xs:sequence /xs:complexType xs:complexType name=BusinessLogicFaultDetail/ /xs:schema /wsdl:types wsdl:message name=BusinessLogicException wsdl:part element=tns:BusinessLogicFaultDetail name=BusinessLogicException /wsdl:part /wsdl:message 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:fault message=tns:BusinessLogicException name=BusinessLogicException /wsdl:fault /wsdl:operation /wsdl:portType wsdl:binding name=HelloWorldServiceSoapBinding 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:fault name=BusinessLogicException soap:fault name=BusinessLogicException use=literal/ /wsdl:fault /wsdl:operation /wsdl:binding wsdl:service name=HelloWorldService wsdl:port binding=tns:HelloWorldServiceSoapBinding name=HelloWorldPort soap:address location=http://localhost:9090/spring_http/ws/ServerEndPoint/ /wsdl:port /wsdl:service /wsdl:definitions -- View this message in context: http://www.nabble.com/.NET-client-Web-Reference-can%27t-find-correct-method-tp14803683p14803683.html Sent from the cxf-user mailing list archive at Nabble.com.
MTOM trivial case
I want to use MtoM to ship non-XML-1.0 text. So, I'd just as soon declare String properties, not DataHandlers. Does anyone know if this is likely to work?
Re: Exception object has all fields set to NULL on client side
On Friday 11 January 2008, rkannan wrote: Dan, I am wondering how you got the test case for exception to work if the SOAP messages are qualified but WSDL is unqualified. I believe that was the problem with my case also and the exception test case failed. The test case is java first on both client and server.Thus, there is no wsdl - java run to generate the JAXWS/JAXB version of the exceptions.That's actually why it works. The server is writing the exception wrong, but the java first code for reading the exception is based on the same assumptions so it reads it fine. FYI, I am still working on 2.0.3. Are you running these test cases for exception on 2.0.3 or 2.0.4 snapshot? I noticed that in runDocLitTest you have a catch statement for CustomException. In my case its always something like CustomException_Exception because WSDL2Java generates this wrapper. Does 2.0.4 get rid off the wrapper exception class? No. It's using the exact same exception class as the server side. This is a PURE java first test.No wsdl or code generation involved at all. I am going to give 2.0.4 a try today in the evening. Also, is the tentative release date around mid Jan? Yep. I was hoping for early this week, but we still have several open issues we need to look at. Thus, hopefully late this week or early next week. Dan - Kannan dkulp wrote: Maybe not. I did wireshark wiretraces on the messages and the messages are in qualified form despite the schema saying they should be unqualified.That's definitely a bug and may be part of the issue. :-( I'll try and get that fixed and see if that helps. Might not be able to get to it till monday though. Silly meetings. Dan On Friday 11 January 2008, Daniel Kulp wrote: I'm definitely going to need a test case from you. I've checked the system tests that we currently have and they are all using the default unqualified schemas. In particular, I looked at the CustomException.java thing that we throw (code at: http://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/te st/ java/org/apache/cxf/systest/jaxws/CustomException.java and the Schema it generates is definitely unqualified and the exception test does work. (Line 360 of ClientServerMiscTest.java) Could you please send me the exception class you are trying to throw so I can try and reproduce it? Thanks! Dan On Friday 11 January 2008, Daniel Kulp wrote: The stuff in CXF-1226 is new for 2.0.4 so you would need to be using a snapshot version of 2.0.4 for that to work. I'm looking into the other stuff now. Dan On Friday 11 January 2008, rkannan wrote: Dan, I followed the discussion on CXF-1226 in this forum and found it very helpful. (http://www.nabble.com/Created:-(CXF-1226)-Missing-input-output -pa ra m- namespace-in-SOAP-td13870857.html) The workaround proposed by Benson is creating a qualified schema and fixing the NULL field problem. I tried the ReflectionServiceFactoryBean approach that you had suggested but I couldn't get it working. You had mentioned that it was not very well tested at that time. It will be cleaner to use a spring configuration rather than create package-info files and dummy beans. Do have any update on its status? - Kannan rkannan wrote: Dan, Sorry, I made a mistake in my previous post. There is nothing wrong with parsing the SOAP detail. However the problem is with the Unmarshaller piece. As you said I wrote a simple HelloWorld program that throws an exception and this is what I found out. - HelloWorld program is working fine for exception. The reason is that the generated WSDL has elementFormDefault=qualified on its schema. As a result, WSDL2Java generates stub code that has @XmlElement annotation with namespace attribute on the protected field of exception class. I checked to see what happens when elementFormDefault is set to unqualified in WSDL. The generated stub code does not have namespace atttribute in @XmElement annotation. In this case the fields of exception object are all null (my original post talks about this problem). I believe while unmarshalling the fault message, the namespace attribute in SOAP fault message is compared with the annotation and it fails here. When you said its working fine with your sample program, I assume its because of qualified schema. Can you check if it works fine with unqualified also? - Having figured this, I decided to generate the WSDL of my original problem with elementFormDefault set to qualified. I followed the instruction in this post: http://www.nabble.com/xs%3Aschema-attributeFormDefault%3D%22u nqu al if ied%22-elementFormDefault%3D%22unqualified%22-td13604195.html #a1 36 209 04 But I am not
Re: Getting the total size of a DataHandler-type Request Parameter
On Friday 11 January 2008, Glen Mazza wrote: Hello, This question is hard for me to phrase exactly, but for a SOAP request which contains an input parameter which is resolved as a DataHandler by JAX-WS, is there a way to determine the total size in bytes of that DataHandler object? Honestly, not that I know of. :-( Can I rely on any HTTP headers for that information? Unfortunately, no. SOME toolkits will put a Content-Length header into the mime part for each attachment, but others don't. I'm trying to insert the DataHandler-based object into a CLOB column in an Oracle database table. AFAICT inserting CLOBs requires a length parameter, which I don't know because the DataHandler object is resolved as a sizeless InputStream in the service's Java code. This forces us to serialize the InputStream into a file first so I can determine its length, prior to inserting into Oracle. It is this serialization part I'd like to remove if I can. Content-Length might be a possibility, but that would take into account the message as a whole, also, I think with MTOM chunking/multiple sends occurs so the value of C-L wouldn't necessarily map to the size of the DataHandler object. Overall, I'd just like to confirm here that there is nothing much I can accurately rely on within JAX-WS to get the DataHandler size. Nope. -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
Re: More than one Element in Request Wrapper?
You've hit a known bug in XmlSchema: https://issues.apache.org/jira/browse/WSCOMMONS-273 We're waiting for a new version of XmlSchema to be released that fixes that bug (and a bunch of others we reported). Dan On Friday 11 January 2008, ben27 wrote: Hi everyone, I have a simple question for someone who is familiar with CXF. I try to add annotations to a method that contains three selfdefined datatypes: init(SessionId sid, DataTyp dt, DataTyp2 dt) How can I annotate them in the RequestWrapper to get a correct WSDL? I also tried to create something like a wrapperClass, but I always get an error when I try to start the service: INFO: Creating Service {http://xxx.de/}xxxService from class de.xxx.xxxService Exception in thread main org.apache.ws.commons.schema.constants.Enum$EnumValueException: Bad Enumeration value 'extension restriction' Can anybody help me? Regards, Benjamin -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
Re: MTOM trivial case
Benson Margulies wrote: I want to use MtoM to ship non-XML-1.0 text. So, I'd just as soon declare String properties, not DataHandlers. Does anyone know if this is likely to work? It should work if you're going WSDL-first - define your element as type xsd:base64Binary and add xmime:expectedContentType=text/plain. Starting from Java it didn't quite work for me. With: String myMethod(@XmlMimeType(text/plain) String myParam) the generated schema had the xmime:expectedContentType on myParam but the element type was still xsd:string, so not MTOM-able. It may be more successful if you write your own RequestWrapper class with annotations to force the type to xsd:base64Binary, but I gave up at that point and just made my parameters byte[] instead (the tools I'm passing the data on to are equally happy with an InputStream as with a StringReader). Ian -- Ian Roberts | Department of Computer Science [EMAIL PROTECTED] | University of Sheffield, UK
Re: Use Tomcat
Thanks but I still have problem. Your answers didn't solve my problem Glen Mazza pisze: Note #4 here may also help clarify things for you: http://www.jroller.com/gmazza/date/200710#notes HTH, Glen Am Donnerstag, den 10.01.2008, 23:29 + schrieb Ian Roberts: Pawel Janusz wrote: I want to use this one but not working :( jaxws:endpoint id=MyServiceService implementor=#MyServiceServiceImpl address=/MyService/ This form works fine for me in Tomcat. Remember that the address is relative to the CXFServlet mapping in your webapp. So with the following in the web.xml for my-webapp: servlet-mapping servlet-nameCXFServlet/servlet-name url-pattern/services/*/url-pattern /servlet-mapping the service appears at http://localhost:8080/my-webapp/services/MyService If you really want it at the top level (http://localhost:8080/MyService) you'd have to put CXF in the ROOT webapp and map it to a url-pattern of /* Ian
Re: cxf jar is empty
Mayank, That's as designed. It's just a manifest jar (jar that has a Manifest with a Classpath: entry that points to all the other jars it needs). (hmm, probably should rename that) The jar you probably want is in distribution/bundle. It is the big jar with everything in it. Dan On Monday 14 January 2008, Mayank Thakore wrote: Hi, I downloaded the src zip of cxf 2.0.3. Did a mvn -Pfastinstall in the root folder. Then did a mvn in the distribution folder. But the cxf-2.0.3-incubator.jar file (inside the resulting apache-cxf-2.0.3-incubator.zip package) does not have any class files inside it ! Its just empty! Only 10KB size (META-INF folder is present). Though it should be about 2.5MB. Has anyone seen this before? If required I will post the build output. It showed all success. Thanks! Mayank -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
Re: How to deploy a CXF WAR file onto JBoss 4.0.5
Also, take a look at: http://cwiki.apache.org/CXF20DOC/appserverguide.html We're trying to document as much about the various app servers as we can there. Dan On Thursday 10 January 2008, Glen Mazza wrote: Am Donnerstag, den 10.01.2008, 05:14 -0800 schrieb Landslide: Glen, I understand that I am facing a challenging problem of class loaders and class loading sequence, specifically for JBoss. As you can see, my CXF WAR has everything it needs to run as I have included ALL jars from CXF lib folder in its WEB-INF\lib. My case is a very simple HelloWorld CXF WAR (the sample from Release 2.0.3) onto JBoss 4.0.5 GA (directly unzipped from JBoss download without adding any additional jar). In other words, it would be very easy for you or anyone else to reproduce the errors. Not really...I don't know much about JBoss, I've never installed it. I would be doing the same guesswork as you in trying to fix the problem, and app server debugging generally falls outside the scope of a volunteer committer. I do know from experience that there are frequently initial classpath headaches when moving to a new application server. Activating classpath loading logging (assuming JBoss has it, like Oracle App Server does) might help. IIRC, also JBoss *might* be having a problem with the geronimo*.jar files there--I'm not really sure if that's it though. I would check the JBoss forums--search for CXF--and see if anyone's had any problems or solutions. Glassfish Metro is another option if you continue to have absolutely no luck with CXF on JBoss. Sorry, Glen PS: If you do find a solution, please respond back so it will be stored in the email archives, to help others in the future. -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
Re: Documentation for AbstractPhaseInterceptor
Thanks for pointing this out. I've just committed new javadoc to fix this. Thanks! Dan On Sunday 13 January 2008, Mayank Thakore wrote: Hi, The API doc for AbstractPhaseInterceptor.getAfter() and getBefore() are reversed. The doc for getAfter() says: Returns a set of IDs specifying the interceptors that should be run after this interceptor. But actually, it returns a set of IDs specifying the interceptors after which this interceptor should be run. The description is correct in the user guide at http://cwiki.apache.org/confluence/display/CXF20DOC/Interceptors It says: You can also express that you would like your interceptor to run before/after certain other interceptors in the same phase Regards Mayank -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
Re: how to include cxf-2.0.2-incubator.jar in maven
Monoj, Most likely, you want to use: dependency groupIdorg.apache.cxf/groupId artifactIdcxf-bundle/artifactId version2.0.3-incubator/version /dependency The cxf-bundle artifact is what is renamed into the cxf-version.jar thing when the distribution is packaged. Dan On Friday 11 January 2008, Patidar, Manoj wrote: Hi, I am new to cxf and i want to incldue cxf-2.0.2-incubator.jar in my pom.xml when i added following code in pom.xml it does not compile. dependency groupIdorg.apache.cxf/groupId artifactIdcxf/artifactId version2.0.2-incubator/version /dependency actually my purpose is to include cxf-2.0.2-incubator.jar Downloading: http://people.apache.org/repo/m2-incubating-repository/org/apac xf/cxf/2.0.2-incubator/cxf-2.0.2-incubator.jar Downloading: http://repo1.maven.org/maven2/org/apache/cxf/cxf/2.0.2-incubato f-2.0.2-incubator.jar [INFO] - [ERROR] BUILD ERROR [INFO] - [INFO] Failed to resolve artifact. Missing: -- 1) org.apache.cxf:cxf:jar:2.0.2-incubator Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=org.apache.cxf -DartifactId=cxf \ -Dversion=2.0.2-incubator -Dpackaging=jar -Dfile=/path/to/file Alternatively, if you host your own repository you can deploy the file there mvn deploy:deploy-file -DgroupId=org.apache.cxf -DartifactId=cxf \ -Dversion=2.0.2-incubator -Dpackaging=jar -Dfile=/path/to/file \ -Durl=[url] -DrepositoryId=[id] Path to dependency: 1) kaiser:process:jar:1.2.2-SNAPSHOT 2) org.apache.cxf:cxf:jar:2.0.2-incubator -- 1 required artifact is missing. thanks Manoj -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
Re: Some basic question on wsdl generated services
On Thursday 10 January 2008, Mayank Thakore wrote: 1. If we generate service implementation objects using wsdl2java, is it possible to avoid it referring back to the wsdl file in the annotations? Per spec, no. However, there is a -wslLocation flag on the wsdl2java to make it output something different. One usage is to generate based on locations in your build system, but make the annotation say WEB-INF/wsdl or something which is it's packaged location in the war. 2. The generated implementation mentions the port name in the annotations. So how can we use the same implementation for two ports (say one http, other jms)? Will we have to delegate the calls to some common class? Again, per spec (as sucky as that sounds). You can get around that via spring configuration though. The jaxws:server/endpoint stuff does have flags to override the serviceName and such. Dan Thanks! Regards Mayank ** ** This e-mail and attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient's) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it! -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
Re: Crash in REST mode in CXF 2.0.3
Switching to a 1.5.0 JDK would probably fix it.The version of JAXB found in 1.6.0 is a bit older than the version we ship. You MIGHT be able to put the jaxb jars into the jre/lib/endorsed dir to get it working. Not really sure though. Dan On Monday 14 January 2008, Julian Morrison wrote: I'm using Maven to get cxf-bundle-2.0.3 and I've been unable to get the REST mode to work properly. The error appears to be javax.xml.bind.JAXBException: property com.sun.xml.bind.defaultNamespaceRemap is not supported This is on java 1.6.0_03. Sample class that causes an error: import java.util.*; import org.apache.cxf.endpoint.Server; import org.apache.cxf.jaxws.JaxWsServerFactoryBean; import org.apache.cxf.service.invoker.BeanInvoker; public class Bob { public static void main(String... args) { try { JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(); sf.setServiceClass( Bob.class ); sf.setAddress( http://localhost:/; ); sf.getServiceFactory().setInvoker( new BeanInvoker( new Bob() ) ); Server server = sf.create(); server.start(); } catch (Throwable t) { dump(t); } } private static void dump(Throwable t) { System.err.println(t.toString()); for (StackTraceElement e : t.getStackTrace()) System.err.println(e); Throwable cause = t.getCause(); if (cause != null) { System.err.println(Caused by:); dump(cause); } } public String getGreeting() { return Hello!; } public ListString getColors() { String[] a = red,orange,yellow,green,blue,violet.split( , ); return Arrays.asList( a ); } } Sample error: 14-Jan-2008 13:26:19 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass INFO: Creating Service {http://unknown.namespace/}BobService from class Bob org.apache.cxf.service.factory.ServiceConstructionException org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:19 7) org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServi ceFromClass(ReflectionServiceFactoryBean.java:293) org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initialize ServiceModel(ReflectionServiceFactoryBean.java:333) org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(Ref lectionServiceFactoryBean.java:151) org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServi ceFactoryBean.java:93) org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoin t(AbstractWSDLBasedEndpointFactory.java:74) org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.jav a:108) org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryB ean.java:147) Bob.main(Bob.java:18) Caused by: javax.xml.bind.JAXBException: property com.sun.xml.bind.defaultNamespaceRemap is not supported com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFacto ry.java:52) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j ava:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess orImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210) javax.xml.bind.ContextFinder.find(ContextFinder.java:381) javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574) org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContext(JAXBDataBinding. java:369) org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:18 0) org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServi ceFromClass(ReflectionServiceFactoryBean.java:293) org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initialize ServiceModel(ReflectionServiceFactoryBean.java:333) org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(Ref lectionServiceFactoryBean.java:151) org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServi ceFactoryBean.java:93) org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoin t(AbstractWSDLBasedEndpointFactory.java:74) org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.jav a:108) org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryB ean.java:147) Bob.main(Bob.java:18) -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
Re: exposed methods with Aegis binding
On Thursday 10 January 2008, Nacharya wrote: We have used the ServerFactoryBean with Aegis databinding and the exclude annotation didn't work. How can we get this simple annotation to work? The @WebMethod(ignore = true) stuff is a jaxws thing. Thus, you would need to use the JaxwsServerFactoryBean and have it setup as a jaxws service. (you can use the aegis databinding with the jaxws frontend) -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
How to put generated Exception Class in the same package as FaultDetail class
In sample/wsdl_first, PingMeFault is in the same package as interface Greeter. The generated FaultDetail is in a sub level of types. Is there a way to put PingMeFault in the same package as FaultDetail? When annotating PingMeFault, I put it in types level. /// package org.apache.hello_world_soap_http.types; @WebFault(name = faultDetail, targetNamespace = http://apache.org/hello_world_soap_http/types;) public class PingMeFault extends Exception { public static final long serialVersionUID = 20071220101738L; ... } But when generating code, a PingMeFault.java will be generated in org.apache.hello_world_soap_http while FaultDetail.java goes to org.apache.hello_world_soap_http.types. -- View this message in context: http://www.nabble.com/How-to-put-generated-Exception-Class-in-the-same-package-as-FaultDetail-class-tp14813672p14813672.html Sent from the cxf-user mailing list archive at Nabble.com.
Re: marshallerProperties setter missing in org.apache.cxf.jaxb.JAXBDataBinding
Brent, There aren't getter/setters for the marshallerProperties. I just added them.I'll get that merged to 2.0.4. Thanks for reporting it. Dan On Thursday 10 January 2008, bdm wrote: All, I am trying to set an xml processing instruction in the result from a web service call. I have gone through the JAXB instructions in the user guide and have not been able to set the marshallerProperties property on the JAXBDataBinding class. In looking at the code in SVN it seems that there is a setter for contextProperties in the JAXBDataBinding class, but not one for marshallerProperties even though the map is created in the class. Am I missing something? I have tried both the 2.0.4 and 2.1 snapshot versions of the jars but still no initialization works. This context file initializes correctly (modified version of the sample from the web page): ...snip... jaxws:endpoint id=PersonRestService implementor=#PersonRestServiceImpl address=/PersonRest bindingUri=http://apache.org/cxf/binding/http; jaxws:serviceFactory bean class=org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean property name=wrapped value=true/ property name=dataBinding bean class=org.apache.cxf.jaxb.JAXBDataBinding property name=contextProperties map entry keyvaluecom.sun.xml.bind.defaultNamespaceRemap/value/key valueuri:ultima:thule/value /entry /map /property /bean /property /bean /jaxws:serviceFactory /jaxws:endpoint ...snip... This one doesn't work - Spring throws the error below: ...snip... jaxws:endpoint id=PersonRestService implementor=#PersonRestServiceImpl address=/PersonRest bindingUri=http://apache.org/cxf/binding/http; jaxws:serviceFactory bean class=org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean property name=wrapped value=true/ property name=dataBinding bean class=org.apache.cxf.jaxb.JAXBDataBinding property name=marshallerProperties map entry keyvaluecom.sun.xml.bind.xmlHeaders/value/key value![CDATA[?xml-stylesheet type=text/xsl href=test.xsl?]]/value /entry /map /property /bean /property /bean /jaxws:serviceFactory /jaxws:endpoint ...snip... Spring throws this error: 14:37:17,194 ERROR main [[/personService]] Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean' defined in URL [file:/opt/workspace/personService-cxf-ws/target/personService-ws/WEB- INF/classes/serviceContext.xml]: Cannot create inner bean 'org.apache.cxf.jaxb.JAXBDataBinding#c0f654' while setting bean property 'dataBinding'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.jaxb.JAXBDataBinding#c0f654' defined in URL [file:/opt/workspace/personService-cxf-ws/target/personService-ws/WEB- INF/classes/serviceContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'marshallerProperties' of bean class [org.apache.cxf.jaxb.JAXBDataBinding]: Bean property 'marshallerProperties' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.jaxb.JAXBDataBinding#c0f654' defined in URL [file:/opt/workspace/personService-cxf-ws/target/personService-ws/WEB- INF/classes/serviceContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'marshallerProperties' of bean class [org.apache.cxf.jaxb.JAXBDataBinding]: Bean property 'marshallerProperties' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'marshallerProperties' of bean class [org.apache.cxf.jaxb.JAXBDataBinding]: Bean property 'marshallerProperties' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type
Re: CXF interceptor equivalent for LogicalHandler?
Glen, Technically, any interceptor that is run AFTER the ReadHeadersInterceptor would be very roughly equivilent. The ReadHeadersInterceptor reads all the soap headers (if there) and and advances the XMLStreamReader into the SOAP:Body. Thus, it's positioned at the start of the logical data. An interceptor could grab that, do whatever with the logical data, and create a new XMLStreamReader to represent their new data. Dan On Thursday 03 January 2008, Glen Mazza wrote: Hello, I am trying to understand any architectural correspondances between JAX-WS Handlers[1] and CXF interceptors. I can see from the interceptor page[2] that a JAX-WS SOAP protocol handler more or less maps to a CXF AbstractSoapInterceptor. I was wondering if there is an counterpart to the JAX-WS LogicalHandler for an interceptor? Thanks, Glen [1] http://java.sun.com/mailers/techtips/enterprise/2006/TechTips_June06.h tml [2] http://cwiki.apache.org/CXF20DOC/interceptors.html -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
Re: override binding name
On Friday 11 January 2008, fox_lubiky wrote: The documentation (http://cwiki.apache.org/CXF20DOC/jax-ws-configuration.html) says you can provide your own binding factory: Hm... I think that page is wrong. The jaxws:binding points to a BindingConfiguration object. It allows you to provide a bean that will be used to provide default configuration for the binding. Unfortunately, the binding name isn't one of them right now. I've just committed a change on trunk that would allow you to configure this. If you create a bean of type org.apache.cxf.binding.soap.SoapBindingConfiguration, you should be able to set either the bindingName (type QName) or the bindingNamePrefix (String) property on it. I'll try and get that merged into 2.0.4. Dan You can specify the BindingFactory for this endpoint to use. This can be supplied using the Spring bean class=MyBindingFactory/ syntax. Like this: jaxws:binding bean class='...MySoapBindingFactory'/ /jaxws:binding However, that gives the error: Cannot convert value of type [demo.spring.NamedSoapBindingFactory] to required type [org.apache.cxf.binding.BindingConfiguration] for property 'bindingConfig' Another possibility I'm considering is an interceptor that rewrites the WSDL returned to the client. Any suggestions on the correct way to handle this? Thanks, mnereson wrote: Is there a way to override the binding name property? For example service xmlns=http://xfire.codehaus.org/config/1.0; nameMyFulfillmentService/name serviceClass com.myco.myapp.MyFulfillmentServiceImpl /serviceClass serviceFactory#jsr181ServiceFactory/serviceFactory /service Results in a binding named MyFulfillmentServiceHttpBinding The wsdl shows wsdl:binding name=MyFulfillmentServiceHttpBinding type=tns:MyFulfillmentServicePortType ... /wsdl:binding However, Our lightweight enterprise service bus requires the binding name to be SomethingSoapBinding so I need MyFulfillmentServiceSoapBinding. My current configuration uses annotations and resembles the following: === services.xml === beans bean name=jsr181ServiceFactory class=org.codehaus.xfire.annotations.AnnotationServiceFactory constructor-arg ref=xfire.transportManager type=org.codehaus.xfire.transport.TransportManager index=0/ constructor-arg ref=config index=1 type=org.codehaus.xfire.aegis.type.Configuration/ /bean bean id=config class=org.codehaus.xfire.aegis.type.Configuration property name=defaultNillable value=true/ property name=defaultMinOccurs value=1/ /bean service xmlns=http://xfire.codehaus.org/config/1.0; nameMyFulfillmentService/name serviceClass com.myco.myapp.MtFulfillmentServiceImpl /serviceClass serviceFactory#jsr181ServiceFactory/serviceFactory /service /beans == web.xml == web-app servlet servlet-nameXFireServlet/servlet-name display-nameXFire Servlet/display-name servlet-class org.codehaus.xfire.transport.http.XFireConfigurableServlet /servlet-class /servlet servlet-mapping servlet-nameXFireServlet/servlet-name url-pattern/services/*/url-pattern /servlet-mapping /web-app == excerpts RemoteFulfillmentServiceImpl.java == import javax.jws.WebMethod; import javax.jws.WebService; @WebService public class MyFulfillmentServiceImpl implements MyFulfillmentService { // various private methods @WebMethod public String soemPublicMethod(final int someId) { // maybe a couple lines of code } } Thanks for the help. ~ mnereson -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
Re: WS-SecureConversation and WS-SecurityTrust
On Thursday 10 January 2008, Davide Gesino wrote: I've read a post on ws-* advanced features in future CXF versions. These features are not present in the JIRA, so I guess these features will not be in CXF 2.1. Are these features definitively shifted to future versions? Most likely yes unless someone jumps in real soon to start working on it. :-( A couple of folks that thought they would have time to do it got pulled into other things (work commitments) and thus didn't have time to even start on it. -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
Re: STP plugin handle parameters name different for wrapped/bare style
Both of them should have been generated as arg0/arg1. Not sure why the BARE mode would have been different. In anycase, the sollution is to annotate the params with @WebParam annotations: public java.lang.String sayHi( @WebParam(name = text java.lang.String text, @WebParam(name = info demo.spring.ProfileInfo info ); Dan On Wednesday 09 January 2008, yulinxp wrote: The wsdl generated using SOAPBinding.ParameterStyle.BARE will have text/info as parameter name, while wsdl generated using wrapped only shows arg0/arg1. Then when writing the client code, I will see (String arg0,...) when using Eclipse parameter hit. Is there a way to make wrapped wsdl use parameter name instead of arg01? //interface public interface HelloWorld { public java.lang.String sayHi( java.lang.String text, demo.spring.ProfileInfo info ); } //bare xs:element name=text nillable=true type=xs:string/ name=text xs:element name=info nillable=true type=profileInfo/ name=info wsdl:message name=sayHi wsdl:part name=text element=tns:text/wsdl:part wsdl:part name=info element=tns:info/wsdl:part /wsdl:message wsdl:portType name=HelloWorld wsdl:operation name=sayHi wsdl:input name=sayHi message=tns:sayHi/wsdl:input /wsdl:operation /wsdl:portType //wrapped xsd:element name=sayHi type=tns:sayHi/ xsd:complexType name=sayHi xsd:sequence xsd:element minOccurs=0 name=arg0 type=xsd:string/ name=arg0 xs:element minOccurs=0 name=arg1 type=profileInfo/ name=arg1 /xsd:sequence /xsd:complexType wsdl:message name=sayHi wsdl:part name=parameters element=tns:sayHi /wsdl:part wsdl:portType name=HelloWorld wsdl:operation name=sayHi wsdl:input name=sayHi message=tns:sayHi/wsdl:input /wsdl:operation /wsdl:portType -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
RE: ABR Communication Pattern
Well, it didn't work. The interceptors mutate the message and won't process the mutated one. So I am going to try changing the JMSDestination.incoming code to resend the message as many times as required. Any thoughts? Regards Mayank -Original Message- From: Mayank Thakore [mailto:[EMAIL PROTECTED] Sent: Sunday, January 13, 2008 23:09 To: cxf-user@incubator.apache.org Subject: ABR Communication Pattern Hi, I was trying to achieve Asynchronous Batch Response (ABR) pattern with CXF for JMS transport. ABR means user can send multiple responses to a single request. Please read this and let me know what you think. Hazard info: I haven't finished the client for this yet, so don't know wheather it is working. It does print the cxf logs correctly. Below is my interceptor code. It attaches to the end of the interceptor chain and executes the previous two interceptors which invoke the service implementation and send the out message respectively. == package ws.v1.tmf854; import java.util.ListIterator; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; public class ABRInterceptor extends AbstractPhaseInterceptorMessage { public ABRInterceptor() { super(Phase.POST_INVOKE); getAfter().add( org.apache.cxf.interceptor.OutgoingChainInterceptor.class .getName()); } @Override public void handleMessage(Message message) throws Fault { System.out.println(ABRInterceptor invoked); if (ABRSession.isEnabled()) { executeReRuns(message); } } private void executeReRuns(Message message) { ListIteratorInterceptor? extends Message iterator = prepareReRunIterator(message); while (ABRSession.isEnabled()) { ABRSession.disable(); for (int i = 0; i 2; i++) { iterator.previous(); } for (int i = 0; i 2; i++) { Interceptor currentInterceptor = iterator.next(); currentInterceptor.handleMessage(message); } } } private ListIteratorInterceptor? extends Message prepareReRunIterator( Message message) { ListIteratorInterceptor? extends Message iterator = message .getInterceptorChain().getIterator(); while (iterator.hasNext()) { iterator.next(); } iterator.previous(); return iterator; } } == Below is the session control device. It uses a thread local variable to remember if ABR session is enabled or disabled. == package ws.v1.tmf854; public class ABRSession { private static ThreadLocalBoolean status = new ThreadLocalBoolean() { @Override protected synchronized Boolean initialValue() { return new Boolean(false); } }; public static synchronized boolean isEnabled() { return status.get().booleanValue(); } public static synchronized void disable() { System.out.println(Disabling ABRSession); status.set(new Boolean(false)); } public static synchronized void enable() { System.out.println(Enabling ABRSession); status.set(new Boolean(true)); } } == So, if user wants ABR mode, they just need to invoke ABRSession.enable() inside the service implementation. Here is the server main for completion: == package ws.v1.tmf854; import javax.xml.ws.Endpoint; import org.apache.cxf.jaxws.EndpointImpl; /** * This class was generated by Apache CXF (incubator) 2.0.3-incubator Sat Jan 12 * 11:10:39 IST 2008 Generated source version: 2.0.3-incubator * */ public class AlarmRetrieval_AlarmRetrievalJms_Server { protected AlarmRetrieval_AlarmRetrievalJms_Server() throws Exception { System.out.println(Starting Server); Object implementor = new AlarmRetrievalImpl(); String address = jms://; EndpointImpl ep = (EndpointImpl) Endpoint.publish(address, implementor); ep.getServer().getEndpoint().getInInterceptors().add(
RE: cxf jar is empty
Thank you! Regards Mayank -Original Message- From: Daniel Kulp [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 15, 2008 00:32 To: cxf-user@incubator.apache.org Cc: Mayank Thakore Subject: Re: cxf jar is empty Mayank, That's as designed. It's just a manifest jar (jar that has a Manifest with a Classpath: entry that points to all the other jars it needs). (hmm, probably should rename that) The jar you probably want is in distribution/bundle. It is the big jar with everything in it. Dan On Monday 14 January 2008, Mayank Thakore wrote: Hi, I downloaded the src zip of cxf 2.0.3. Did a mvn -Pfastinstall in the root folder. Then did a mvn in the distribution folder. But the cxf-2.0.3-incubator.jar file (inside the resulting apache-cxf-2.0.3-incubator.zip package) does not have any class files inside it ! Its just empty! Only 10KB size (META-INF folder is present). Though it should be about 2.5MB. Has anyone seen this before? If required I will post the build output. It showed all success. Thanks! Mayank -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
RE: Issues with JSON based Service and Jettison
First of all, you need to set wrapped style to false, wrapped style true won't work with JSON (I noticed that you already set wrapped to false). What happened is Jettison reads input stream to a W3C Document, then this W3C Document is used to create a new XMLInputStream. From this point on, the following CXF interceptors will presume they are deal with a normal XML input e.g. the XML section embedded in a soap body. Let's take a concrete example. An inputstream of {acme.Book:{acme.name:CXF in Action }} is transferred to a org.w3c.dom.Document of BooknameCXF in Action/name/Book by Jettison first, then the Document object will be marshaled to a Book object. The wrapper I am talking about is referring to the operation name wrapper of doc-lit wrapped style. For example, if you set wrapped style to true, in order to marshal the Document to Book object successfully, the Document's content need to be addBook BooknameCXF in Action/name/Book/addBook instead. Cheers, Jervis -Original Message- From: Vespa, Anthony J [mailto:[EMAIL PROTECTED] Sent: 2008年1月14日 21:32 To: cxf-user@incubator.apache.org; cxf-user@incubator.apache.org Subject: RE: Issues with JSON based Service and Jettison Hrm, could you explain a bit more please? I was under the impression from various examples that JSON would behave like REST, eg I pass a request in a URL and the response comes back as a JSON output (eg I have a method called getMessage and it takes 3 params) so I pass it message/1/2/3/ and the output is in JSON forma- by the request wrapper you mean that I would need to pass it one object (say, a hashmap) and unwrap that object, as that is how the JSON inbound request is represented, correct? I was under the perhaps mistaken impression that JSON was extracting the values from the inbound JSON array and matching them with the arguments via Jettison. From: Liu, Jervis [mailto:[EMAIL PROTECTED] Sent: Sun 1/13/2008 5:00 AM To: cxf-user@incubator.apache.org Subject: RE: Issues with JSON based Service and Jettison According to the stack trace, it looks like your service method has more than one parameters. The CXF HTTP binding requires that the service method can only have one input parameters. For example, following is invalid: @Put @HttpResource(location = /books/{id}) void updateBook(@WebParam(name = Book)Book c, int id); Hope this helps, Jervis -Original Message- From: Vespa, Anthony J [mailto:[EMAIL PROTECTED] Sent: 2008?1?13? 10:33 To: cxf-user@incubator.apache.org; cxf-user@incubator.apache.org Subject: RE: Issues with JSON based Service and Jettison I actually tried the jax_rs samples a week or two back and it caused quite a few issues with our codebase, as well as generally not working - it would also require re-writes of all services, but even just re-writing one I get exceptions and other issues - there was also some odd behavior, like not being able to pass any data type but a String, for example, as any arguement. Has anyone got a good detailed example of getting JSON to work from end to end, with submitting a JSON formatted input into a service, and getting appropriate output, with a configuration through beans.xml? I can get the simple examples to work with some futzing around, but I'm doing to send some complex input back and forth I've scanned through the mailing list and searched the web, but I haven't found much info - the docs for jettison tend to give the same general example and I need something specific - or at least a hard enough push to know if it is a configuration issue, or if I am trying to do something that is either crazy or not supported. From: Liu, Jervis [mailto:[EMAIL PROTECTED] Sent: Sat 1/12/2008 11:36 AM To: cxf-user@incubator.apache.org Subject: RE: Issues with JSON based Service and Jettison Grab a latest snapshot of CXF, check out the samples\jax_rs\content_negotiation demo. The spring configuration can be found in [1]. An example of using JSON to do post can be found in system test: trunk\systests\src\test\java\org\apache\cxf\systest\jaxrs\JAXRSClientServer BookTest.java [1]. http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html Cheers, Jervis -Original Message- From: Vespa, Anthony J [mailto:[EMAIL PROTECTED] Sent: 2008?1?12? 1:43 To: cxf-user@incubator.apache.org Subject: Issues with JSON based Service and Jettison Hello, I cannot seem to get a JSON based servive to work properly. Does anyone have a complete end to end example using the spring config to set up jettison? Ideally I want to be able to use a post or a get to a service using JSON both on request and response. I am accessing the service via /message/ABC123DEF456/4 I am using Jettison and am getting the following exceptions: Jan