take a look at this link for understanding complexTypes and xsd Schema Definitions http://ws.apache.org/axis/java/user-guide.html
Martin ______________________________________________ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. > Date: Sun, 8 Feb 2009 15:16:17 -0500 > From: [email protected] > Subject: Re: Is It Just Me? > To: [email protected] > > Deepal, > > Thank you. I will look at both right now. > > Mike > > ----- Original Message ----- > From: "Deepal Jayasinghe" <[email protected]> > To: <[email protected]> > Sent: Sunday, February 08, 2009 11:53 AM > Subject: Re: Is It Just Me? > > > > Hi Michael > > I would suggest you to read following articles, then you can get better > > idea about Axis2 service and how to invoke them. > > > > to understand POJO in axis2 :- http://wso2.org/library/2893 > > To understand Axis2 client side :- > > http://today.java.net/pub/a/today/2006/12/13/invoking-web-services-using-apache-axis2.html > >> OK. Is it me? I know I'm 1) not understanding Axis2's API and > >> therefore 2) not using it correctly. > >> > >> For the past three weeks I have been unable to get anything but the > >> simplist web service to work. By simplest I mean a web service that > >> passes and returns only primitives (i.e. int, float, String, > >> etc....). I have been following the examples I found on the web > >> (bottom-up web services with Axis2) and on the Apache Axis2 web site ( > >> bottom-up development web services with Axis2 and POJO's). Here is > >> some of what I've tried. Can anyone tell me what I'm missing? > >> > >> Bottom-Up Web Service Using Java Objects As Parameters And/Or Return > >> Values > >> public class WSDataOnlyObj > >> { > >> public String str = "This is a data only object"; > >> public int num = 1; > >> } > >> > >> > >> > >> public class WS > >> { > >> private String str; > >> private WSDataOnlyObj objDataOnly; > >> > >> public String GetString( ) > >> { > >> str = "This is a string"; > >> > >> return str; > >> } > >> > >> public WSDataOnlyObj GetDataOnlyObj( ) > >> { > >> objDataOnly = new WSDataOnlyObj( ); > >> return objDataOnly; > >> } > >> } > >> > >> > >> > >> CLIENT CODE > >> ----------- > >> import java.rmi.RemoteException; > >> import org.apache.axis2.AxisFault; > >> > >> public class WSClient > >> { > >> public static void main(String[] args) > >> { > >> try > >> { > >> WSStub.GetStringResponse getStringResp; > >> WSStub.GetDataOnlyObjResponse getDOObjResp; > >> > >> WSStub stub = new > >> WSStub("http://localhost:8080/Webservice/services/WS/ws/pojo/service"); > >> > >> getStringResp = stub.GetString(); > >> getDOObjResp = stub.GetDataOnlyObj(); > >> > >> System.out.println("RESULT Of Call To Web Service GetSting(): " + > >> getStringResp.get_return()); > >> System.out.println("RESULT Of Call To Web Service > >> GetDataOnlyObj().getStr(): " + > >> getDOObjResp.get_return().getStr()); > >> System.out.println("RESULT Of Call To Web Service > >> GetDataOnlyObj().getNum(): " + > >> getDOObjResp.get_return().getNum()); > >> } > >> catch(AxisFault axisEx) > >> { > >> System.out.println(axisEx.getMessage()); > >> } > >> catch(RemoteException remEx) > >> { > >> System.out.println(remEx.getMessage()); > >> } > >> } > >> } > >> > >> > >> > >> RESULTS > >> ------- > >> RESULT Of Call To Web Service GetSting(): This is a string > >> RESULT Of Call To Web Service GetDataOnlyObj().getStr(): null > >> RESULT Of Call To Web Service GetDataOnlyObj().getNum(): -2147483648 > >> You see!!!! Getting the String return value works fine with this > >> method but not getting the object return value. > >> Now let's look at trying the POJO example given in the Axis2 > >> documentation. > >> > >> Bottom-Up Web Service Using Java Objects As Parameters And/Or Return > >> Values - POJO Client Example > >> public class WSDataOnlyObj > >> { > >> private String str = "This is a data only object"; > >> public String GetString( ) > >> { > >> return str; > >> } > >> > >> public void SetString(String aStr) > >> { > >> str = aStr; > >> } > >> } > >> > >> > >> > >> public class WS > >> { > >> public WSDataOnlyObj GetDataOnlyObj( ) > >> { > >> WSDataOnlyObj objDataOnly = new WSDataOnlyObj( ); > >> return objDataOnly; > >> } > >> } > >> > >> import javax.xml.namespace.QName; > >> > >> import org.apache.axis2.AxisFault; > >> import org.apache.axis2.addressing.EndpointReference; > >> import org.apache.axis2.client.Options; > >> import org.apache.axis2.rpc.client.RPCServiceClient; > >> public class WSTestClientApp > >> { > >> public static void main(String[] args) > >> { > >> try > >> { > >> RPCServiceClient serviceClient = new RPCServiceClient( ); > >> > >> Options options = serviceClient.getOptions( ); > >> > >> EndpointReference epr = new > >> EndpointReference("http://localhost:8080/WSTest/services/WS"); > >> > >> options.setTo(epr); > >> > >> Object[ ] opWSDataOnlyObjArgs = new Object [ ] { }; > >> Class [ ] returnTypes = new Class [ ] {WSDataOnlyObj.class}; > >> > >> ..... > >> } > >> catch(AxisFault axisEx) > >> { > >> System.out.println(axisEx.getMessage()); > >> } > >> catch(RemoteException remEx) > >> { > >> System.out.println(remEx.getMessage()); > >> } > >> } > >> } > >> > >> Here's my problem with this example, this code (adapted from the > >> "weather" example) requires an import of the package containing the > >> WSDataOnlyObj. You can make this work for this example but unless I'm > >> wrong the client should get all objects from the stub and should not > >> have to access the development package of the web service object!!!!! > >> > >> These appear to be some serious problems with the Axis2 API. > >> > >> Can anyone explain what I might be missing? > >> > >> Thanks > > > > -- > > Thank you! > > > > > > http://blogs.deepal.org > > http://deepal.org > > > > > -------------------------------------------------------------------------------- > > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.0.233 / Virus Database: 270.10.19/1939 - Release Date: 02/07/09 > 13:39:00 > _________________________________________________________________ Windows Liveā¢: Keep your life in sync. http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_022009
