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 Maruko <bs...@hotmail.fr> on 2009/09/02 03:45:38 UTC

Problem when invoking a Web service

Hi all, 

i wrote my first Web service using apache axis2(Eclipse Plugin), a simple
operation 
int addition  (int a , int b)
my problem is when i create the client, i obtain :
org.apache.axis2.AxisFault: For input string: "a"
	at
org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:486)
	at
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:343)
	at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
	at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
	at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
	at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528)
	at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508)
	at sample.yahooservices.RESTSearch.AXIOMClient.main(AXIOMClient.java:83)

i think i've done some mistakes when i wrote the Client

package sample.yahooservices.RESTSearch;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
 
public class AXIOMClient {
  private static String EPR =
"http://localhost:8080/axis2/services/calculer";
  private static String NS = "http://test";
 
  public static OMElement calculerPayload(int a ,int b) {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac.createOMNamespace(NS, "calculer");
    OMElement method = fac.createOMElement("addition", omNs);
    System.out.println("er1");
    OMElement value = fac.createOMElement("a", omNs);
    OMElement value2 = fac.createOMElement("b", omNs);
    value.addChild(fac.createOMText(value,"a"));
    value2.addChild(fac.createOMText(value2,"b"));
    method.addChild(value);
    method.addChild(value2);	
    return method;
  }

please if any one can help me ; i really  need your help

Thank you in advance
-- 
View this message in context: http://www.nabble.com/Problem-when-invoking-a-Web-service-tp25250386p25250386.html
Sent from the Axis - User mailing list archive at Nabble.com.


Re: Problem when invoking a Web service

Posted by Amila Suriarachchi <am...@gmail.com>.
try to use the tcpmon and see the response you get.

thanks,
Amila.

On Wed, Sep 2, 2009 at 7:15 AM, Maruko <bs...@hotmail.fr> wrote:

>
> Hi all,
>
> i wrote my first Web service using apache axis2(Eclipse Plugin), a simple
> operation
> int addition  (int a , int b)
> my problem is when i create the client, i obtain :
> org.apache.axis2.AxisFault: For input string: "a"
>        at
>
> org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:486)
>        at
>
> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:343)
>        at
>
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
>        at
>
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
>        at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
>        at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528)
>        at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508)
>        at
> sample.yahooservices.RESTSearch.AXIOMClient.main(AXIOMClient.java:83)
>
> i think i've done some mistakes when i wrote the Client
>
> package sample.yahooservices.RESTSearch;
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMElement;
> import org.apache.axiom.om.OMFactory;
> import org.apache.axiom.om.OMNamespace;
> import org.apache.axis2.AxisFault;
> import org.apache.axis2.Constants;
> import org.apache.axis2.addressing.EndpointReference;
> import org.apache.axis2.client.Options;
> import org.apache.axis2.client.ServiceClient;
>
> public class AXIOMClient {
>  private static String EPR =
> "http://localhost:8080/axis2/services/calculer";
>  private static String NS = "http://test";
>
>  public static OMElement calculerPayload(int a ,int b) {
>    OMFactory fac = OMAbstractFactory.getOMFactory();
>    OMNamespace omNs = fac.createOMNamespace(NS, "calculer");
>    OMElement method = fac.createOMElement("addition", omNs);
>    System.out.println("er1");
>    OMElement value = fac.createOMElement("a", omNs);
>    OMElement value2 = fac.createOMElement("b", omNs);
>    value.addChild(fac.createOMText(value,"a"));
>    value2.addChild(fac.createOMText(value2,"b"));
>    method.addChild(value);
>    method.addChild(value2);
>    return method;
>  }
>
> please if any one can help me ; i really  need your help
>
> Thank you in advance
> --
> View this message in context:
> http://www.nabble.com/Problem-when-invoking-a-Web-service-tp25250386p25250386.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: Problem when invoking a Web service

Posted by Amila Suriarachchi <am...@gmail.com>.
this[1] may help you.

thanks,
Amila.

[1] http://wso2.org/library/95
On Thu, Sep 3, 2009 at 4:59 AM, Maruko <bs...@hotmail.fr> wrote:

>
> Hi,
> Thank you for your reply, but  i've test my service with soapUI and it
> works
> fine, but i don't know how to invoke web service, please if any one can
> help
> me by giving me links or can correct my Client
>
> Best regards
> --
> View this message in context:
> http://www.nabble.com/Problem-when-invoking-a-Web-service-tp25250386p25267419.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Re: Problem when invoking a Web service

Posted by Maruko <bs...@hotmail.fr>.
Hi, 
Thank you for your reply, but  i've test my service with soapUI and it works
fine, but i don't know how to invoke web service, please if any one can help
me by giving me links or can correct my Client

Best regards 
-- 
View this message in context: http://www.nabble.com/Problem-when-invoking-a-Web-service-tp25250386p25267419.html
Sent from the Axis - User mailing list archive at Nabble.com.