JIRA down again
Who should I notify when JIRA is down? Thanks. http://issues.apache.org/jira/ Proxy Error The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET/jira/secure/Dashboard.jspa. Reason: Error reading from remote server Apache/2.0.54 (Unix) mod_ssl/2.0.54 OpenSSL/0.9.7a DAV/2 SVN/1.2.0-dev Server at issues.apache.org Port 80
Re: Blockers for Axis 1.2 Final
I just filed another blocker bug, it's a regression from RC2: http://issues.apache.org/jira/browse/AXIS-1966 Tim Davanum Srinivas wrote: Hi all, FYI, There are 2 last remaining blockers for Axis 1.2 Final: - http://issues.apache.org/jira/browse/AXIS-1838 - http://issues.apache.org/jira/browse/AXIS-1547 I'd encourage everyone to try latest CVS / Nightly ASAP. http://cvs.apache.org/dist/axis/nightly/ http://cvs.apache.org/snapshots/ws-axis/ Thanks, dims
Re: Axis 1.2 RC3 and array deserialization problem
You should file a bug about wsdl2java with an attached example if you want it fixed ... Tim Sergio Bossa wrote: Did you regenerate the client stub using Axis 1.2RC3 wsdl2java? I do not use wsdl2java stubs: it produces a buggy fault implementation, generating a MontagSOAPFault_Element.java class file instead of a MontagSOAPFault class, so I have to correct it by hand, which is very annoying. I posted an help request about this, but nobody answered :-( So, I use Axis API directly, this is a code snippet: String wsdl=http://localhost:8084/montag/services/XQueryService?wsdl;; Service service = new Service(new java.net.URL(wsdl),new QName(http://montag.sourceforge.net/ns/wsdl/local,XQueryServiceService;)); Call call=(Call) service.createCall(new QName(XQueryService)); SOAPHeaderElement username=new SOAPHeaderElement(http://montag.sourceforge.net/ns/wsdl/local,username;); SOAPHeaderElement password=new SOAPHeaderElement(http://montag.sourceforge.net/ns/wsdl/local,password;); username.addTextNode(); password.addTextNode(); call.addHeader(username); call.addHeader(password); call.setOperationName(new QName(http://montag.sourceforge.net/ns/wsdl/local;, query) ); ret = (String) call.invoke( new Object[] { /resources, test { //[EMAIL PROTECTED] } /test, null, new String[]{ts,1113390437052} } ); Is there anything wrong? I tried rebuilding all, but it's always the same. If so, then I would expect it to send a message that looks something like this: namespacests/namespaces vars1113390437052/vars No, namespaces is the first array, vars the second one: 'ts' and '1113390437052' are both elements of the second array, and the first array is null. I hope you'll find the solution. I run out of ideas. Thank you. Regards, Sergio B.
Re: obtaining consumer IP
From the MessageContext you can get the HttpServletRequest and from that the IP: HttpServletRequest req = (HttpServletRequest) msgContext.getProperty(org.apache.axis.transport.http.HTTPConstants.MC_HTTP_SERVLETREQUEST); String ip = req.getRemoteAddr(); However, keep in mind that the IP address may be misleading if the client is going through a proxy or you have a load balancer in front of your server or a caching server, etc. I know in a real production system you will most likely get a local IP address. Also, if you want to do security based on the IP address, keep in mind that IP addresses can be easily spoofed. For this reason I find relying on the IP address to be a bad plan. Tim Robert Gombotz wrote: Hi! I would need to obtain the IP address of clients/consumers that make calls to my Web services, preferably using a SOAP handler. So far, I have not found a way of achieving this. The MessageContext seems to be the only data I have in a handler, and from what I understand it does not contain the client's IP. Any hints and ideas are greatly appreciated. Rob
Re: Axis 1.2 Official Release?
I'm hoping not before at least the blocker bugs are fixed ... http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=truepid=10460priorityIds=1resolutionIds=-1 http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=truepid=10460priorityIds=2resolutionIds=-1 Tim Somerville, Michael S wrote: Group -- Is there any new status on when Axis 1.2 final should be released? Thanks! Michael S. Somerville Systems Engineer
Re: supporting both rpc/encoded and wrapped doc/lit
OK, but if I want to deploy the same service twice once rpc/enc, once wrapped/lit, all I have to do is use different service names in the deploy.wsdd/server-config.wsdd, right? Something like MyService_rpc and MyService_wrapped, but the implementation java class can be the same as long as the proper use and style options are set for each service ... Thanks. Tim Yves Erb wrote: Hello Tim, In Axis 1.2 each Service is bound to a ServiceDesc with Use and Style fields. So they can't support both rpc/enc and wrapped/lit. I think you could use some tricks by patching the source and dynamically attribute providers to process the request message but you will have a problem when you want to show both wsdl at the same time.
supporting both rpc/encoded and wrapped doc/lit
In Axis 1.2 is there an easy way to support both rpc/enc and wrapped/lit for the same set of web services? Or the only way to do it is to generate everything twice and deploy all services twice? Thanks. -- Tim
Re: HELP PLEASE: array inside array and wrapped document/literal
Anne, We already have a lot of server code using these API's (over 200 methods that rely on these constructs that are exposed over WS but also used by various code on the server side, web interface, protocol servers, etc.) It's too late in the development cycle to make such API changes. It would be ideal if Axis worked as we are not doing anything illegal as far as I can tell. This is the bug that I filed, Dims looked at it yesterday, but we don't have a plan yet. http://issues.apache.org/jira/browse/AXIS-1926 Tim Anne Thomas Manes wrote: Is option 2 such as bad thing? But here's a proposed work around -- define a Java object that is an array of NamedValue objects (e.g., suboptions) and use that object as your input parameter rather than specifying an array in the request: NamedValue[] suboptions = new NamedValue[] { new NamedValue("dummy2-1", "val2-1"), new NamedValue("dummy2-2", new Integer(314)) }; NamedValue[] options = new NamedValue[] { new NamedValue("dummy1", "dummy_val1"), new NamedValue("dummy2", suboptions) }; Anne On 4/13/05, Tim K. (Gmane) [EMAIL PROTECTED] wrote: Anne, That makes sense. That's why I kept pushing and asking questions just to make sure what looks like common sense is actually true. So it looks like I would have at least 3 choices here: 1) Define in the schema all possible types ArrayOfXxxx that could occur at run-time. This is less than ideal because errors would not be discovered until run-time, but it could be done with enough testing. Also, the Axis bug would still need to be fixed so that it works at all. 2) Change the definition of the value element of NamedValue to be: xsd:element name="value" type="xsd:anyType" maxOccurs="unbounded"/ But then end up with a generated NamedValue class on the client side whose value is an Object[] instead of Object. The server class would also have to be changed accordingly and that's not really an option at this point as there is *a lot* of code written and it's too late to change it. This is more of a hack than a real solution. 3) Use rpc/encoded instead which I know works well, except for custom exception/fault deserialization in .NET Maybe something custom can be done on the .NET side for this case. Tim Anne Thomas Manes wrote: Well -- actually, you shouldn't be able to send an array of String unless you had previously defined a type which is an array of string. You see -- that what's really going wrong in Tim's application. Consider this point: The "value" element has not been defined to allow multiple occurrences. To make that work, then you would need to define the "value" element like this: xsd:element name="value" type="xsd:anyType" maxOccurs="unbounded"/ But the way it's defined, an options element contains one name element and one value element. You see, this is the really challenging thing about using xsd:anyType. Axis can't generate schema type definitions on the fly (or if it did, it would have to send the schema with the request). Assuming that you had previously defined an ArrayOfString type: xsd:complexType name="ArrayOfString" xsd:sequence xsd:element name="item" type="xsd:string" maxOccurs="unbounded"/ xsd:sequence xsd:complexType Then you should be able to send: NamedValue object: name: "dummy2" value: String[] And on the wire, it would look like this: options namedummy2/name value xsi:type="ns1:ArrayOfString" itemblah/item itemblah/item /value /options On 4/13/05, Tim K. (Gmane) [EMAIL PROTECTED] wrote: Hi Anne, I would be curious to see what the correct message should look like for a String[] as the value of the NamedvAlue, i.e. something like this: NamedValue object: name: "dummy-2" value: String[] options namedummy2/name value xsi:type="." !-- How do you form the String[] in here? -- /value /options Are wrappers always needed in this case? Thanks. Tim Anne Thomas Manes wrote: You're right. The array within the array should be mapped to this: login xmlns="http://some/namespace" usernametim/username passwordtim/password options namedummy1/name value xsi:type="xsd:string"dummy_val1/value /options options namedummy2/name value xsi:type="ns1:NamedValue" xmlns:ns1="http://some/namespace" namedummy2-1/name value xsi:type="xsd:string"val2-1/value namedummy2-2/name value xsi:type="xsd:int"314/value /value /options /login I suggest you file a bug report, because Axis is not generating the right message structure per the WSDL. Anne On 4/13/05, Tim K. (Gmane) [EMAIL PROTECTED] wrote: Hi Anne, I actually started from Java classes using Java2WSDL (I know this is not the best
Re: HELP PLEASE: array inside array and wrapped document/literal
Hi Anne, I would be curious to see what the correct message should look like for a String[] as the value of the NamedvAlue, i.e. something like this: NamedValue object: name: "dummy-2" value: String[] options namedummy2/name value xsi:type="." !-- How do you form the String[] in here? -- /value /options Are wrappers always needed in this case? Thanks. Tim Anne Thomas Manes wrote: You're right. The array within the array should be mapped to this: login xmlns="http://some/namespace" usernametim/username passwordtim/password options namedummy1/name value xsi:type="xsd:string"dummy_val1/value /options options namedummy2/name value xsi:type="ns1:NamedValue" xmlns:ns1="http://some/namespace" namedummy2-1/name value xsi:type="xsd:string"val2-1/value namedummy2-2/name value xsi:type="xsd:int"314/value /value /options /login I suggest you file a bug report, because Axis is not generating the right message structure per the WSDL. Anne On 4/13/05, Tim K. (Gmane) [EMAIL PROTECTED] wrote: Hi Anne, I actually started from Java classes using Java2WSDL (I know this is not the best practice, but if there's something wrong with the WSDL I could try and fix it by hand). The ArrayOfNamedValue is defined like below, but it does not seem to come into play at all: - complexType name="ArrayOfNamedValue" - sequence element name="item" type="impl:NamedValue" minOccurs="0" maxOccurs="unbounded" / /sequence /complexType I exposed this method: NamedValue[] login(String username, String password, NamedValue[] options) Which in the WSDL the request looks like this: - element name="login" - complexType - sequence element name="username" type="xsd:string" / element name="password" type="xsd:string" / element name="options" type="impl:NamedValue" maxOccurs="unbounded" / /sequence /complexType /element And the response like this: - element name="loginResponse" - complexType - sequence element name="loginReturn" type="impl:NamedValue" maxOccurs="unbounded" / /sequence /complexType /element This seems OK so far, even though ArrayOfNamedValue is defined but it does not seem to be used. This is exactly what I want to pass back and forth: NamedValue object: name: "dummy-2" value: NamedValue[] But it doesn't look like that's what I get on the server side, it seems that I get: NamedValue object: name: "dummy-2" value: NamedValue --- Note no array [] here And the value of the red NamedValue is the last value sent, in my example below it's 314 How would Axis know that it needs to convert the request below into a NamedValue[] on the server side? What if the sequence of values would not be homogeneus, would it convert it into an Object[] instead (if it worked at all)? login xmlns="http://some/namespace" usernametim/username passwordtim/password options namedummy1/name value xsi:type="xsd:string"dummy_val1/value /options options namedummy2/name value xsi:type="ns1:NamedValue" xmlns:ns1="http://some/namespace" namedummy2-1/name value xsi:type="xsd:string"val2-1/value /value value xsi:type="ns2:NamedValue" xmlns:ns2="http://some/namespace" namedummy2-2/name value xsi:type="xsd:int"314/value /value /options /login The part in red above does not seem to map to this: NamedValue object: name: "dummy-2" value: NamedValue[] This confuses me greatly, I'm not sure whether what I'm trying to do is allowed/supported over wrapped doc/literal at all, if it is not I should then switch back to rpc/encoded or it's just a bug in Axis. Btw, .NET doesn't seem to be able to convert the red fragment above into a NamedValue[] so I suspect the message generated by Axis is not correct when it comes to arrays inside arrays. Thanks. Tim Anne Thomas Manes wrote: Tim, How did you define the array of NamedValue in the schema (where did the options tag come from)? It looks to me as if the message corresponds to the request. Because you're using xsd:anytype, the value element may contain an array of the NameValue. Hence the dummy-2 object is defined thus: NamedValue object: name: "dummy-2" value: NamedValue[] Is this not what you want? Anne On 4/13/05, Tim K. (Gmane) [EMAIL PROTECTED] wrote: Hello, If someone could please help me with this issue I would appreciate it. I recently con
Re: HELP PLEASE: array inside array and wrapped document/literal
Anne, That makes sense. That's why I kept pushing and asking questions just to make sure what looks like common sense is actually true. So it looks like I would have at least 3 choices here: 1) Define in the schema all possible types ArrayOfXxxx that could occur at run-time. This is less than ideal because errors would not be discovered until run-time, but it could be done with enough testing. Also, the Axis bug would still need to be fixed so that it works at all. 2) Change the definition of the value element of NamedValue to be: xsd:element name="value" type="xsd:anyType" maxOccurs="unbounded"/ But then end up with a generated NamedValue class on the client side whose value is an Object[] instead of Object. The server class would also have to be changed accordingly and that's not really an option at this point as there is *a lot* of code written and it's too late to change it. This is more of a hack than a real solution. 3) Use rpc/encoded instead which I know works well, except for custom exception/fault deserialization in .NET Maybe something custom can be done on the .NET side for this case. Tim Anne Thomas Manes wrote: Well -- actually, you shouldn't be able to send an array of String unless you had previously defined a type which is an array of string. You see -- that what's really going wrong in Tim's application. Consider this point: The "value" element has not been defined to allow multiple occurrences. To make that work, then you would need to define the "value" element like this: xsd:element name="value" type="xsd:anyType" maxOccurs="unbounded"/ But the way it's defined, an options element contains one name element and one value element. You see, this is the really challenging thing about using xsd:anyType. Axis can't generate schema type definitions on the fly (or if it did, it would have to send the schema with the request). Assuming that you had previously defined an ArrayOfString type: xsd:complexType name="ArrayOfString" xsd:sequence xsd:element name="item" type="xsd:string" maxOccurs="unbounded"/ xsd:sequence xsd:complexType Then you should be able to send: NamedValue object: name: "dummy2" value: String[] And on the wire, it would look like this: options namedummy2/name value xsi:type="ns1:ArrayOfString" itemblah/item itemblah/item /value /options On 4/13/05, Tim K. (Gmane) [EMAIL PROTECTED] wrote: Hi Anne, I would be curious to see what the correct message should look like for a String[] as the value of the NamedvAlue, i.e. something like this: NamedValue object: name: "dummy-2" value: String[] options namedummy2/name value xsi:type="." !-- How do you form the String[] in here? -- /value /options Are wrappers always needed in this case? Thanks. Tim Anne Thomas Manes wrote: You're right. The array within the array should be mapped to this: login xmlns="http://some/namespace" usernametim/username passwordtim/password options namedummy1/name value xsi:type="xsd:string"dummy_val1/value /options options namedummy2/name value xsi:type="ns1:NamedValue" xmlns:ns1="http://some/namespace" namedummy2-1/name value xsi:type="xsd:string"val2-1/value namedummy2-2/name value xsi:type="xsd:int"314/value /value /options /login I suggest you file a bug report, because Axis is not generating the right message structure per the WSDL. Anne On 4/13/05, Tim K. (Gmane) [EMAIL PROTECTED] wrote: Hi Anne, I actually started from Java classes using Java2WSDL (I know this is not the best practice, but if there's something wrong with the WSDL I could try and fix it by hand). The ArrayOfNamedValue is defined like below, but it does not seem to come into play at all: - complexType name="ArrayOfNamedValue" - sequence element name="item" type="impl:NamedValue" minOccurs="0" maxOccurs="unbounded" / /sequence /complexType I exposed this method: NamedValue[] login(String username, String password, NamedValue[] options) Which in the WSDL the request looks like this: - element name="login" - complexType - sequence element name="username" type="xsd:string" / element name="password" type="xsd:string" / element name="options" type="impl:NamedValue" maxOccurs="unbounded" / /sequence /complexType /element And the response like this: - element name="loginResponse" - complexType - sequence element name="loginReturn" type="impl:NamedValue" maxOccurs="unbounded" / /sequence /complexType /element This seems OK
Java2WSDL --deploy option how to
Does anyone have an example on how to use the Java2WSDL --deploy option? It's new in CVS and there's no documentation for it. If I add it to my old Java2WSDL command line, I get this: java.net.MalformedURLException: no protocol: /ws/generated/wsdl/Manager.wsdl at java.net.URL.init(URL.java:537) at java.net.URL.init(URL.java:434) at java.net.URL.init(URL.java:383) at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:214) at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:180) at oracle.xml.jaxp.JXDocumentBuilder.parse(JXDocumentBuilder.java:151) at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:369) at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:420) at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:473) at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:356) at java.lang.Thread.run(Thread.java:534) The WSDL file is output using --output option but then it can't find it?? Thanks. -- Tim
Re: POST HTTP/1.1
Thanks Simon. Do you happen to know if using the CommonsHTTPSender will solve the handling of multiple cookies also? http://issues.apache.org/jira/browse/AXIS-1080 Tim Simon Fell wrote: See this document for an example, it also supports digest auth http://www.devx.com/DevX/Article/21911/1763 -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Tim K. (Gmane) Sent: Friday, April 08, 2005 1:39 PM To: axis-user@ws.apache.org Subject: Re: POST HTTP/1.1 Simon, How do you reconfigure it to use CommonsHTTPSender? Do you have an example please? Also, would it be possible to use some other HTTPClient that would support digest auth, etc.? Thanks. Tim Simon Fell wrote: Change your sender config to use commonsHTTPSender instead of the default HTTPSender class. Cheers Simon -Original Message- From: Ada Lam [mailto:[EMAIL PROTECTED] Sent: Friday, April 08, 2005 1:10 PM To: axis-user@ws.apache.org Subject: POST HTTP/1.1 Hi all, I am currently using axis 1.2 RC3. I want to send SOAP message to server via POST HTTP/1.1. However, axis is using POST HTTP/1.0. I've tried to change it by doing: call.getMessageContext().setProperty(org.apache.axis.MessageCo ntext.HTTP_TRANSPORT_VERSION, org.apache.axis.transport.http.HTTPConstants.HEADER_PROTOCOL_11); But it doesn't work. How can I change the HTTP version from 1.0 to 1.1 in axis? Thanks in advance! Regards, Ada
Re: Java2wsdl and interfaces
I don't think it's possible to do what you want, you need your method to return a true JavaBean class, not an interface. Think about it this way: what if IState were an argument to one of your methods (I know this is not your case)? When a client called your service how would Axis know what instance(s) of IState to create? Tim Oleg Lebedev wrote: Could anyone give me some feedback on the following? -Original Message- From: Oleg Lebedev [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 05, 2005 3:51 PM To: axis-user@ws.apache.org Subject: Java2wsdl and interfaces Greetings. I am trying to expose my Java interface as a web service. The interface itself defines a method, which returns IState interfaces. So, when I use axis-java2wsdl ant task I get the following warning: The class IState does not contain a default constructor, which is a requirement for a bean class. The class cannot be converted into an xml schema type. An xml schema anyType will be used to define this class in the wsdl file. This causes axis-java2wsdl to avoid generating xsd type mappings for the IState interface. So, when later I use axis-wsdl2java, I get the following error: IState is referenced but not defined. I remember other people having the same problem, but I can't find a solution on the mailing list. So, the question is how I tell axis-java2wsdl that a concrete implementation class State should be used when generating type mappings for interface IState? Regards. Oleg
Re: design question xsd:anyType/java Object
Nobody can help with a design question? :( I know there are smart people on this list, don't hold back ... Tim Tim K. (Gmane) wrote: Hello, It seems that support for xsd:anyType (java Object) is optional in JAX-RPC, though Axis supports it. What would you suggest as an alternative to a JavaBean like this: public class Property { private String name; private Object value; // getters + setters ... } It's useful in exposing methods like this: public Property[] getProperties(...); public void setProperties(Property[] props); The current implementation works in Axis, at runtime everything seems to be OK as long as the value is of a type that can be serialized. Wrapped doc/literal doesn't support polymorphism from what I read. I'm wondering if there are any issues I may run into (besides running into a type that can't be serialized at runtime, I can prevent that at least on the server side). Should I continue using it if it works or is there a better approach? Thanks.
Re: Generated Stubs and Thread Safe
I asked the same question a while back and I was told that the Stub and the Call are not thread safe, but they can be re-used from the same thread. I'm not sure about the ServiceLocator, but if you want to maintain multiple sessions for example, you need one instance of ServiceLocator per session because the instance has an instance of the HTTP transport object which holds the session cookie (if the session tracking is done via cookies). I'm not sure what happens if you use the same ServiceLocator from multiple threads and get 2 or more Stub or Call instances and make concurrent requests, you may end up blocking some threads because of possible synchronization at the HTTP transport object. I think the safe thing to do is have a ServiceLocator per thread and get the Stub/Call from that. This is definitely a topic that would be worth putting in the wiki, so if someone who has the final answer could comment on it ... Tim [EMAIL PROTECTED] wrote: Hello, Are the generated stubs thread safe . Is 1. From invoke call stand point 2. From setting the properties Is it advisable to Re-Use the same stub Object we need to create a new one , per Thread, per Request.] Thanks and Regards, Gary Grewal This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates
Re: xsd:anyType with null value, deserialization problem
Axis Developers, Could you please comment on this? Is this a bug? Anything that I am doing wrong? Thank you. Tim Tim K. (Gmane) wrote: Hello, I have a simple JavaBean: Property { String name; Object value; } The value field maps to xsd:anyType and it works fine at run-time with all sorts of object types that can be serialized. However, when the passed value is null, the Axis 1.2RC2 *client* prints this error (though it seems to still work OK): Mar 22, 2005 1:58:38 PM org.apache.axis.encoding.DeserializationContext getDeserializerForClass SEVERE: No deserializer for java.lang.Object Is this an warning that should not be there or is there something wrong that I'm doing that should be fixed? Thank you.
wrapped doc/literal and Object vs. primitive types
Hello, Is it OK to use the wrapper objects and arrays of wrapper objects, e.g. Long and Long[] vs. long and long[] for wrapped doc/literal? Will this work with .NET? I know that it doesn't work for rpc/encoded with .NET as .NET will send xsd:long rather than soapenc:long so if a method takes a Long argument Axis will expect soapenc:long and instead it gets xsd:long. Will wrapped doc/literal make this possible and allow sending null values which is not possible with the primitive types? Or is the recommendation to always use primitive types and forget about the wrapper objects? Thank you for your answers. -- Tim
design question xsd:anyType/java Object
Hello, It seems that support for xsd:anyType (java Object) is optional in JAX-RPC, though Axis supports it. What would you suggest as an alternative to a JavaBean like this: public class Property { private String name; private Object value; // getters + setters ... } It's useful in exposing methods like this: public Property[] getProperties(...); public void setProperties(Property[] props); The current implementation works in Axis, at runtime everything seems to be OK as long as the value is of a type that can be serialized. Wrapped doc/literal doesn't support polymorphism from what I read. I'm wondering if there are any issues I may run into (besides running into a type that can't be serialized at runtime, I can prevent that at least on the server side). Should I continue using it if it works or is there a better approach? Thanks. -- Tim
Re: can I use Axis for this?
Have you looked at this: http://java.sun.com/j2se/1.4.2/docs/api/java/beans/XMLDecoder.html http://java.sun.com/j2se/1.4.2/docs/api/java/beans/XMLEncoder.html Or JAXB http://java.sun.com/xml/jaxb/ Tim [EMAIL PROTECTED] wrote: Greetings list, I need to deserialize xml file to java objects, could anyone give me some suggestions? Can I use axis for this purpose? Once a xml file is parsed to a DOM tree, is there a nice tool to use to get the object(s) if the Class is given? I'm thinking that a tool should be able to figure it out how to populate the java object using reflection when having the DOM tree. Your suggestions will be appreciated! Thanks Richard
Re: How not to advertise WSDL?
Interesting. Thank you. Question: I see the following in the FAQ: Stop AxisServlet listing services To do this, set the Axis global configuration property axis.enableListQuery to false. What is an Axis global configuration property? Is it a java system property (as in 'java -Daxis.enableListQuery=false ...') or is there some other configuration file/servlet/context parameter where this needs to be set and I am not aware of? Thank you. Tim Sunil Kothari wrote: Tim, I disagree. I think its possibleHere's the link http://ws.apache.org/axis/java/security.html look under this heading Stop Autogenerating WSDL I hope that helps. Sunil Kothari Valtech India DISCLAIMER: Any Information contained or transmitted in this e-mail and / or attachments may contain confidential data, proprietary to Majoris Systems Pvt Ltd., and / or the authors of the information and is intended for use only by the individual or entity to which it is addressed. If you are not the intended recipient or email appears to have been sent to you by error, you are not authorised to access, read, disclose, copy, use or otherwise deal with it. If you have received this e-mail in error, please notify us immediately at mail to: [EMAIL PROTECTED] and delete this mail from your records. This is to notify that Majoris Systems Pvt Limited shall have no liability or obligation, legal or otherwise, for any errors, omissions, viruses or computer problems experienced as a result of this transmission since data over the public Internet cannot be guaranteed to be secure or error-free. - Original Message - From: Tim K. (Gmane) [EMAIL PROTECTED] Date: Friday, March 25, 2005 9:32 am Subject: Re: How not to advertise WSDL? I asked the same question a while back in this thread: http://thread.gmane.org/gmane.comp.apache.webservices.axis.user/26811 Apparently it is not possible. Maybe things have changed since then. Tim Steve Sobol wrote: I just recently installed Axis and am impressed with it. JWS, in particular, is a great idea, and I expect it to be a big timesaver during the early stages of web service development. I'm planning on creating some services, however, that I don't want to advertise. Is there any way to prevent http://www.some.url/some.webservice?wsdl from spitting out the WSDL? Is there any way to prevent someone going to /some.webservice in a browser from seeing This is a web service? And is there some way to prevent Axis from displaying the service's descriptor in the list of deployed services? I know I can achieve these goals by hacking the source code. : What I need to know is if there is a way to accomplish any or all of them WITHOUT modifying the source. Thanks in advance, Steve
Re: Which Style of WSDL should I use
As usual, excellent answer from Anne! Keep contributing to this list, we all appreciate it. Tim Anne Thomas Manes wrote: One of the most important concepts to understand about the web services framework (WSF) is that it should not be used like a distributed object system. Web services communicate by exchanging messages -- it's more like JMS than RMI. The WSF doesn't support remote references, remote object garbage collection, or any of the other distributed object features you've come to rely upon in RMI. The fundamental purpose of the WSF is to enable interoperability across dissimilar systems that don't necessarily understand concepts such as method overloading, object inheritance, and polymorphism. Hence web service interfaces should not expose these OO concepts. For best interoperability with .NET, you should use document/literal with the wrapped programming convention. (Axis wrapped style.) You should flatten your object graph. You should not expose Java collections, such as maps and lists. You should convert all your collections into arrays. And you should not use overloaded methods. Each operation should have a different operation name. You should also expose a chunky interface rather than a chatty interface -- in other words, you should not expose getter and setter operations for every member in your object class. This goes back to the differentiation between message exchange versus distributed object systems. When using distributed objects, the object resides on the server side, and the client invokes operations on the object using a proxy. The client does not have its own copy of the object. When using a message exchange system, the client side application should have its own object -- not just a proxy. (And -- btw -- that object may be different from the server's object.) When the client communicates with the server, it simply passes data, not behavior. It's much more loosely coupled. You may find that it's necessary to build an abstraction layer between your WSDL interface and your middle tier applications. (This is a much better idea than trying to expose your rich datagraph directly.) This abstraction layer performs the necessary mapping between the document-oriented WSDL interface and the application's object model. It also provides much better insulation for flexibility and change. The wrapped style is defined in the JAX-RPC 1.1 spec, in section 6.4.1 Java Mapping of Literal Representation. (note that JAX-RPC 1.1 was originally designed around rpc/encoded, and added only cursory support for rpc/literal and document/literal at the last minute. So I wouldn't rely on JAX-RPC for definite recommendations for best practices.) The wrapped style supports a programming model that makes document/literal feel like RPC style. Wrapped style is very similar to RPC/literal, except for two important distinctions: 1- .NET supports wrapped style, but it doesn't support RPC/literal 2- wrapped style defines a schema of the full soap body (which makes it very easy to validate), while RPC/Literal defines a schema only of a portion of the soap body (which makes validation slightly more complicated). Please see my blog entry for a definition of the wrapped style: http://atmanes.blogspot.com/2005/03/wrapped-documentliteral-convention.html Anne On Wed, 23 Mar 2005 16:34:31 -0800, Tim K. (Gmane) [EMAIL PROTECTED] wrote: Good questions, I would like to know too ... In addition, is wrapped doc/literal Axis specific? It doesn't seem to be standard JAX-RPC. I guess my bigger question is: Is it possible to have RPC-like web services (exposing lots of methods the client can call) and use doc/literal encoding? If so, what's the approach? Tim Soti, Dheeraj wrote: Hi, I have to expose our middle-tier (J2EE) APIs as web service which will be consumed by a .NET clients (and possibly Java clients as well). I came across an article _http://www-128.ibm.com/developerworks/webservices/library/ws-whichwsdl/_ that explained all the possible styles beautifully but also raised few questions in mind. I will appreciate if someone will share his experience with me. * WS-I says no to RPC/encoded but as per the article it has some benefits like Polymorphism and datagraph which is true in my business case as well. I have a class that can have members of itself. Will I have problems using doc/literal(wrapped) * WS-I also advises not to use overloaded methods but doesn't that put additional load on client. For example I have a method createContent(Content ct). I have 3 different implementations of Content so I'll have to add three methods createContentofType1/2/3. Or should I consider this as a tradeoff for being interop? Thanks Dheeraj
Axis and .NET interop with dates
Hello, What is the best way to pass dates back and forth from Java/Axis to .NET? If you have a Java method to be exposed as a web service that returns a date or takes as input a date, what should the Java type be? Date, Calendar, long, String representation? Are there any differences depending on the encoding to be used, e.g. rpc/encoded or wrapped doc/lit? Thank you. -- Tim
Axis client - digest authentication?
The Axis client seems to support basic auth as per the JAX-RPC spec, but is there a way to use digest authentication instead? If so, how? Thank you. -- Tim
Re: Axis and .NET interop with dates
So is there a way to make a Java Date/Calendar just interoperate with the .NET DateTime type whithout any of the sides to make any conversions? I understand that in .NET DateTime can be converted to a long but it represents the number of 100-nanosecond intervals that have elapsed since 12:00 A.M., January 1, 0001 Tim James Black wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tim K. (Gmane) wrote: | If you have a Java method to be exposed as a web service that returns a | date or takes as input a date, what should the Java type be? Date, | Calendar, long, String representation? ~ I use long, and pass the unix time, or DD:MM:YY HH:MM:SS though the second part is optional, but I have to dictate the pattern to use, and this is a string, for my .net clients. - -- Love is mutual self-giving that ends in self-recovery. Fulton Sheen James Black[EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.5 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCQw2GikQgpVn8xrARAo2nAJkBbEMsZap3SViBzicTlLdC2V2qfwCgjuB/ Jk9rQnBaj/JNiwa3xhGhEcs= =tywm -END PGP SIGNATURE-
Re: How not to advertise WSDL?
I asked the same question a while back in this thread: http://thread.gmane.org/gmane.comp.apache.webservices.axis.user/26811 Apparently it is not possible. Maybe things have changed since then. Tim Steve Sobol wrote: I just recently installed Axis and am impressed with it. JWS, in particular, is a great idea, and I expect it to be a big timesaver during the early stages of web service development. I'm planning on creating some services, however, that I don't want to advertise. Is there any way to prevent http://www.some.url/some.webservice?wsdl from spitting out the WSDL? Is there any way to prevent someone going to /some.webservice in a browser from seeing This is a web service? And is there some way to prevent Axis from displaying the service's descriptor in the list of deployed services? I know I can achieve these goals by hacking the source code. : What I need to know is if there is a way to accomplish any or all of them WITHOUT modifying the source. Thanks in advance, Steve
Re: possible ways of creating WSDL file
In an ideal world I would agree with Anne. However, consider this scenario: you have a team of 10+ developers working on a server side API that follows the rules to allow it to be easily exposed as web services. The API has over 200+ methods total, distributed over 20+ modules. Each module would be exposed as a web service, hence 20+ WSDL files. The goal is to have the API on the server side look exactly the same as the API on the client side, so in theory an application built against the API could be run in process on the server or remotely via web services. Now, only a couple of these developers know anything about web services and even those developers are just getting their feet wet with web services. During the development cycle the API's can (slightly) change many times a day and everything needs to be recompiled/regenerated. I think it's unreasonable in this case to edit any generated WSDL files by hand. It's much more reasonable to just fire an ant task that starts with the server side java classes, generates the WSDL's and from those the client side stubs. This improves the development process a lot. I hope I'll live to see the day when the tools are good enough to achieve this task end to end. Obviously we are not there yet, but we are getting close. Btw, this is not an imaginary scenario, it's the cruel reality I live in every day. Tim Anne Thomas Manes wrote: I strongly disagree with Sunil. WSDL First (TM) is the way to go. I think it's okay to use java2wsdl to generate a WSDL template to start with, but you should always edit the generated WSDL. My recommendation is to use a WSDL editing wizard. Cape Clear provides a free one (SOA Editor). Altova and Sonic provide commercial ones. Anne On Wed, 23 Mar 2005 13:49:53 -0500, Soti, Dheeraj [EMAIL PROTECTED] wrote: Sunil, Will java2wsdl create the complex type hierarchies correctly? I have a complex class hierarchy (using inheritance and nested classes) and finally I ended up handcoding the wsdl from scratch. Did I miss something? I've also read some best practice articles talking about top down approach where u write your wsdl first and then proceed. Thanks Dheeraj -Original Message- From: Sunil Kothari [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 23, 2005 1:20 AM To: axis-user@ws.apache.org Cc: [EMAIL PROTECTED] Subject: Re:possible ways of creating WSDL file I think of 3 ways of creating WSDL 1) Using java2wsdl tool 2) Using .jws facility 3) Handcode WSDL I think 3) is error-prone and requires high level of understanding of WSDL. 2) is also not recommended for various reasons like a) No deployment descriptors are created b) WSDL is not persistent and prone to changes c) (This I am not sure) For overloaded methods this way of creation causes problems. I hope this helps. Sunil Kothari Valtech India DISCLAIMER: Any Information contained or transmitted in this e-mail and / or attachments may contain confidential data, proprietary to Majoris Systems Pvt Ltd., and / or the authors of the information and is intended for use only by the individual or entity to which it is addressed. If you are not the intended recipient or email appears to have been sent to you by error, you are not authorised to access, read, disclose, copy, use or otherwise deal with it. If you have received this e-mail in error, please notify us immediately at mail to: [EMAIL PROTECTED] and delete this mail from your records. This is to notify that Majoris Systems Pvt Limited shall have no liability or obligation, legal or otherwise, for any errors, omissions, viruses or computer problems experienced as a result of this transmission since data over the public Internet cannot be guaranteed to be secure or error-free.
Re: possible ways of creating WSDL file
In an ideal world, yes, we would have a DBA team too, but it's not 1999 any more, we need to get by with whatever resources we have. Our case is exactly what Joe describes, a server side API used by most of the clients in process and 1 client remotely, so it's very convenient to define the Java server API first and expose that as web services. It's just not practical in this case to start from the WSDL (or XML Schema). As for dropping in a class in the container, I think that's what the Web Services in J2EE 1.4 are supposed to do. Tim Joe Plautz wrote: This is a topic that is very close to my heart that I've agonized over for long periods of time. My ideal world would be for me to have a class that I can drop into some sort of container where I don't have to know anything about WSDL or deployment descriptors and security. That should be the containers work to figure it all out. I will wait patiently until that day. When developing a project that will be exposed as a web service you really need to decide what the intended target is. If it's a large server side api that will be used by multiple clients which for the most part aren't going to be using it as a web service, start with your code then generate a WSDL. If you are creating something that is going to be predominantly going to be used behind a web service, I would start with a WSDL. Also, I'm coming to the realization that nobody should have to deal with a WSDL. I like the idea of a XML Schema team, a group of of senior developers/architects who define what/why/how things are exposed. Joe Anne Thomas Manes wrote: In a better world, you have a XML Schema administration team (similar to your DBA team) that is responsible for developing the schemas that applications will communicate with. (Do your developers define their own database schemas???) When developers build services, they should be handed the schemas they are supposed to use, and then map those schems to their code. Developers should not generate WSDL from code. Anne On Wed, 23 Mar 2005 14:55:38 -0800, Tim K. (Gmane) [EMAIL PROTECTED] wrote: In an ideal world I would agree with Anne. However, consider this scenario: you have a team of 10+ developers working on a server side API that follows the rules to allow it to be easily exposed as web services. The API has over 200+ methods total, distributed over 20+ modules. Each module would be exposed as a web service, hence 20+ WSDL files. The goal is to have the API on the server side look exactly the same as the API on the client side, so in theory an application built against the API could be run in process on the server or remotely via web services. Now, only a couple of these developers know anything about web services and even those developers are just getting their feet wet with web services. During the development cycle the API's can (slightly) change many times a day and everything needs to be recompiled/regenerated. I think it's unreasonable in this case to edit any generated WSDL files by hand. It's much more reasonable to just fire an ant task that starts with the server side java classes, generates the WSDL's and from those the client side stubs. This improves the development process a lot. I hope I'll live to see the day when the tools are good enough to achieve this task end to end. Obviously we are not there yet, but we are getting close. Btw, this is not an imaginary scenario, it's the cruel reality I live in every day. Tim Anne Thomas Manes wrote: I strongly disagree with Sunil. WSDL First (TM) is the way to go. I think it's okay to use java2wsdl to generate a WSDL template to start with, but you should always edit the generated WSDL. My recommendation is to use a WSDL editing wizard. Cape Clear provides a free one (SOA Editor). Altova and Sonic provide commercial ones. Anne On Wed, 23 Mar 2005 13:49:53 -0500, Soti, Dheeraj [EMAIL PROTECTED] wrote: Sunil, Will java2wsdl create the complex type hierarchies correctly? I have a complex class hierarchy (using inheritance and nested classes) and finally I ended up handcoding the wsdl from scratch. Did I miss something? I've also read some best practice articles talking about top down approach where u write your wsdl first and then proceed. Thanks Dheeraj -Original Message- From: Sunil Kothari [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 23, 2005 1:20 AM To: axis-user@ws.apache.org Cc: [EMAIL PROTECTED] Subject: Re:possible ways of creating WSDL file I think of 3 ways of creating WSDL 1) Using java2wsdl tool 2) Using .jws facility 3) Handcode WSDL I think 3) is error-prone and requires high level of understanding of WSDL. 2) is also not recommended for various reasons like a) No deployment descriptors are created b) WSDL is not persistent and prone to changes c) (This I am not sure) For overloaded methods this way of creation causes problems. I hope this helps. Sunil Kothari Valtech India DISCLAIMER: Any Information contained or transmitted
Re: Which Style of WSDL should I use
Good questions, I would like to know too ... In addition, is wrapped doc/literal Axis specific? It doesn't seem to be standard JAX-RPC. I guess my bigger question is: Is it possible to have RPC-like web services (exposing lots of methods the client can call) and use doc/literal encoding? If so, what's the approach? Tim Soti, Dheeraj wrote: Hi, I have to expose our middle-tier (J2EE) APIs as web service which will be consumed by a .NET clients (and possibly Java clients as well). I came across an article _http://www-128.ibm.com/developerworks/webservices/library/ws-whichwsdl/_ that explained all the possible styles beautifully but also raised few questions in mind. I will appreciate if someone will share his experience with me. * WS-I says no to RPC/encoded but as per the article it has some benefits like Polymorphism and datagraph which is true in my business case as well. I have a class that can have members of itself. Will I have problems using doc/literal(wrapped) * WS-I also advises not to use overloaded methods but doesn't that put additional load on client. For example I have a method createContent(Content ct). I have 3 different implementations of Content so I'll have to add three methods createContentofType1/2/3. Or should I consider this as a tradeoff for being interop? Thanks Dheeraj
Re: possible ways of creating WSDL file
Well, what you are saying is right, when you develop your server side API you have to follow some rules in terms of the types allowed, signatures of the methods, JavaBeans, etc. It's very hard to expose an existing API without adding an extra layer. In our case we knew we wanted web services from day 1, so we have a set of rules (and limitations) that the API needs to follow. It's not the easiest API to use on the server side, but it's (relatively) easy to expose it as web services now. I think you are on the right track, it's painful, I hear you. Tim Soti, Dheeraj wrote: Tim, You mentioned '/write a server side Java API and expose it is as a web service'/. I am new to web services so when I started I had the same rosy picture in my mind but I failed at the very first step. The Java2WSDL was not able to create my complex class hierarchy. Also there were some types (Map, Collection) which are not interoperable (my clients are .NET based)Do you think I did something wrong. After some reading the impression I have is that I need to do lot of work to have a real working web service like: * having a separate API layer * duplicate classes in the API layer to make sure you don't break the API with every change in model, convert non-interop type to interop ones. * Take care of backward compatibility. Do you think I am totally on a wrong track and things are much simpler? I want to take benefit for other people experiences as compared to going on a wrong track and then learning myself the hard way. Thanks Dheeraj Soti -Original Message- From: news [_mailto:[EMAIL PROTECTED] On Behalf Of Tim K. (Gmane) Sent: Wednesday, March 23, 2005 4:31 PM To: axis-user@ws.apache.org Subject: Re: possible ways of creating WSDL file In an ideal world, yes, we would have a DBA team too, but it's not 1999 any more, we need to get by with whatever resources we have. Our case is exactly what Joe describes, a server side API used by most of the clients in process and 1 client remotely, so it's very convenient to define the Java server API first and expose that as web services. It's just not practical in this case to start from the WSDL (or XML Schema). As for dropping in a class in the container, I think that's what the Web Services in J2EE 1.4 are supposed to do. Tim Joe Plautz wrote: This is a topic that is very close to my heart that I've agonized over for long periods of time. My ideal world would be for me to have a class that I can drop into some sort of container where I don't have to know anything about WSDL or deployment descriptors and security. That should be the containers work to figure it all out. I will wait patiently until that day. When developing a project that will be exposed as a web service you really need to decide what the intended target is. If it's a large server side api that will be used by multiple clients which for the most part aren't going to be using it as a web service, start with your code then generate a WSDL. If you are creating something that is going to be predominantly going to be used behind a web service, I would start with a WSDL. Also, I'm coming to the realization that nobody should have to deal with a WSDL. I like the idea of a XML Schema team, a group of of senior developers/architects who define what/why/how things are exposed. Joe Anne Thomas Manes wrote: In a better world, you have a XML Schema administration team (similar to your DBA team) that is responsible for developing the schemas that applications will communicate with. (Do your developers define their own database schemas???) When developers build services, they should be handed the schemas they are supposed to use, and then map those schems to their code. Developers should not generate WSDL from code. Anne On Wed, 23 Mar 2005 14:55:38 -0800, Tim K. (Gmane) [EMAIL PROTECTED] wrote: In an ideal world I would agree with Anne. However, consider this scenario: you have a team of 10+ developers working on a server side API that follows the rules to allow it to be easily exposed as web services. The API has over 200+ methods total, distributed over 20+ modules. Each module would be exposed as a web service, hence 20+ WSDL files. The goal is to have the API on the server side look exactly the same as the API on the client side, so in theory an application built against the API could be run in process on the server or remotely via web services. Now, only a couple of these developers know anything about web services and even those developers are just getting their feet wet with web services. During the development cycle the API's can (slightly) change many times a day and everything needs to be recompiled/regenerated. I think it's unreasonable in this case to edit any generated WSDL files by hand. It's much more reasonable to just fire an ant task that starts
Re: Using .NET how to deserialize obj from detail element of SOAP fault sentby AXIS?
Anne, Would this then be an Axis bug? Shouldn't Axis generate the proper WSDL for custom exceptions when using WSDL2Java? Thanks. Tim Anne Thomas Manes wrote: Per both the SOAP 1.1 spec and the WS-I BP, faults must be described as document/literal -- even if the input and output messages are rpc/encoded. Perhaps that's why .NET is having so much trouble. Anne On Tue, 15 Mar 2005 20:11:45 -0800, Dino Chiesa [EMAIL PROTECTED] wrote: Does .NET uses XMLSerializer behind the scenes to perform serialization/deserialization of SOAP messages? Yes, it can, but not SOAP Section-5 encoded messages. In .NET, that is done by the SOAP serializer. Is there an alternative preferred/standard mechanism to define array types in the WSDL? Yes, see http://wiki.apache.org/ws/DotNetInteropArrays?action=show Assuming I was not using the funky array stuff, and just trying to deserialize a standard object with xsd string/int attributes etc by using the detail element inside a SoapException, do you know how you would go about doing this? Like this? catch (System.Web.Services.Protocols.SoapException ex1) { Console.WriteLine(SOAP Exception: '{0}', ex1.ToString()); if (ex1.Detail != null) { System.Xml.Serialization.XmlSerializer ser= new System.Xml.Serialization.XmlSerializer(typeof(FdkException)); System.IO.StringReader sr= new System.IO.StringReader(ex1.Detail.InnerXml); FdkException fault= (FdkException) ser.Deserialize(new System.Xml.XmlTextReader(sr)); Console.WriteLine(fault.errorCode: '{0}', fault.errorCode); Console.WriteLine(fault.stack: '{0}', fault.serverStackTraceId); // etc } else Console.WriteLine(detail is null!); } The FdkException has to be exposed into the WSDL, so that it gets generated into the client-side proxy class. or it must otherwise be known to the client. From: M S [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 15, 2005 9:23 PM To: axis-user@ws.apache.org Subject: RE: Using .NET how to deserialize obj from detail element of SOAP fault sentby AXIS? Hi Dino, Thanks for your reply. Does .NET uses XMLSerializer behind the scenes to perform serialization/deserialization of SOAP messages? If so, it seems to support these complex array types (defined in the same .WSDL file) fine - and I didn't do anything tricky to make this happen either. I just used the web reference tool to point to the WSDL file and woila! For example, on a successful login, the server returns a loginResponse message that is defined as following: wsdl:message name=loginResponse wsdl:part name=loginReturn type=impl:ArrayOfNamedValue / /wsdl:message complexType name=NamedValue sequence element name=name nillable=true type=xsd:string / element name=value nillable=true type=xsd:anyType / /sequence /complexType complexType name=ArrayOfNamedValue complexContent restriction base=soapenc:Array attribute ref=soapenc:arrayType wsdl:arrayType=impl:NamedValue[] / /restriction /complexContent /complexType complexType name=Item sequence element name=id type=xsd:long / element name=name nillable=true type=xsd:string / element name=requestedAttributes nillable=true type=impl:ArrayOfNamedValue / element name=type nillable=true type=xsd:string / /sequence /complexType Where: xmlns:impl=http://xmlns.mycompany.com/app/ws; and: xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; and: xmlns:xsd=http://www.w3.org/2001/XMLSchema; In my code, the following works perfectly: int sessionTimeout = -1, transactionTimeout = -1; Item user = null; NamedValue[] nvArray = null; try { nvArray = rlManager.login(username,password); } catch(System.Web.Services.Protocols.SoapException e) { throw; } for (int i=0; i nvArray.Length; i++) { switch (nvArray[i].name) { case WebServiceConstants.LOGIN_USER: if (!(nvArray[i].value is Item)) throw new exception.UnexpectedTypeException(WebServiceConstants.LOGIN_USER + not an Item.); user = (Item) nvArray[i].value; if (user.type != ItemTypes.USER) throw new exception.UnexpectedTypeException(WebServiceConstants.LOGIN_USER + not an Item of type + ItemTypes.USER); break; case WebServiceConstants.SESSION_TIMEOUT: if (!(nvArray[i].value is Int32)) throw new exception.UnexpectedTypeException(WebServiceConstants.SESSION_TIMEOUT + not an Int32.); sessionTimeout = (Int32) nvArray[i].value; break; case WebServiceConstants.TRANSACTION_TIMEOUT: if (!(nvArray[i].value is Int32)) throw new exception.UnexpectedTypeException(WebServiceConstants.TRANSACTION_TIMEOUT + not an Int32.); transactionTimeout = (Int32) nvArray[i].value; break; default: break; } } if (user == null) { throw new exception.AccessDeniedException(); } Is there an alternative preferred/standard mechanism to define array types in the WSDL?
Re: Using .NET how to deserialize obj from detail element of SOAP fault sentby AXIS?
Anne, First a correction, I meant to say Java2WSDL. I looked for a bug and I can't find anything, do you know if there's a bug filed already? If not, I will file one. I wonder if there's still enough time to get it fixed for the 1.2 release. Can any of the Axis developers please comment on this? Thanks. Tim Anne Thomas Manes wrote: I think so. On Fri, 18 Mar 2005 12:38:03 -0800, Tim K. (Gmane) [EMAIL PROTECTED] wrote: Anne, Would this then be an Axis bug? Shouldn't Axis generate the proper WSDL for custom exceptions when using WSDL2Java? Thanks. Tim Anne Thomas Manes wrote: Per both the SOAP 1.1 spec and the WS-I BP, faults must be described as document/literal -- even if the input and output messages are rpc/encoded. Perhaps that's why .NET is having so much trouble. Anne On Tue, 15 Mar 2005 20:11:45 -0800, Dino Chiesa [EMAIL PROTECTED] wrote: Does .NET uses XMLSerializer behind the scenes to perform serialization/deserialization of SOAP messages? Yes, it can, but not SOAP Section-5 encoded messages. In .NET, that is done by the SOAP serializer. Is there an alternative preferred/standard mechanism to define array types in the WSDL? Yes, see http://wiki.apache.org/ws/DotNetInteropArrays?action=show Assuming I was not using the funky array stuff, and just trying to deserialize a standard object with xsd string/int attributes etc by using the detail element inside a SoapException, do you know how you would go about doing this? Like this? catch (System.Web.Services.Protocols.SoapException ex1) { Console.WriteLine(SOAP Exception: '{0}', ex1.ToString()); if (ex1.Detail != null) { System.Xml.Serialization.XmlSerializer ser= new System.Xml.Serialization.XmlSerializer(typeof(FdkException)); System.IO.StringReader sr= new System.IO.StringReader(ex1.Detail.InnerXml); FdkException fault= (FdkException) ser.Deserialize(new System.Xml.XmlTextReader(sr)); Console.WriteLine(fault.errorCode: '{0}', fault.errorCode); Console.WriteLine(fault.stack: '{0}', fault.serverStackTraceId); // etc } else Console.WriteLine(detail is null!); } The FdkException has to be exposed into the WSDL, so that it gets generated into the client-side proxy class. or it must otherwise be known to the client. From: M S [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 15, 2005 9:23 PM To: axis-user@ws.apache.org Subject: RE: Using .NET how to deserialize obj from detail element of SOAP fault sentby AXIS? Hi Dino, Thanks for your reply. Does .NET uses XMLSerializer behind the scenes to perform serialization/deserialization of SOAP messages? If so, it seems to support these complex array types (defined in the same .WSDL file) fine - and I didn't do anything tricky to make this happen either. I just used the web reference tool to point to the WSDL file and woila! For example, on a successful login, the server returns a loginResponse message that is defined as following: wsdl:message name=loginResponse wsdl:part name=loginReturn type=impl:ArrayOfNamedValue / /wsdl:message complexType name=NamedValue sequence element name=name nillable=true type=xsd:string / element name=value nillable=true type=xsd:anyType / /sequence /complexType complexType name=ArrayOfNamedValue complexContent restriction base=soapenc:Array attribute ref=soapenc:arrayType wsdl:arrayType=impl:NamedValue[] / /restriction /complexContent /complexType complexType name=Item sequence element name=id type=xsd:long / element name=name nillable=true type=xsd:string / element name=requestedAttributes nillable=true type=impl:ArrayOfNamedValue / element name=type nillable=true type=xsd:string / /sequence /complexType Where: xmlns:impl=http://xmlns.mycompany.com/app/ws; and: xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; and: xmlns:xsd=http://www.w3.org/2001/XMLSchema; In my code, the following works perfectly: int sessionTimeout = -1, transactionTimeout = -1; Item user = null; NamedValue[] nvArray = null; try { nvArray = rlManager.login(username,password); } catch(System.Web.Services.Protocols.SoapException e) { throw; } for (int i=0; i nvArray.Length; i++) { switch (nvArray[i].name) { case WebServiceConstants.LOGIN_USER: if (!(nvArray[i].value is Item)) throw new exception.UnexpectedTypeException(WebServiceConstants.LOGIN_USER + not an Item.); user = (Item) nvArray[i].value; if (user.type != ItemTypes.USER) throw new exception.UnexpectedTypeException(WebServiceConstants.LOGIN_USER + not an Item of type + ItemTypes.USER); break; case WebServiceConstants.SESSION_TIMEOUT: if (!(nvArray[i].value is Int32)) throw new exception.UnexpectedTypeException(WebServiceConstants.SESSION_TIMEOUT + not an Int32.); sessionTimeout = (Int32) nvArray[i].value; break; case WebServiceConstants.TRANSACTION_TIMEOUT: if (!(nvArray[i].value is Int32)) throw new exception.UnexpectedTypeException