简体   繁体   中英

Axis2 SOAP request

I am newbie to web services. I have used WSDL2Java wizard of Axis2 to generate the stub code, so now I have a large number of generated classes (around 50 interfaces and 50 classes) and a bit confused.

Please help me to clarify.

how to create the XML file and send it as a SOAP request to send and receive the response? I have tried to follow the following code, in line 4 I used "null" but it asked for the "configure contex", also I am not sure how to do the line 8 afterwards for example I could not find "xsd.EchoStringReturnDocument" in my code.

 try {           org.apache.axis2.userguide.Axis2SampleDocLitServiceStub stub
4              = new org.apache.axis2.userguide.Axis2SampleDocLitServiceStub(null,
                 "http://localhost:8080/axis2/services/Axis2SampleDocLitService");
             //implementing the callback online
            org.apache.axis2.userguide.Axis2SampleDocLitServiceCallbackHandler callback =
            new org.apache.axis2.userguide.Axis2SampleDocLitServiceCallbackHandler() {
8                       public void receiveResultechoString(
                      org.apache.axis2.userguide.xsd.EchoStringReturnDocument resDoc) {
                       System.out.println(resDoc.getEchoStringReturn());
                       }
            };
        org.apache.axis2.userguide.xsd.EchoStringParamDocument reqDoc = 
          org.apache.axis2.userguide.xsd.EchoStringParamDocument.Factory.newInstance();
           reqDoc.setEchoStringParam("Axis2 Echo");
           stub.startechoString(reqDoc, callback);
        } catch (java.rmi.RemoteException e) {
          e.printStackTrace();
       }

What I am using : Axis2, Eclipse, JSP, Struts2

Any other understandable method is greatly appreciated.

Thanks in advance, :D

Since you are using axis 2, it will be easy for you to follow the same path for now.

http://people.apache.org/~ruchithf/hw-axis2/

I'll suggest reading about JAX-WS and JAXB as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM