Instead of using axis as a client it will be easier if you use XMLRPC.
Here is the link which will help you use XMLRPC.

https://cwiki.apache.org/OFBIZ/using-xmlrpc-as-an-alternative-to-soap.html

Regards,
Ankit Jain




On Thu, Jun 28, 2012 at 12:02 PM, 李明洋 <[email protected]> wrote:

> *The exported web service is defined as follow:*
>
> <service name="test.add" engine="java" auth="true" export="true"
>     location="org.aries.erp.test.TestServices"
>     invoke="add">
>    <attribute name="a" type="Integer" mode="IN" optional="false"
> ></attribute>
>    <attribute name="b" type="Integer" mode="IN"
> optional="false"></attribute>
>    <attribute name="result" type="Integer" mode="OUT"
> optional="false"></attribute>
>    </service>
>
> *the webservice client code is *
>
>
> public static void main(String[] args) {
>        Integer output = 0;
> String endpoint, username, password;
> try{
>            endpoint = "http://localhost:8080/webtools/control/SOAPService
> ";
>            username="admin";
>            password="ofbiz";
>            Call call = (Call) new Service().createCall();
>            call.setTargetEndpointAddress(new URL (endpoint));
>            call.setOperationName(new
> javax.xml.namespace.QName("test.add"));
>            Integer a = 3;
>            Integer b = 5;
>            call.addParameter("a", org.apache.axis.Constants.XSD_INT,
> javax.xml.rpc.ParameterMode.IN);
>            call.addParameter("b", org.apache.axis.Constants.XSD_INT,
> javax.xml.rpc.ParameterMode.IN);
>            call.addParameter("login.username",
> org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
>            call.addParameter("login.password",
> org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
>            call.setReturnType(org.apache.axis.Constants.SOAP_INTEGER);
>            Object response = call.invoke(
>                    new Object[]{
>                        a,
>                        b,
>                        username,
>                        password}
>                    );
>            output =  (Integer) response;
>            try{
>                    System.out.println(output);
>            }
>            catch(Exception e){
>                    e.printStackTrace();
>            }
> }catch(Exception e){
> e.printStackTrace();
> }
> return;
>    }
>
>  but it throws a exception : *org.xml.sax.SAXException: SimpleDeserializer
> encountered a child element, which is NOT expected, in something it was
> trying to deserialize.*
> *
> *
> Could you give me some help;
>
> thanks
>

Reply via email to