You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Du, David (US SSA)" <da...@baesystems.com> on 2007/08/17 18:22:08 UTC

Question about jaxws-calculator

Hi, all,

 

In the jaxws-calculator example, the CalculatorService has a webservice
method: int add(int value1, int value2), then we have class Add and
class AddResponse, if this is the case, why do we need Add and
AddResponse classes for the service? Should we change the webservice
method to:

 

AddResponse add( Add add);

 

In this way we set value1 and value2 to Add object and set return value
in AddResponse object, otherwise the Add and AddResponse do not make
sense to have them in the webservice.

 

Anybody can explain?

 

Thanks in advance.

 

David


jaxws-calculator client exception

Posted by "Du, David (US SSA)" <da...@baesystems.com>.
Hi, all,

 

I am trying to develop a client for the original jaxws-calculator
example in axis2-1.2 release, the following is the client code, after I
deployed the jaxws-calculator, I can see the service in the admin
service list page and I can see the wsdl file when I clicked on the
calculatorService, but when I ran my client, I got an exception, the
client code and the exception are shown below:

 

Any ideas?

 

Thanks in advance

 

David

 

        public static void main(String[] args) {

 

                    Service svc;

                    try {

                                svc = Service.create(new

 
URL("http://localhost:8080/axis2/services/CalculatorService?wsdl"),

                                        

                                                        new
QName("http://calculator.jaxws.axis2.apache.org", "CalculatorService"));

                                Calculator proxy = svc.getPort(new
QName(

 
"http://calculator.jaxws.axis2.apache.org", "Calculator"),

 
Calculator.class);

                                int value1 = 10; int value2 = 20;

                                System.out.println("value1=["+value1+"]
value2=["+value2+"]");

                                int b = proxy.add(value1, value2);

                                System.out.println("Result:
b==["+b+"]");

                    } catch (MalformedURLException e) {

                                e.printStackTrace();

                    }

 

        }

 

 

     [java] Exception in thread "main" javax.xml.ws.WebServiceException:
org.apache.axiom.soap.SOAPProcessingException: 

First Element must contain the local name, Envelope

     [java]            at
org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(Except
ionFactory.java:172)

     [java]            at
org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(Exceptio
nFactory.java:67)

     [java]            at
org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(Exceptio
nFactory.java:125)

     [java]            at
org.apache.axis2.jaxws.core.controller.AxisInvocationController.execute(
AxisInvocationController.java:571)

     [java]            at
org.apache.axis2.jaxws.core.controller.AxisInvocationController.doInvoke
(AxisInvocationController.java:109)

     [java]            at
org.apache.axis2.jaxws.core.controller.InvocationController.invoke(Invoc
ationController.java:98)

     [java]            at
org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JA
XWSProxyHandler.java:278)

     [java]            at
org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invoke(JAXWSProxyH
andler.java:141)

     [java]            at $Proxy9.add(Unknown Source)

     [java]            at
org.apache.axis2.jaxws.calculator.Client.main(Client.java:25)

     [java] Caused by: org.apache.axiom.soap.SOAPProcessingException:
First Element must contain the local name, Envelope

     [java]           at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(St
AXSOAPModelBuilder.java:221)

     [java]            at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(
StAXSOAPModelBuilder.java:179)

     [java]            at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:1
35)

     [java]            at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(
StAXSOAPModelBuilder.java:163)

     [java]            at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPM
odelBuilder.java:111)

     [java]            at
org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:474
)

     [java]            at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUti
ls.java:142)

     [java]            at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUti
ls.java:77)

     [java]            at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOper
ation.java:356)

     [java]            at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisO
peration.java:294)

     [java]            at
org.apache.axis2.jaxws.core.controller.AxisInvocationController.execute(
AxisInvocationController.java:566)

     [java]            ... 6 more

     [java] Java Result: 1

________________________________