0

我在 Eclipse 中为 Java EE 开发人员编写了一个 java 类,并使用 web 服务向导将其作为 web 服务提供。

我正在尝试从 java 客户端调用其中的方法,因此我需要肥皂操作和命名空间,但找不到我的方法的 SOAP 操作。名称空间设置为默认名称空间。SOAP 操作 URL 应该是什么?如果我手动设置它们,Eclipse 中的客户端测试就会顺利进行。

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://DefaultNamespace" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://DefaultNamespace" xmlns:intf="http://DefaultNamespace" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
 <wsdl:types>
  <schema elementFormDefault="qualified" targetNamespace="http://DefaultNamespace" xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="login">
    <complexType>
     <sequence>
      <element name="email" type="xsd:string"/>
      <element name="passwd" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="loginResponse">
    <complexType>
     <sequence>
      <element name="loginReturn" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="getCourses">
    <complexType/>
   </element>
   <element name="getCoursesResponse">
    <complexType>
     <sequence>
      <element name="getCoursesReturn" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="getCourseMarks">
    <complexType>
     <sequence>
      <element name="courseID" type="xsd:int"/>
     </sequence>
    </complexType>
   </element>
   <element name="getCourseMarksResponse">
    <complexType>
     <sequence>
      <element name="getCourseMarksReturn" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="getStudentMarks">
    <complexType>
     <sequence>
      <element name="id" type="xsd:int"/>
     </sequence>
    </complexType>
   </element>
   <element name="getStudentMarksResponse">
    <complexType>
     <sequence>
      <element name="getStudentMarksReturn" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="listTopics">
    <complexType/>
   </element>
   <element name="listTopicsResponse">
    <complexType>
     <sequence>
      <element name="listTopicsReturn" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="getTopicRegistrants">
    <complexType>
     <sequence>
      <element name="topicName" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="getTopicRegistrantsResponse">
    <complexType>
     <sequence>
      <element name="getTopicRegistrantsReturn" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
  </schema>
 </wsdl:types>

   <wsdl:message name="getStudentMarksRequest">

      <wsdl:part element="impl:getStudentMarks" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="listTopicsResponse">

      <wsdl:part element="impl:listTopicsResponse" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="getCourseMarksRequest">

      <wsdl:part element="impl:getCourseMarks" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="getCourseMarksResponse">

      <wsdl:part element="impl:getCourseMarksResponse" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="getCoursesResponse">

      <wsdl:part element="impl:getCoursesResponse" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="getTopicRegistrantsResponse">

      <wsdl:part element="impl:getTopicRegistrantsResponse" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="getCoursesRequest">

      <wsdl:part element="impl:getCourses" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="getTopicRegistrantsRequest">

      <wsdl:part element="impl:getTopicRegistrants" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="listTopicsRequest">

      <wsdl:part element="impl:listTopics" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="getStudentMarksResponse">

      <wsdl:part element="impl:getStudentMarksResponse" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="loginRequest">

      <wsdl:part element="impl:login" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="loginResponse">

      <wsdl:part element="impl:loginResponse" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:portType name="Services">

      <wsdl:operation name="login">

         <wsdl:input message="impl:loginRequest" name="loginRequest">

       </wsdl:input>

         <wsdl:output message="impl:loginResponse" name="loginResponse">

       </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="getCourses">

         <wsdl:input message="impl:getCoursesRequest" name="getCoursesRequest">

       </wsdl:input>

         <wsdl:output message="impl:getCoursesResponse" name="getCoursesResponse">

       </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="getCourseMarks">

         <wsdl:input message="impl:getCourseMarksRequest" name="getCourseMarksRequest">

       </wsdl:input>

         <wsdl:output message="impl:getCourseMarksResponse" name="getCourseMarksResponse">

       </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="getStudentMarks">

         <wsdl:input message="impl:getStudentMarksRequest" name="getStudentMarksRequest">

       </wsdl:input>

         <wsdl:output message="impl:getStudentMarksResponse" name="getStudentMarksResponse">

       </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="listTopics">

         <wsdl:input message="impl:listTopicsRequest" name="listTopicsRequest">

       </wsdl:input>

         <wsdl:output message="impl:listTopicsResponse" name="listTopicsResponse">

       </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="getTopicRegistrants">

         <wsdl:input message="impl:getTopicRegistrantsRequest" name="getTopicRegistrantsRequest">

       </wsdl:input>

         <wsdl:output message="impl:getTopicRegistrantsResponse" name="getTopicRegistrantsResponse">

       </wsdl:output>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="ServicesSoapBinding" type="impl:Services">

      <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="login">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="loginRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="loginResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="getCourses">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getCoursesRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="getCoursesResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="getCourseMarks">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getCourseMarksRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="getCourseMarksResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="getStudentMarks">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getStudentMarksRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="getStudentMarksResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="listTopics">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="listTopicsRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="listTopicsResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="getTopicRegistrants">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getTopicRegistrantsRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="getTopicRegistrantsResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="ServicesService">

      <wsdl:port binding="impl:ServicesSoapBinding" name="Services">

         <wsdlsoap:address location="http://localhost:8080/semisterproject/services/Services"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>
4

1 回答 1

0

调用 Web 服务不一定需要soap 动作……它取决于操作选择算法的实现(例如,可以使用请求主体的构成)。但是,如果生成的 Eclipse 代码使用注释,您应该能够使用 @WebMethod 注释 'action' 属性为相关方法指定所需的肥皂动作,如 @WebMethod(action="MyAction")。您可以在此地址找到一些文档:http ://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.wsfep.multiplatform.doc%2Finfo% 2Fae%2Fae%2Frwbs_jaxwsannotations.html 如果这没有帮助,请发布相关代码以提供额外的上下文。

于 2012-05-28T04:02:42.420 回答