axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davanum Srinivas" <dava...@gmail.com>
Subject Re: error returning complex types (axis2)
Date Tue, 26 Jun 2007 13:03:02 GMT
Shiv,

Please create a JIRA.

thanks,
dims

On 6/26/07, Shiv <shivi@yahoo.com> wrote:
> It looks like if the business class method has 'throws AxisFault', the wsdl
> generated with axis2 is likely to have problems. First of all, the java2wsdl
> with xmlbeans does not work. It works with adb mode, but is likely to have
> runtime problems; particularly if the return type is an object (not the
> getPrice example in StockQuoteService that returns a double).
>
> In the attached sample client code, while the eetPrice works fine, it fails
> while invoking GetUsers.
>
>
> run.client:
>      [java] 42.0
>      [java] java.lang.RuntimeException: java.lang.RuntimeException:
> Unexpected subelement return
>      [java]     at
> samples.quickstart.service.adb.StockQuoteServiceStockQuoteSer
> viceSOAP11Port_httpStub.fromOM(StockQuoteServiceStockQuoteServiceSOAP11Port_http
> Stub.java)
>      [java]     at
> samples.quickstart.service.adb.StockQuoteServiceStockQuoteSer
> viceSOAP11Port_httpStub.GetUsers(StockQuoteServiceStockQuoteServiceSOAP11Port_ht
> tpStub.java:442)
>      [java]     at
> samples.quickstart.clients.ADBClient.main(ADBClient.java:20)
>      [java]     at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>      [java]     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>      [java]     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>      [java]     at java.lang.reflect.Method.invoke(Method.java:324)
>      [java]     at
> org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:193)
>      [java]     at
> org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava
> .java:130)
>      [java]     at
> org.apache.tools.ant.taskdefs.Java.run(Java.java:705)
>      [java]     at
> org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:177)
>      [java]     at
> org.apache.tools.ant.taskdefs.Java.execute(Java.java:83)
>      [java]     at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>      [java]     at
> org.apache.tools.ant.Task.perform(Task.java:364)
>      [java]     at
> org.apache.tools.ant.Target.execute(Target.java:341)
>      [java]     at
> org.apache.tools.ant.Target.performTasks(Target.java:369)
>      [java]     at
> org.apache.tools.ant.Project.executeTarget(Project.java:1214)
>      [java]     at
> org.apache.tools.ant.Project.executeTargets(Project.java:1062
> )
>      [java]     at
> org.apache.tools.ant.Main.runBuild(Main.java:673)
>      [java]     at
> org.apache.tools.ant.Main.startAnt(Main.java:188)
>      [java]     at
> org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
>      [java]     at
> org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
>      [java] Caused by: java.lang.RuntimeException: Unexpected subelement
> return
>      [java]     at
> samples.quickstart.service.adb.StockQuoteServiceStockQuoteSer
> viceSOAP11Port_httpStub$User$Factory.parse(StockQuoteServiceStockQuoteServiceSOA
> P11Port_httpStub.java)
>      [java]     at
> samples.quickstart.service.adb.StockQuoteServiceStockQuoteSer
> viceSOAP11Port_httpStub$GetUsersResponse$Factory.parse(StockQuoteServiceStockQuo
> teServiceSOAP11Port_httpStub.java:32209)
>      [java]     ... 22 more
>
>
> BUILD SUCCESSFUL
> Total time: 13 seconds
> C:\axis\axis2-1.2\samples\quickstartadb>
>
>  ________________________________
> Be a PS3 game guru.
> Get your game face on with the latest PS3 news and previews at Yahoo! Games.
>
>
> package samples.quickstart.clients;
>
> import
> samples.quickstart.service.adb.StockQuoteServiceStockQuoteServiceSOAP11Port_httpStub;
> public class ADBClient{
>     public static void main(java.lang.String args[]){
>         try{
>
> StockQuoteServiceStockQuoteServiceSOAP11Port_httpStub stub
> =
>                                 new
> StockQuoteServiceStockQuoteServiceSOAP11Port_httpStub("http://localhost:8804/xoraapps/services/StockQuoteService");
>
>
> StockQuoteServiceStockQuoteServiceSOAP11Port_httpStub.GetPrice
> req = new
> StockQuoteServiceStockQuoteServiceSOAP11Port_httpStub.GetPrice();
>
>                                             req.setSymbol("ABC");
>
>
>
> StockQuoteServiceStockQuoteServiceSOAP11Port_httpStub.GetPriceResponse
> res =
>                                                 stub.getPrice(req);
>
>             System.err.println(res.get_return());
>
>
> StockQuoteServiceStockQuoteServiceSOAP11Port_httpStub.GetUsersResponse
> uInfoResp = stub.GetUsers();
>
>
>         } catch(Exception e){
>             e.printStackTrace();
>             System.err.println("\n\n\n");
>         }
>     }
>
>
> }
>
> package samples.quickstart.service.pojo;
>
> import java.util.HashMap;
> import org.apache.axis2.AxisFault;
>
> public class StockQuoteService {
>     private HashMap map = new HashMap();
>
>     public double getPrice(String symbol) throws AxisFault {
>         Double price = (Double) map.get(symbol);
>         if(price != null){
>             return price.doubleValue();
>         }
>         return 42.00;
>     }
>
>     public void update(String symbol, double price) throws AxisFault {
>         map.put(symbol, new Double(price));
>     }
>
>     public User[] GetUsers() throws AxisFault {
>                 User[] users = new User[1];
>                 users[0] = new User();
>                 users[0].firstName = "Jason";
>                 users[0].lastName = "Manfield";
>
>             return users;
>     }
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Davanum Srinivas :: http://davanum.wordpress.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message