简体   繁体   English

Axis2 SOAP请求

[英]Axis2 SOAP request

I am newbie to web services. 我是Web服务的新手。 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. 我已经使用Axis2的WSDL2Java向导来生成存根代码,所以现在我有大量的生成类(大约50个接口和50个类)并且有些困惑。

Please help me to clarify. 请帮我澄清一下。

how to create the XML file and send it as a SOAP request to send and receive the response? 如何创建XML文件并将其作为SOAP请求发送以发送和接收响应? 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. 我尝试遵循以下代码,在第4行中,我使用了“ null”,但要求输入“ configure contex”,例如,我不确定以后如何执行第8行,例如,我找不到“ xsd.EchoStringReturnDocument”在我的代码中。

 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 我正在使用的是: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. 由于您正在使用轴2,因此现在您可以轻松地遵循相同的路径。

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

I'll suggest reading about JAX-WS and JAXB as well. 我建议您也阅读有关JAX-WS和JAXB的文章。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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