Apache

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Newbie Question , Can't get the response !

    0 answers - 2174 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi,
    I am very new to Axis 2 and after going through the documentation
    , i wrote a add service to get used to axis2. I wrote the service
    class and generated the wsdl from it using using the Java2WSDL tool ,
    and client stubs using WSDL2Java tool. After I deployed the service, I
    get an exception saying "java.lang.RuntimeException: Unexpected
    subelement return" , which is generated in the Clint stub. What is the
    cause of this exception ? am I implementing the client and the service
    the correct way ? Thank you very much in advance
    ~ Krishan
    Service Method
    public static MElement add ( MElement elem )
    {
    Iterator iter = elem.getChildElements();
    MElement root = (MElement)iter.next();
    Iterator iter2 = root.getChildElements();
    String param1Str = ((MElement)iter2.next()).getText();
    String param2Str = ((MElement)iter2.next()).getText();
    int answer = Integer.parseInt(param1Str) + Integer.parseInt(param2Str);
    MFactory factory = MAbstractFMFactory();
    MNamespace ns1 = MNamespace
    ("http://services.axis2.test/xsd","ns1");
    MElement responce = MElement("addResponse",ns1);
    MElement result = MElement("return",ns1);
    result.setText(S(answer));
    responce.addChild(result);
    return responce;
    }
    Client Code
    AddServiceStub service = new AddServiceStub(null,
    "");
    AddServiceStub.Add = new AddServiceStub.Add();
    MFactory factory = MAbstractFMFactory();
    MNamespace ns5 =
    MNamespace("http://somenamespace","ns5");
    MElement paramArray = MElement("root",ns5);
    MElement arg0 = MElement("",ns5);
    arg0.setText("2");
    MElement arg1 = MElement("arg1",ns5);
    arg1.setText("3");
    paramArray.addChild(arg0);
    paramArray.addChild(arg1);
    Elem(paramArray);
    AddServiceStub.AddResponse responce = service.add();
    MElement returnValue = responce.get_return();
    System.out.println(returnValue.getText());
    To unsubscribe, e-mail: axis-user-unsubscribe (AT) ws (DOT) apache.org
    For additional commands, e-mail: axis-user-help (AT) ws (DOT) apache.org

Re: Newbie Question , Can't get the response !


max 4000 letters.
Your nickname that display:
In order to stop the spam: 0 + 9 =
QUESTION ON "Apache"

EMSDN.COM