Creating Stub from WSDL on HTTPS
I created a stub from wsdl from HTTPS port but the uri in the stub shows http with port 80. Am I doing something wrong or do I have to make changes in tomcat settings or axis settings? I am using axis2 1.3 with tomcat 6. set JAVA_OPTS=-Djavax.net.ssl.trustStore="c:/program files/java/jre1.6.0_01/lib/security/cacerts" wsdl2java.bat -or -uw --noBuildXML -uri https://openapi.strands.com:443/services/Api?wsdl * Default Constructor */ public ApiStub( org.apache.axis2.context.ConfigurationContext configurationContext) throws org.apache.axis2.AxisFault { this(configurationContext, "http://openapi.strands.com:80/services/Api";); } /** * Default Constructor */ public ApiStub() throws org.apache.axis2.AxisFault { this("http://openapi.strands.com:80/services/Api";); } - Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Axis2] Axis2 and Enum type
They said the current Axis2 is based on Java 1.4 which doesn't have the enum type definition. I was told that this will be fixed in the next release (I am not sure if that was an official answer or not). For creating WSDL, look at the code (WSDLDataLocator.java) in Axis2 source. Here is what I do. Instead of inventing WSDL creator, create your own data locator "extended" from WSDLDataLocator. In outputInlineForm, get the result (OMElemet) from the parent and make changes there. protected Data[] outputInlineForm(MessageContext msgContext, ServiceData[] dataList) throws DataRetrievalException { Data[] result = super.outputInlineForm(msgContext, dataList); if (null != result && null != result[0]) { OMElement wsdlElement = (OMElement)result[0].getData(); this.generateCustomWSDL(wsdlElement); // call your own function result[0] = new Data(wsdlElement, null); } return result; } Then, add datalocator in service.xml Some API http://www.w3.org/2004/08/wsdl/in-only"; class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" /> http://www.w3.org/2004/08/wsdl/in-out"; class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" /> YOUR_SERVICE_CLASS http://schemas.xmlsoap.org/wsdl/"; class="YOUR_DATA_LOCATOR_CLASS" /> Hope this helps. - Leon Mathias P.W Nilsson wrote: I don't quit get the response. I don't generate the wsdl myself. Axis2 servlet does that I suppose. In my method I should return int instead? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Axis2] Enum
Amil, First, please refer to the attached email. According to Sanka, the enum type fix is on the table for the next release. I would like to confirm with you this would be in Axis2 1.4. By the way, when does it get released? In October? To respond to your answer: Yes, wsdl2java might support enum type. But the problem is that the server spits out a complex type instead of a simple type with restrictions. Please try it yourself. This problem could be solved by writing a custome WSDL or a custome data locator. However, here's the REAL main problem. The server does NOT work with any enum type. You will encounter a runtime exception when it returns or accepts an enum type. I wonder if this is all solved in the nightly-build version now. Thanks, - Leon Amila Suriarachchi wrote: On 9/3/07, *Mark Nüßler* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote: hello leon, it seems to me, that java2wsdl and wsdl2java does not support enums. wsdl2java support this. in a wsdl enumeration is represented by a simple type restriction enumeration. eg. and this type of xsd are supported in wsdl2java. a workaround that works 4 me is to replace the enum with a String before generating anything. on the serverside convert your enum to String Gender g = Gender.MALE; String g_send = g.toString(); an on clientside test, if the String is a valid enum try { Gender g_test = Gender.valueOf (g_send.toUpperCase()); System.out.println("valid Gender"); } catch(Exception e) { System.out.println("invalid Gender"); } i know its just a workaround mfg derMark Leon Hwang schrieb: > Can someone explain how I can return enum type object from Axis2 server? > > I am using Axis2 1.3 / Tomcat 6. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> -- Amila Suriarachchi, WSO2 Inc. -- Leon Hwang MyStrands, Inc. work: 1.541.753.4426 mobile: 1.541.740.7511 fax: 1.541.754.6416 email: [EMAIL PROTECTED] --- Begin Message --- On 8/30/07, Leon Hwang <[EMAIL PROTECTED]> wrote: > > Wow... > > Thank you, Keith. > > Then, I guess, returning enum type won't do any good. (like I can...) > > What does people do? > Is there any alternative? > Only way I can think of is to return a primitive type or String > representation of the enum value, > then communicate with developers wring client, "You have to use this EXACT > string". > > Keith, do you happen to know when the enum feature will be supported by > Axis2? It is on the table for next Axis2 release version. Best, Sanka Thank you, again. > > - Leon > > keith chapman wrote: > > Axis2 is JDK 1.4 compatible. Hence it does not use JDK 1.5 features. > > This is the reason you see code like the following. > > > > Gender g = new Gender(); > > g.getFEMALE(); > > > > Thanks, > > Keith. > > > > On 8/30/07, *Leon Hwang* <[EMAIL PROTECTED] > > <mailto:[EMAIL PROTECTED]>> wrote: > > > > Hello there, > > > > I created a simple function that returns an object type of enum. > > It is very simple function: > > > > public static Gender getGender() { > > return Gender.MALE; > > } > > > > but when I opened the page from a browser > > http://localhost:8080/OpenApi/services/TestApi10/getGender > > > > it generates an error like > > > > > > java.lang.RuntimeException: org.apache.axis2.AxisFault: > > Mapping qname not fond for the package: org.apache.catalina.loader > > > > > > > > If I return any other objects, it works fine. > > Am I not supposed to Enum type? > > I think this is an error in Axis2. > > By the way, I would not like to use Type-safe enum. > > It has its own problem. > > > > I have attached a source code and services.xml (TestApi.xml ) and > > wsdl (TestApi10.xml - created by Axis2 on the fly). > > > > > > By the way, if I create a client using WSDL2Java > > wsdl2java.bat -or -g -Eofv -uw -u -uri > > http://localhost:808
Re: [Axis2] Axis2 and New field
Thank you, Norris. Yes I am using 1.3 and it didn't work. I understand that it will work if I modify the java code or xslt file. However, I am more concerned about my clients who probably don't want to waste time looking into Axis2 code. I could explain to them change such such lines and recompile, but that is a lot of hassle. It would be very nice if the feature is built in Axis2. Thanks, - Leon Merritt, Norris wrote: See the earlier thread (attached) on this issue. I haven't had the opportunity to try -Eosv with Axis2 1.3 yet. I'm curious, are you using Axis 1.3 or an earlier version? As I explained in my earlier post, the only way I have been able to work around this issue is to modify the XSLT contained in the axis2-adb-codegen jar file to cause different client code to be emitted. Basically you need the generated client code to silently consume the unexpected elements / subelements as it is pull-parsing responses, instead of throwing an exception. -Original Message----- From: Leon Hwang [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 29, 2007 2:33 PM To: [EMAIL PROTECTED]; axis-user@ws.apache.org Subject: [Axis2] Axis2 and New field Greetings, I am writing a server that returns an object, say User object, containing only username. I create a client using its wsdl (with option -d adb -uw -Eosv). The client is able to retrieve username field correctly. Later I added one more field to User object, say password, and redeployed it to the server. Now the client complains about the field with "unexpected subelement password". (ADBException) This will happen a lot in business world as their spec changes. Is there some way (either in client or server) we can make it ignore extra elements? Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Subject: RE: Newbie question about using axis as webservice client From: "Merritt, Norris" <[EMAIL PROTECTED]> Date: Fri, 3 Aug 2007 17:27:09 - To: To: CC: <[EMAIL PROTECTED]> Axis2 adb style clients can be made tolerant of new elements added to a web service by modifying ADBBeanTemplate.xsl contained in axis2-adb-codegen-1.2.jar. This xsl is used to generate the Java code which pull-parses responses from the web service. This generated code is what throws exceptions when it encounters unrecognized elements. It is fairly trivial to modify the xsl to generate code which is tolerant of newly-added elements (i.e. just silently consumes and discards them) instead of crashing. I have done this. To some no doubt this is heresy, to others (myself included) it is worthwhile because it can be used to achieve looser coupling between the client and service, and that is good. There are many business use cases where a service is extended with some new elements which are not needed by existing clients. The notion that every previously deployed client should have to be recompiled and redeployed just because the service was extended is broken, IMHO. _ From: Lahiru Sandakith [mailto:[EMAIL PROTECTED] Sent: Friday, August 03, 2007 4:13 AM To: axis-user@ws.apache.org Subject: Re: Newbie question about using axis as webservice client Hi DelGurth, As you say the webservice changed then the wsdl also should be different, so IMO there is no option other than regenerating the client using wsdl2java tool (via Eclipse), because its an interface level change. Thanks Lahiru Sandakith On 8/3/07, DelGurth <[EMAIL PROTECTED]> wrote: Hi, I recently stated using axis as my web service client. I've used the wsdl2java tool (via Eclipse) to generate the client code based on the wsdl file of the service. Now the web service changed, it contains a new field, and my client application doesn't work anymore. Is there a way to make my client ignore fields that are unknown to it? I tried finding an answer in the client-side axis documentation, but I can't find it, unfortunately. That's why I end up here. Regards, Wessel van Norel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Leon Hwang Senior Tech Lead MyStrands Inc. work: 1.541.753.4426 mobile: 1.541.740.7511 fax: 1.541.754.6416 email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Axis2] SoapHeader and WSDL Creation
Does anyone know how to enforce clients to pass certain Soap Headers using WSDL? What I mean is, in other words, I would like to create WSDL (Axis2 on-the-fly) that contains required Soap Headers. In .NET, you can set attributes for functions and WSDL created contains the header information. Thanks, - Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Axis2] Enum
Can someone explain how I can return enum type object from Axis2 server? I am using Axis2 1.3 / Tomcat 6. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Axis2] Axis2 and New field
Greetings, I am writing a server that returns an object, say User object, containing only username. I create a client using its wsdl (with option -d adb -uw -Eosv). The client is able to retrieve username field correctly. Later I added one more field to User object, say password, and redeployed it to the server. Now the client complains about the field with "unexpected subelement password". (ADBException) This will happen a lot in business world as their spec changes. Is there some way (either in client or server) we can make it ignore extra elements? Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Axis2] Axis2 and Enum type
Hello there, I created a simple function that returns an object type of enum. It is very simple function: public static Gender getGender() { return Gender.MALE; } but when I opened the page from a browser http://localhost:8080/OpenApi/services/TestApi10/getGender it generates an error like java.lang.RuntimeException: org.apache.axis2.AxisFault: Mapping qname not fond for the package: org.apache.catalina.loader If I return any other objects, it works fine. Am I not supposed to Enum type? I think this is an error in Axis2. By the way, I would not like to use Type-safe enum. It has its own problem. I have attached a source code and services.xml (TestApi.xml) and wsdl (TestApi10.xml - created by Axis2 on the fly). By the way, if I create a client using WSDL2Java wsdl2java.bat -or -g -Eofv -uw -u -uri http://localhost:8080/OpenApi/services/UserApi10?wsdl I get a warning like this: [WARN] Type {http://www.w3.org/2001/XMLSchema}Enum missing! How do I get rid of this? Also WSDL2Java doesn't create a enum type for Gender. Rather it is a regular class. Which I have to use it like Gender g = new Gender(); g.getFEMALE(); This didn't make a sense to me. As a comparison, .NET create an enum type correctly. In WSDL that .NET create, it is a just simpleType with restrictions. I don't know if that caused the problem or not. I would appreciate if you could give any help on this. Thank you, - Leon Test Services Api - v1.0 http://www.w3.org/2004/08/wsdl/in-only"; class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" /> http://www.w3.org/2004/08/wsdl/in-out"; class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" /> com.strands.openapi.services.user.TestApi10 package com.strands.openapi.services.user; import com.strands.openapi.types.user.Gender; public class TestApi10 { public static Gender getGender() { return Gender.MALE; } } http://schemas.xmlsoap.org/wsdl/"; xmlns:ns1="http://user.types.openapi.strands.com/xsd"; xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"; xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; xmlns:ns0="http://user.services.openapi.strands.com"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"; targetNamespace="http://user.services.openapi.strands.com";> TestApi10 http://user.services.openapi.strands.com"; attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://user.services.openapi.strands.com";> http://user.types.openapi.strands.com/xsd"; attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://user.types.openapi.strands.com/xsd";> http://schemas.xmlsoap.org/soap/http"; style="document"/> http://schemas.xmlsoap.org/soap/http"; style="document"/> http://localhost:8080/OpenApi/services/TestApi10"/> http://localhost:8080/OpenApi/services/TestApi10"/> http://localhost:8080/OpenApi/services/TestApi10"/> package com.strands.openapi.types.user; public enum Gender { MALE, FEMALE }- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]