Re: Mapping correctly a array type in a bean
@Praveen Peddi it's not a work around or another hack. No use any patch. I able to see also the childs. I am working on a project with DB and Hibernate Framework. In the DB there are 32 tables and so many relationships together. Before to find that mapping practice Axis couldn't see all the childs. Right now it can. And my web services run very well. So it's the right way for mapping an array in a bean. Look at the stubs generated by WSDL2Java. If you find a bean which begins by ArrayOf... it's means you don't map correctyl the an array. --- Sebastien On Fri, 18 Feb 2005 10:23:09 -0500, Praveen Peddi [EMAIL PROTECTED] wrote: Wow!. I did this and it fixed my problem. I didn't have to use the Eric's patch that I mentioned in another thread yesterday. I am able to see the child containers fine. Is this type of bean definition OK? I mean I just want to make sure its not a hack or anything. If this is the right way to define array of objects in a bean, then I think this is the way to go for me. Thanks Sebastien and all others. Praveen - Original Message - From: Sebastien Mayemba Mbokoso [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 17, 2005 4:45 PM Subject: Mapping correctly a array type in a bean Hi all, here is what i noticed today in work in Axis. This for sample the beans i used : public class A { //some getters/setters } public class B { //some getters/setters A[] a; public A[] getA() { return this.a} public void setA(A[] a) { this.a = a} } When i use the Axis Ant Task for generating WSDL and after my stubs, i noticed in the WSDL file that Axis can't map correctly the array includes the bean of type B.Axis to guess itself the correct type and generate something like that : ArrayOf_xsd ... That's wrong. So how can we have the correct type for avoiding that mistake. It's simple. We just have tp some 2 another getters in B like that : public class B { //some getters/setters A[] a; public A[] getA() { return this.a; } public void setA(A[] a) { this.a = a; } public A getA(int i) { return this.a[i]; } public void setA(int i, A anA) { this.a[i] = anA; } } Adding that 2 more getters offer us the possibility to obtain the good type in the WSDL and the good generated beans. - Sebastien
Re: Deploy problems - any thoughts please
Do you are trying to deploy some beans which contains another beans which contains another beans etc. I don't know exactly what Axis perform for discovering relationships in the beans. But i think it uses reflection or instrospection. Maybe there is no end in your relationship ! Maybe you have to indicate explicitly when Axis has to stop its reflection -- Sebastien On Wed, 16 Feb 2005 17:30:34 -0800 (PST), Samisa Abeysinghe [EMAIL PROTECTED] wrote: I get a SOAP fault when trying to deploy wsdd with AdminClient. No clue why this is happening. I have the classes on my CLASSPATH. Appriciate any help. Details below. Thanks, Samisa... Processing file ca/deploy.wsdd Exception: AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: java.lang.reflect.InvocationTargetException faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: java.lang.reflect.InvocationTargetException faultActor: faultNode: faultDetail: java.lang.reflect.InvocationTargetException at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:223) at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:130) at org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1053) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at javax.xml.parsers.SAXParser.parse(SAXParser.java:345) at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:218) at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:568) at org.apache.axis.Message.getSOAPEnvelope(Message.java:427) at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:701) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:93) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:144) at org.apache.axis.client.Call.invokeEngine(Call.java:2688) at org.apache.axis.client.Call.invoke(Call.java:2671) __ Do you Yahoo!? Yahoo! Mail - Easier than ever with enhanced search. Learn more. http://info.mail.yahoo.com/mail_250
Re: Custom Deserializer/typeMapping problem
Mike, if you want to use your own serializer/deserializer try to adapt this tutorial : http://www-106.ibm.com/developerworks/webservices/library/ws-castor/ They do a data binding with castor. So they need to integrate in their WSDD and the generate stubs Castor serializer/deserializer. Look at what they do. Sebastien On Fri, 18 Feb 2005 09:30:30 +0900, Bill Keese [EMAIL PROTECTED] wrote: Since you are in wrapped/literal mode shouldn't the encoding style be ? Or you could try using beanMapping rather than typeMapping. Also, the msgT tag looks strange. It seems unnecessary but if you do add then I think you need a deserializer for that structure too. Mike Cassisa wrote: I am having a problem getting my Deserializer to be used after registering it's Factory with the typeMapping element in the dd. I have tried many different combinations but regardless of what I do the SimpleDeserializer is selected. I believe this is happening because axis is interpreting the entire message as a String instead of my desired type. I am somewhat new to axis so any help from those of you who really understand the framework would be much appreciated. There have been several similar threads on this with this one being the closest to my problem, however the solution needs to be on the server not the client: List: axis-user Subject:(resolved) RE: deserializing nested complex types From: Mitch Gitman mgitman () usa ! net Date: 2002-12-06 21:36:19 From my dd: typeMapping qname=baldue:BalanceDueMsg xmlns:baldue=http://balancedue.websvc.csp.leapwireless.com; languageSpecificType=java:com.leapwireless.csp.websvc.balancedue.BalanceDueMsgType serializer=com.leapwireless.csp.websvc.balancedue.axis.BalanceDueSerializerFactory deserializer=com.leapwireless.csp.websvc.balancedue.axis.BalanceDueDeserializerFactory encodingStyle=http://schemas.xmlsoap.org/soap/encoding// My web service class' relevant method signature (this is a java rpc service): public BalanceDueMsgType getBalanceDue(BalanceDueMsgType msgT) I am using JDK 1.4.2, JBoss 3.2.5/JBoss.Net/Axis 1.1 Basically my DeserializerFactory/Deserializer never gets a chance to deal with the incoming request message (java rpc web service). The SimpleDeserializer always gets these and returns a this error when dealing with the nested type in the message: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize. I set a breakpoint in the Eclipse debugger in the SimpleDeserializer onChildElement method (which throws the exception) and this is what the variables look like in that method: this= SimpleDeserializer (id=212) activeDeserializers= HashSet (id=229) attributeMap= null cacheStringDSer= null cacheXMLType= null componentsReadyFlag= false constructor= Constructor (id=236) defaultType= null id= null isEnded= false isHref= false isNil= false javaType= Class (java.lang.String) (id=200)//Based on other problems like this one I believe the problem is here, i.e. axis thinks this is a string type. myElement= null myElements= null myIndex= 0 propertyMap= null targets= Vector (id=241) typeDesc= null val= CharArrayWriter (id=246) value= null xmlType= QName (id=249) localPart= string namespaceURI= http://www.w3.org/2001/XMLSchema; namespace= http://balancedue.websvc.csp.leapwireless.com; localName= BalanceDueMsg prefix= attributes= NullAttributes (id=205) context= DeserializationContextImpl (id=213) Most interesting here are the values of the namespace and localName local variables (which are the ones I want) and the value of the SimpleDeserializer.javaType field which is set to a String when it should be BalanceDueMsgType. Based on the debugger variables above, the value of the curElement field inside of the context variable has this data (which is what was intended): BalanceDueMsg xmlns=http://balancedue.websvc.csp.leapwireless.com; accountNumACCOUNTNUMBER/accountNum sessionIdSTRING/sessionId balanceData/ /BalanceDueMsg The client I am using is a little gizmo in Oxygen XML that prepares the raw xml so you can edit it manually and then sends it so I am not using any wsdl2java
Re: Is there a way to get the auto-generated WSDL document at compile time?
@Jay Do you try to perform all the needed process. I am talking about using first Java2WSDL and after WSDL2Java. Maybe if you use the right options in the first step (Java2WSDL) the generated WSDD shall be the same that you already created ? I strongly think the more difficult in the Axis Ant Task it's to put the right options. -- Sebastien On Thu, 17 Feb 2005 20:20:19 -0500, Jay Glanville [EMAIL PROTECTED] wrote: Just checking to see if anyone had an answer for this question ... JDG From: Jay Glanville [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 15, 2005 11:15 AM To: [EMAIL PROTECTED] Subject: Is there a way to get the auto-generated WSDL document at compile time? Hello all. We have a web application that is configured through the server-config.wsdd file. The resulting WSDL file is auto-generated for us by Axis (i.e.: http://localhost/app_ctx/services/webservice?wsdl). So far, everything is working out rather well for us. What we would like to do next is have the WSDL document generated at compile time, not run time. In other words, we currently have to start our service in order to get a WSDL file, but we'd like to simply get it generated for us without having to run it. I've investigated using Java2WSDL, but I'm under the understanding that it doesn't take the WSDD into consideration. It's in the WSDD that we have all of our bean mapping entries, and thus our WSDL depends on our WSDD's contents. Is there a way to get Axis to perform the auto-generate WSDL at compile time? Thanks JDG --- Jay Glanville
Re: forcing registration of serializer/deserializer for beans that do not appear directly as args
@Tim If you follow what i said in a first email on how to properly map an array bean (Bean[]) in the Bean. The explicit type mapping in the WSDD doesn't appear the next time. I am using Axis web service with that options : provider=java:RPC style=wrapped use=literal Sebastien On Thu, 17 Feb 2005 13:45:31 -0800, Tim K. (Gmane) [EMAIL PROTECTED] wrote: OK, it worked without doing anything special for the array. The extra classes are included in the wsdd and it works, but if a Bean[] appears explicitly as an argument of a method there's also an explictit type mapping in the wsdd for the Bean[], but not when using --extraClasses. It works, but I am curios why the difference. Thanks for your tip. Tim Sebastien Mayemba Mbokoso wrote: I think u don't need to include anything special for your arrays. Generate all your stubs with the task WSDL2Java and look at in the deploy.wsdd if the extra classes are mapped. - Sebastien On Wed, 16 Feb 2005 12:12:53 -0800, Tim K. (Gmane) [EMAIL PROTECTED] wrote: Yes, I do. Ah, I missed the --extraClasses option ... Do I need to also include anything special for the arrays to work (e.g.a B[] in addition to B)? Thanks. Tim Sebastien Mayemba Mbokoso wrote: Do you know all the object types of 'Object o' at run-time ? If you do maybe you can use Java2WSDL with that more option : --extraClasses ? --- Sebastien On Wed, 16 Feb 2005 11:20:24 -0800, Tim K. (Gmane) [EMAIL PROTECTED] wrote: Hello, Using java2wsdl to generate the WSDL from java server side classes, how can I force the registration of a serializer/deserializer for a bean that does not appear directly in the method arguments, e.g.: public A foo(A a) where A is a bean which can contain another bean B and also a bean array B[] but it's not typed (e.g. it's defined as an Object): A { ... Object o; // At run-time this can be B, B[] or other things. ... } The problem is that at run-time the server complains that there is no deserializer for B which makes sense because java2wsdl has never seen B anywhere in the method signatures. The work-around so far has been to add a dummy method that has both B and B[] as arguments, but there's gotta be a nicer way to do it. Thank you for your help. -- Tim
Re: forcing registration of serializer/deserializer for beans that do not appear directly as args
Do you know all the object types of 'Object o' at run-time ? If you do maybe you can use Java2WSDL with that more option : --extraClasses ? --- Sebastien On Wed, 16 Feb 2005 11:20:24 -0800, Tim K. (Gmane) [EMAIL PROTECTED] wrote: Hello, Using java2wsdl to generate the WSDL from java server side classes, how can I force the registration of a serializer/deserializer for a bean that does not appear directly in the method arguments, e.g.: public A foo(A a) where A is a bean which can contain another bean B and also a bean array B[] but it's not typed (e.g. it's defined as an Object): A { ... Object o; // At run-time this can be B, B[] or other things. ... } The problem is that at run-time the server complains that there is no deserializer for B which makes sense because java2wsdl has never seen B anywhere in the method signatures. The work-around so far has been to add a dummy method that has both B and B[] as arguments, but there's gotta be a nicer way to do it. Thank you for your help. -- Tim